mirror of
https://github.com/azahar-emu/azahar
synced 2025-11-06 15:09:58 +01:00
cmake: Add option ENABLE_NATIVE_OPTIMIZATION
This commit is contained in:
parent
56e96dea6c
commit
c024933ec3
@ -90,6 +90,7 @@ option(USE_DISCORD_PRESENCE "Enables Discord Rich Presence" OFF)
|
||||
# Compile options
|
||||
CMAKE_DEPENDENT_OPTION(COMPILE_WITH_DWARF "Add DWARF debugging information" ${IS_DEBUG_BUILD} "MINGW" OFF)
|
||||
option(ENABLE_LTO "Enable link time optimization" ${DEFAULT_ENABLE_LTO})
|
||||
option(ENABLE_NATIVE_OPTIMIZATION "Enables processor-specific optimizations via -march=native" OFF)
|
||||
option(CITRA_USE_PRECOMPILED_HEADERS "Use precompiled headers" ON)
|
||||
option(CITRA_WARNINGS_AS_ERRORS "Enable warnings as errors" ON)
|
||||
|
||||
@ -146,6 +147,22 @@ else()
|
||||
message(STATUS "LTO disabled")
|
||||
endif()
|
||||
|
||||
# Check for march=native support
|
||||
# =======================================================================
|
||||
if (ENABLE_NATIVE_OPTIMIZATION)
|
||||
include(CheckCCompilerFlag)
|
||||
include(CheckCXXCompilerFlag)
|
||||
CHECK_C_COMPILER_FLAG("-march=native" C_COMPILER_SUPPORTS_MARCH_NATIVE)
|
||||
CHECK_CXX_COMPILER_FLAG("-march=native" CXX_COMPILER_SUPPORTS_MARCH_NATIVE)
|
||||
|
||||
if (C_COMPILER_SUPPORTS_MARCH_NATIVE)
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -march=native")
|
||||
endif()
|
||||
if (CXX_COMPILER_SUPPORTS_MARCH_NATIVE)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=native")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Sanity check : Check that all submodules are present
|
||||
# =======================================================================
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user