portability: platform compiler flags

-mcx16 and -march=native are platform specific.  Leave them out if we
aren't targeting chips that need it.
This commit is contained in:
Nathaniel Filardo 2019-04-23 13:42:10 +01:00
Родитель ad96ba05c1
Коммит 9cdac05e4d
1 изменённых файлов: 13 добавлений и 2 удалений

Просмотреть файл

@ -72,7 +72,12 @@ if(NOT MSVC)
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
target_link_libraries(snmalloc_lib INTERFACE atomic)
endif()
target_compile_options(snmalloc_lib INTERFACE -mcx16)
if(${CMAKE_SYSTEM_PROCESSOR} STREQUAL "x86_64")
target_compile_options(snmalloc_lib INTERFACE -mcx16)
elseif(${CMAKE_SYSTEM_PROCESSOR} STREQUAL "x86")
target_compile_options(snmalloc_lib INTERFACE -mcx16)
# XXX elseif ARM?
endif()
else()
set(WIN8COMPAT FALSE CACHE BOOL "Avoid Windows 10 APIs")
if (WIN8COMPAT)
@ -115,7 +120,13 @@ if(NOT DEFINED SNMALLOC_ONLY_HEADER_LIBRARY)
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Zi")
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /DEBUG")
else()
add_compile_options(-march=native -fno-exceptions -fno-rtti -g -ftls-model=initial-exec -fomit-frame-pointer)
add_compile_options(-fno-exceptions -fno-rtti -g -ftls-model=initial-exec -fomit-frame-pointer)
if(${CMAKE_SYSTEM_PROCESSOR} STREQUAL "x86_64")
add_compile_options(-march=native)
elseif(${CMAKE_SYSTEM_PROCESSOR} STREQUAL "x86")
add_compile_options(-march=native)
# XXX elseif ARM?
endif()
endif()
macro(subdirlist result curdir)