mirror of
https://github.com/gnif/LookingGlass.git
synced 2024-11-10 00:28:20 +00:00
[all] cmake: fix OptimizeForNative
1. Correctly detect ON state so that host is not built as -march=native by default. 2. Merge OFF and GENERIC options as we need at least -march=nehalem to build properly.
This commit is contained in:
parent
2c745db544
commit
f4daa9f527
@ -1,14 +1,14 @@
|
|||||||
set(OPTIMIZE_FOR_NATIVE AUTO CACHE STRING "Build with -march=native")
|
set(OPTIMIZE_FOR_NATIVE AUTO CACHE STRING "Build with -march=native")
|
||||||
set_property(CACHE OPTIMIZE_FOR_NATIVE PROPERTY STRINGS AUTO ON OFF GENERIC)
|
set_property(CACHE OPTIMIZE_FOR_NATIVE PROPERTY STRINGS AUTO ON OFF)
|
||||||
|
|
||||||
set(OPTIMIZE_FOR_NATIVE_ARCH "none")
|
set(OPTIMIZE_FOR_NATIVE_ARCH "none")
|
||||||
if(OPTIMIZE_FOR_NATIVE OR (OPTIMIZE_FOR_NATIVE STREQUAL "AUTO" AND OPTIMIZE_FOR_NATIVE_DEFAULT))
|
if(OPTIMIZE_FOR_NATIVE STREQUAL "ON" OR (OPTIMIZE_FOR_NATIVE STREQUAL "AUTO" AND OPTIMIZE_FOR_NATIVE_DEFAULT))
|
||||||
CHECK_C_COMPILER_FLAG("-march=native" COMPILER_SUPPORTS_MARCH_NATIVE)
|
CHECK_C_COMPILER_FLAG("-march=native" COMPILER_SUPPORTS_MARCH_NATIVE)
|
||||||
if(COMPILER_SUPPORTS_MARCH_NATIVE)
|
if(COMPILER_SUPPORTS_MARCH_NATIVE)
|
||||||
set(OPTIMIZE_FOR_NATIVE_ARCH "native")
|
set(OPTIMIZE_FOR_NATIVE_ARCH "native")
|
||||||
set(OPTIMIZE_FOR_NATIVE_ON ON)
|
set(OPTIMIZE_FOR_NATIVE_ON ON)
|
||||||
endif()
|
endif()
|
||||||
elseif(OPTIMIZE_FOR_NATIVE STREQUAL "AUTO" OR OPTIMIZE_FOR_NATIVE STREQUAL "GENERIC")
|
elseif(OPTIMIZE_FOR_NATIVE STREQUAL "AUTO" OR OPTIMIZE_FOR_NATIVE STREQUAL "OFF")
|
||||||
CHECK_C_COMPILER_FLAG("-march=x86-64-v2" COMPILER_SUPPORTS_MARCH_X86_64_V2)
|
CHECK_C_COMPILER_FLAG("-march=x86-64-v2" COMPILER_SUPPORTS_MARCH_X86_64_V2)
|
||||||
if(COMPILER_SUPPORTS_MARCH_X86_64_V2)
|
if(COMPILER_SUPPORTS_MARCH_X86_64_V2)
|
||||||
set(OPTIMIZE_FOR_NATIVE_ARCH "x86-64-v2")
|
set(OPTIMIZE_FOR_NATIVE_ARCH "x86-64-v2")
|
||||||
@ -18,7 +18,6 @@ elseif(OPTIMIZE_FOR_NATIVE STREQUAL "AUTO" OR OPTIMIZE_FOR_NATIVE STREQUAL "GENE
|
|||||||
set(OPTIMIZE_FOR_NATIVE_ARCH "nehalem")
|
set(OPTIMIZE_FOR_NATIVE_ARCH "nehalem")
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
elseif(NOT OPTIMIZE_FOR_NATIVE)
|
|
||||||
else()
|
else()
|
||||||
set(OPTIMIZE_FOR_NATIVE_ARCH "${OPTIMIZE_FOR_NATIVE}")
|
set(OPTIMIZE_FOR_NATIVE_ARCH "${OPTIMIZE_FOR_NATIVE}")
|
||||||
set(OPTIMIZE_FOR_NATIVE_ON ON)
|
set(OPTIMIZE_FOR_NATIVE_ON ON)
|
||||||
|
Loading…
Reference in New Issue
Block a user