File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -90,6 +90,7 @@ option(USE_DISCORD_PRESENCE "Enables Discord Rich Presence" OFF)
9090# Compile options
9191CMAKE_DEPENDENT_OPTION (COMPILE_WITH_DWARF "Add DWARF debugging information" ${IS_DEBUG_BUILD} "MINGW" OFF )
9292option (ENABLE_LTO "Enable link time optimization" ${DEFAULT_ENABLE_LTO} )
93+ option (ENABLE_NATIVE_OPTIMIZATION "Enables processor-specific optimizations via -march=native" OFF )
9394option (CITRA_USE_PRECOMPILED_HEADERS "Use precompiled headers" ON )
9495option (CITRA_WARNINGS_AS_ERRORS "Enable warnings as errors" ON )
9596
@@ -146,6 +147,22 @@ else()
146147 message (STATUS "LTO disabled" )
147148endif ()
148149
150+ # Check for march=native support
151+ # =======================================================================
152+ if (ENABLE_NATIVE_OPTIMIZATION)
153+ include (CheckCCompilerFlag )
154+ include (CheckCXXCompilerFlag )
155+ CHECK_C_COMPILER_FLAG ("-march=native" C_COMPILER_SUPPORTS_MARCH_NATIVE )
156+ CHECK_CXX_COMPILER_FLAG ("-march=native" CXX_COMPILER_SUPPORTS_MARCH_NATIVE )
157+
158+ if (C_COMPILER_SUPPORTS_MARCH_NATIVE)
159+ set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS } -march=native" )
160+ endif ()
161+ if (CXX_COMPILER_SUPPORTS_MARCH_NATIVE)
162+ set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS } -march=native" )
163+ endif ()
164+ endif ()
165+
149166# Sanity check : Check that all submodules are present
150167# =======================================================================
151168
You can’t perform that action at this time.
0 commit comments