Fix compilation in release using Apple's clang.

This commit is contained in:
2021-10-13 05:16:20 +01:00
parent 8e2a9364a7
commit 02801c919a

View File

@@ -34,6 +34,7 @@ message("Detected system processor: ${CMAKE_SYSTEM_PROCESSOR}")
message("Detected vs platform name: ${CMAKE_C_COMPILER_ARCHITECTURE_ID}") message("Detected vs platform name: ${CMAKE_C_COMPILER_ARCHITECTURE_ID}")
message("Detected compiler: ${CMAKE_C_COMPILER_ID}") message("Detected compiler: ${CMAKE_C_COMPILER_ID}")
message("Detected build type: ${CMAKE_BUILD_TYPE}") message("Detected build type: ${CMAKE_BUILD_TYPE}")
message("Detected platform: ${CMAKE_C_PLATFORM_ID}")
if("${CMAKE_BUILD_TYPE}" MATCHES "Release") if("${CMAKE_BUILD_TYPE}" MATCHES "Release")
if("${CMAKE_C_COMPILER_ID}" MATCHES "MSVC") if("${CMAKE_C_COMPILER_ID}" MATCHES "MSVC")
@@ -45,11 +46,27 @@ if("${CMAKE_BUILD_TYPE}" MATCHES "Release")
add_compile_options(-ffast-math -O3) add_compile_options(-ffast-math -O3)
if(${CMAKE_SYSTEM_PROCESSOR} MATCHES "x86_64" OR ${CMAKE_SYSTEM_PROCESSOR} MATCHES "i686" OR ${CMAKE_SYSTEM_PROCESSOR} MATCHES "AMD64") if(${CMAKE_SYSTEM_PROCESSOR} MATCHES "x86_64" OR ${CMAKE_SYSTEM_PROCESSOR} MATCHES "i686" OR ${CMAKE_SYSTEM_PROCESSOR} MATCHES "AMD64")
add_compile_options(-march=core2 -mfpmath=sse -msse3 -mtune=westmere -flto) if(NOT "${CMAKE_C_COMPILER_ID}" MATCHES "AppleClang")
add_compile_options(-march=core2 -mtune=westmere -mfpmath=sse)
endif()
add_compile_options(-msse3)
if(NOT "${CMAKE_C_PLATFORM_ID}" MATCHES "MinGW")
add_compile_options(-flto)
endif()
elseif(${CMAKE_SYSTEM_PROCESSOR} MATCHES "aarch64") elseif(${CMAKE_SYSTEM_PROCESSOR} MATCHES "aarch64")
add_compile_options(-march=armv8-a -flto) if(NOT "${CMAKE_C_COMPILER_ID}" MATCHES "AppleClang")
add_compile_options(-march=armv8-a)
endif()
if(NOT "${CMAKE_C_PLATFORM_ID}" NOT MATCHES "MinGW")
add_compile_options(-flto)
endif()
elseif(${CMAKE_SYSTEM_PROCESSOR} MATCHES "armv7l") elseif(${CMAKE_SYSTEM_PROCESSOR} MATCHES "armv7l")
add_compile_options(-march=armv7) if(NOT "${CMAKE_C_COMPILER_ID}" MATCHES "AppleClang")
add_compile_options(-march=armv7)
endif()
endif() endif()
endif() endif()
endif() endif()