mirror of
https://github.com/gnif/LookingGlass.git
synced 2024-11-21 21:17:19 +00:00
[all] cmake: use -march=x86-64-v2 when it becomes available
Moves the logic in 0525515
to a common cmake include, and applies it to
the other binaries.
This commit is contained in:
parent
f09738678e
commit
be664c49c8
@ -1,21 +1,14 @@
|
|||||||
cmake_minimum_required(VERSION 3.0)
|
cmake_minimum_required(VERSION 3.0)
|
||||||
project(looking-glass-client C CXX)
|
project(looking-glass-client C CXX)
|
||||||
|
|
||||||
list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake/")
|
get_filename_component(PROJECT_TOP "${PROJECT_SOURCE_DIR}/.." ABSOLUTE)
|
||||||
|
list(APPEND CMAKE_MODULE_PATH "${PROJECT_TOP}/cmake/" "${PROJECT_SOURCE_DIR}/cmake/")
|
||||||
|
|
||||||
include(GNUInstallDirs)
|
include(GNUInstallDirs)
|
||||||
include(CheckCCompilerFlag)
|
include(CheckCCompilerFlag)
|
||||||
include(FeatureSummary)
|
include(FeatureSummary)
|
||||||
|
|
||||||
option(OPTIMIZE_FOR_NATIVE "Build with -march=native" ON)
|
include(OptimizeForNative) # option(OPTIMIZE_FOR_NATIVE)
|
||||||
if(OPTIMIZE_FOR_NATIVE)
|
|
||||||
CHECK_C_COMPILER_FLAG("-march=native" COMPILER_SUPPORTS_MARCH_NATIVE)
|
|
||||||
if(COMPILER_SUPPORTS_MARCH_NATIVE)
|
|
||||||
add_compile_options("-march=native")
|
|
||||||
endif()
|
|
||||||
else()
|
|
||||||
add_compile_options("-march=nehalem" "-mtune=generic")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
find_package(PkgConfig)
|
find_package(PkgConfig)
|
||||||
pkg_check_modules(FONTCONFIG_PKGCONFIG REQUIRED fontconfig)
|
pkg_check_modules(FONTCONFIG_PKGCONFIG REQUIRED fontconfig)
|
||||||
@ -87,7 +80,6 @@ find_package(GMP)
|
|||||||
|
|
||||||
add_definitions(-D ATOMIC_LOCKING)
|
add_definitions(-D ATOMIC_LOCKING)
|
||||||
add_definitions(-D GL_GLEXT_PROTOTYPES)
|
add_definitions(-D GL_GLEXT_PROTOTYPES)
|
||||||
get_filename_component(PROJECT_TOP "${PROJECT_SOURCE_DIR}/.." ABSOLUTE)
|
|
||||||
|
|
||||||
add_custom_command(
|
add_custom_command(
|
||||||
OUTPUT ${CMAKE_BINARY_DIR}/version.c
|
OUTPUT ${CMAKE_BINARY_DIR}/version.c
|
||||||
|
17
cmake/OptimizeForNative.cmake
Normal file
17
cmake/OptimizeForNative.cmake
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
option(OPTIMIZE_FOR_NATIVE "Build with -march=native" OFF)
|
||||||
|
if(OPTIMIZE_FOR_NATIVE)
|
||||||
|
CHECK_C_COMPILER_FLAG("-march=native" COMPILER_SUPPORTS_MARCH_NATIVE)
|
||||||
|
if(COMPILER_SUPPORTS_MARCH_NATIVE)
|
||||||
|
add_compile_options("-march=native")
|
||||||
|
endif()
|
||||||
|
else()
|
||||||
|
CHECK_C_COMPILER_FLAG("-march=x86-64-v2" COMPILER_SUPPORTS_MARCH_X86_64_V2)
|
||||||
|
if(COMPILER_SUPPORTS_MARCH_X86_64_V2)
|
||||||
|
add_compile_options("-march=x86-64-v2")
|
||||||
|
else()
|
||||||
|
CHECK_C_COMPILER_FLAG("-march=nehalem" COMPILER_SUPPORTS_MARCH_NEHALEM)
|
||||||
|
if(COMPILER_SUPPORTS_MARCH_NEHALEM)
|
||||||
|
add_compile_options("-march=nehalem")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
endif()
|
@ -4,29 +4,14 @@ project(looking-glass-host C)
|
|||||||
set(CMAKE_C_FLAGS_RELWITHDEBINFO "-O3 -g -DNDEBUG" CACHE STRING "compiler flags" FORCE)
|
set(CMAKE_C_FLAGS_RELWITHDEBINFO "-O3 -g -DNDEBUG" CACHE STRING "compiler flags" FORCE)
|
||||||
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O3 -g -DNDEBUG" CACHE STRING "compiler flags" FORCE)
|
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O3 -g -DNDEBUG" CACHE STRING "compiler flags" FORCE)
|
||||||
|
|
||||||
set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake/")
|
get_filename_component(PROJECT_TOP "${PROJECT_SOURCE_DIR}/.." ABSOLUTE)
|
||||||
|
list(APPEND CMAKE_MODULE_PATH "${PROJECT_TOP}/cmake/" "${PROJECT_SOURCE_DIR}/cmake/")
|
||||||
|
|
||||||
include(GNUInstallDirs)
|
include(GNUInstallDirs)
|
||||||
include(CheckCCompilerFlag)
|
include(CheckCCompilerFlag)
|
||||||
include(FeatureSummary)
|
include(FeatureSummary)
|
||||||
|
|
||||||
option(OPTIMIZE_FOR_NATIVE "Build with -march=native" OFF)
|
include(OptimizeForNative) # option(OPTIMIZE_FOR_NATIVE)
|
||||||
if(OPTIMIZE_FOR_NATIVE)
|
|
||||||
CHECK_C_COMPILER_FLAG("-march=native" COMPILER_SUPPORTS_MARCH_NATIVE)
|
|
||||||
if(COMPILER_SUPPORTS_MARCH_NATIVE)
|
|
||||||
add_compile_options("-march=native")
|
|
||||||
endif()
|
|
||||||
else()
|
|
||||||
CHECK_C_COMPILER_FLAG("-march=x86-64-v2" COMPILER_SUPPORTS_MARCH_X86_64_V2)
|
|
||||||
if(COMPILER_SUPPORTS_MARCH_X86_64_V2)
|
|
||||||
add_compile_options("-march=x86-64-v2")
|
|
||||||
else()
|
|
||||||
CHECK_C_COMPILER_FLAG("-march=nehalem" COMPILER_SUPPORTS_MARCH_NEHALEM)
|
|
||||||
if(COMPILER_SUPPORTS_MARCH_NEHALEM)
|
|
||||||
add_compile_options("-march=nehalem")
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
option(ENABLE_BACKTRACE "Enable backtrace support on crash" ON)
|
option(ENABLE_BACKTRACE "Enable backtrace support on crash" ON)
|
||||||
add_feature_info(ENABLE_BACKTRACE ENABLE_BACKTRACE "Backtrace support.")
|
add_feature_info(ENABLE_BACKTRACE ENABLE_BACKTRACE "Backtrace support.")
|
||||||
@ -42,8 +27,6 @@ add_compile_options(
|
|||||||
)
|
)
|
||||||
set(CMAKE_C_STANDARD 11)
|
set(CMAKE_C_STANDARD 11)
|
||||||
|
|
||||||
get_filename_component(PROJECT_TOP "${PROJECT_SOURCE_DIR}/.." ABSOLUTE)
|
|
||||||
|
|
||||||
add_custom_command(
|
add_custom_command(
|
||||||
OUTPUT ${CMAKE_BINARY_DIR}/version.c
|
OUTPUT ${CMAKE_BINARY_DIR}/version.c
|
||||||
${CMAKE_BINARY_DIR}/include/version.h
|
${CMAKE_BINARY_DIR}/include/version.h
|
||||||
|
@ -1,19 +1,14 @@
|
|||||||
cmake_minimum_required(VERSION 3.0)
|
cmake_minimum_required(VERSION 3.0)
|
||||||
project(looking-glass-obs C)
|
project(looking-glass-obs C)
|
||||||
|
|
||||||
set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake/")
|
get_filename_component(PROJECT_TOP "${PROJECT_SOURCE_DIR}/.." ABSOLUTE)
|
||||||
|
list(APPEND CMAKE_MODULE_PATH "${PROJECT_TOP}/cmake/" "${PROJECT_SOURCE_DIR}/cmake/")
|
||||||
|
|
||||||
include(GNUInstallDirs)
|
include(GNUInstallDirs)
|
||||||
include(CheckCCompilerFlag)
|
include(CheckCCompilerFlag)
|
||||||
include(FeatureSummary)
|
include(FeatureSummary)
|
||||||
|
|
||||||
option(OPTIMIZE_FOR_NATIVE "Build with -march=native" ON)
|
include(OptimizeForNative) # option(OPTIMIZE_FOR_NATIVE)
|
||||||
if(OPTIMIZE_FOR_NATIVE)
|
|
||||||
CHECK_C_COMPILER_FLAG("-march=native" COMPILER_SUPPORTS_MARCH_NATIVE)
|
|
||||||
if(COMPILER_SUPPORTS_MARCH_NATIVE)
|
|
||||||
add_compile_options("-march=native")
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
option(ENABLE_BACKTRACE "Enable backtrace support on crash" ON)
|
option(ENABLE_BACKTRACE "Enable backtrace support on crash" ON)
|
||||||
add_feature_info(ENABLE_BACKTRACE ENABLE_BACKTRACE "Backtrace support.")
|
add_feature_info(ENABLE_BACKTRACE ENABLE_BACKTRACE "Backtrace support.")
|
||||||
@ -50,7 +45,6 @@ else()
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_definitions(-D ATOMIC_LOCKING)
|
add_definitions(-D ATOMIC_LOCKING)
|
||||||
get_filename_component(PROJECT_TOP "${PROJECT_SOURCE_DIR}/.." ABSOLUTE)
|
|
||||||
|
|
||||||
add_custom_command(
|
add_custom_command(
|
||||||
OUTPUT ${CMAKE_BINARY_DIR}/version.c
|
OUTPUT ${CMAKE_BINARY_DIR}/version.c
|
||||||
|
@ -1,19 +1,14 @@
|
|||||||
cmake_minimum_required(VERSION 3.0)
|
cmake_minimum_required(VERSION 3.0)
|
||||||
project(profiler-client C)
|
project(profiler-client C)
|
||||||
|
|
||||||
set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake/")
|
get_filename_component(PROJECT_TOP "${PROJECT_SOURCE_DIR}/../.." ABSOLUTE)
|
||||||
|
list(APPEND CMAKE_MODULE_PATH "${PROJECT_TOP}/cmake/" "${PROJECT_SOURCE_DIR}/cmake/")
|
||||||
|
|
||||||
include(GNUInstallDirs)
|
include(GNUInstallDirs)
|
||||||
include(CheckCCompilerFlag)
|
include(CheckCCompilerFlag)
|
||||||
include(FeatureSummary)
|
include(FeatureSummary)
|
||||||
|
|
||||||
option(OPTIMIZE_FOR_NATIVE "Build with -march=native" ON)
|
include(OptimizeForNative) # option(OPTIMIZE_FOR_NATIVE)
|
||||||
if(OPTIMIZE_FOR_NATIVE)
|
|
||||||
CHECK_C_COMPILER_FLAG("-march=native" COMPILER_SUPPORTS_MARCH_NATIVE)
|
|
||||||
if(COMPILER_SUPPORTS_MARCH_NATIVE)
|
|
||||||
add_compile_options("-march=native")
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
add_compile_options(
|
add_compile_options(
|
||||||
"-Wall"
|
"-Wall"
|
||||||
@ -36,7 +31,6 @@ execute_process(
|
|||||||
)
|
)
|
||||||
|
|
||||||
add_definitions(-D BUILD_VERSION='"${BUILD_VERSION}"')
|
add_definitions(-D BUILD_VERSION='"${BUILD_VERSION}"')
|
||||||
get_filename_component(PROJECT_TOP "${PROJECT_SOURCE_DIR}/../.." ABSOLUTE)
|
|
||||||
|
|
||||||
include_directories(
|
include_directories(
|
||||||
${PROJECT_SOURCE_DIR}/include
|
${PROJECT_SOURCE_DIR}/include
|
||||||
|
Loading…
Reference in New Issue
Block a user