Commit edae8f27 by FritzFlorian

Add 'native architecture' optimization flag.

parent 4e135d7e
...@@ -4,22 +4,22 @@ ...@@ -4,22 +4,22 @@
################################################################################# #################################################################################
# make sure a build type is set, default to release # make sure a build type is set, default to release
if(NOT CMAKE_BUILD_TYPE) if (NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release) set(CMAKE_BUILD_TYPE Release)
endif() endif ()
message("-- Using Build Type: " ${CMAKE_BUILD_TYPE}) message("-- Using Build Type: " ${CMAKE_BUILD_TYPE})
# Enable optimizations in release builds # Enable optimizations in release builds
if(CMAKE_BUILD_TYPE STREQUAL "Release") if (CMAKE_BUILD_TYPE STREQUAL "Release")
# Link time optimization # Link time optimization
set(CMAKE_CXX_FLAGS "-Wall -Wextra") set(CMAKE_CXX_FLAGS "-Wall -Wextra")
# -O2 is often seen as 'the most speed', # -O2 is often seen as 'the most speed',
# but inlining functions and SIMD/Vectorization is # but inlining functions and SIMD/Vectorization is
# only enabled by -O3, thus it's way faster in some # only enabled by -O3, thus it's way faster in some
# array calculations. # array calculations.
set(CMAKE_CXX_FLAGS_RELEASE "-O3") set(CMAKE_CXX_FLAGS_RELEASE "-O3 -march=native")
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE) set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE)
else() else ()
set(CMAKE_CXX_FLAGS_DEBUG "-g -O0") set(CMAKE_CXX_FLAGS_DEBUG "-g -O0")
endif() endif ()
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment