diff --git a/CMakeLists.txt b/CMakeLists.txt index 4f6ce4bb4..87b7c311d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -485,12 +485,20 @@ endif() set(FEX_TUNE_COMPILE_FLAGS) if (NOT TUNE_ARCH STREQUAL "generic") - check_cxx_compiler_flag("-march=${TUNE_ARCH}" COMPILER_SUPPORTS_ARCH_TYPE) - if(COMPILER_SUPPORTS_ARCH_TYPE) - list(APPEND FEX_TUNE_COMPILE_FLAGS "-march=${TUNE_ARCH}") - else() - message(FATAL_ERROR "Trying to compile arch type '${TUNE_ARCH}' but the compiler doesn't support this") + set(TUNE_ARCH_STRING "${TUNE_ARCH}") + if(ARCHITECTURE_arm64) + set(TUNE_ARCH_STRING "${TUNE_ARCH}+crc") endif() + check_cxx_compiler_flag("-march=${TUNE_ARCH_STRING}" COMPILER_SUPPORTS_ARCH_TYPE) + if(COMPILER_SUPPORTS_ARCH_TYPE) + list(APPEND FEX_TUNE_COMPILE_FLAGS "-march=${TUNE_ARCH_STRING}") + else() + message(FATAL_ERROR "Trying to compile arch type '${TUNE_ARCH_STRING}' but the compiler doesn't support this") + endif() +elseif(ARCHITECTURE_arm64) + # Need to always append crc + check_cxx_compiler_flag("-march=armv8-a+crc" COMPILER_SUPPORTS_ARCH_TYPE) + list(APPEND FEX_TUNE_COMPILE_FLAGS "-march=armv8-a+crc") endif() if (TUNE_CPU STREQUAL "native")