Add some compiler flags conditionally to improve performance

nometajit
Dibyendu Majumdar 4 years ago
parent be6e3bc543
commit ced70c2d60

@ -103,6 +103,21 @@ if (COMPUTED_GOTO AND NOT MSVC)
endif ()
endif ()
include(CheckCCompilerFlag)
check_c_compiler_flag("-march=native" COMPILER_OPT_ARCH_NATIVE_SUPPORTED)
if (COMPILER_OPT_ARCH_NATIVE_SUPPORTED AND NOT CMAKE_C_FLAGS MATCHES "-march=")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -march=native")
endif()
check_c_compiler_flag("-fno-common" COMPILER_OPT_NO_COMMON_SUPPORTED)
if (COMPILER_OPT_NO_COMMON_SUPPORTED AND NOT CMAKE_C_FLAGS MATCHES "-fno-common")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fno-common")
endif()
check_c_compiler_flag("-fno-stack-protector" COMPILER_OPT_NO_STACK_PROTECTOR_SUPPORTED)
if (COMPILER_OPT_NO_STACK_PROTECTOR_SUPPORTED AND NOT CMAKE_C_FLAGS MATCHES "-fno-stack-protector")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fno-stack-protector")
endif()
set(EMBEDDED_DMRC ON)
if (LLVM_JIT)
find_package(LLVM REQUIRED CONFIG)

Loading…
Cancel
Save