From af89b62194de51daca109f32d783633a0b563bc0 Mon Sep 17 00:00:00 2001 From: scribam Date: Sun, 18 Mar 2018 08:59:46 +0100 Subject: [PATCH] Check if the compiler supports "-march=native" --- rpcs3/CMakeLists.txt | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/rpcs3/CMakeLists.txt b/rpcs3/CMakeLists.txt index 65699a58cc..0b480859b4 100644 --- a/rpcs3/CMakeLists.txt +++ b/rpcs3/CMakeLists.txt @@ -90,6 +90,13 @@ else() add_definitions(-DGLX_GLXEXT_PROTOTYPES) endif() +if(USE_NATIVE_INSTRUCTIONS) + CHECK_CXX_COMPILER_FLAG("-march=native" COMPILER_SUPPORTS_MARCH_NATIVE) + if(COMPILER_SUPPORTS_MARCH_NATIVE) + add_compile_options(-march=native) + endif() +endif() + if(NOT MSVC) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fexceptions") # This hides our LLVM from mesa's LLVM, otherwise we get some unresolvable conflicts. @@ -108,10 +115,6 @@ if(NOT MSVC) add_compile_options(-msse -msse2 -mcx16 -mrtm) - if(USE_NATIVE_INSTRUCTIONS) - add_compile_options(-march=native) - endif() - if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") # This fixes 'some' of the st11range issues. See issue #2516 if(APPLE)