From 890ecc27cb1f6fa62763cede74e2b4c0c5ea01b3 Mon Sep 17 00:00:00 2001 From: eddiz <16883778+eddiz@users.noreply.github.com> Date: Sun, 19 Nov 2017 22:31:21 +0100 Subject: [PATCH 1/3] Optional Compiler Optimization Enable all Compile Optimization by setting according compiler flags. (Visual Studio tested, gcc and other should work properly, but untested) --- CMakeLists.txt | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4e7e699..d25623c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -101,6 +101,17 @@ if (ENABLE_GOMA) set_compiler_launcher(ENABLE_GOMA gomacc) endif () +if(ENABLE_EXTRA_SPEED) + if(MSVC) + #enable parallel builds + add_compile_options("$<$:/Qpar>") + #maximum optimization in Release mode + add_compile_options("$<$,$>:/Ox>") + else() + add_compiler_flag_if_supported("-O3") + endif() +endif() + # Generate a version file containing repository info. include(FindGit) find_package(Git) From f4f5c81a5620c2c2abc861939fdb1c7222a2401e Mon Sep 17 00:00:00 2001 From: eddiz <16883778+eddiz@users.noreply.github.com> Date: Tue, 21 Nov 2017 14:22:01 +0100 Subject: [PATCH 2/3] Update CMakeLists.txt updated compiler setting for extra speed-up as a follow-up of the pull discussion --- CMakeLists.txt | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d25623c..d3bd3cd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -102,14 +102,14 @@ if (ENABLE_GOMA) endif () if(ENABLE_EXTRA_SPEED) - if(MSVC) - #enable parallel builds - add_compile_options("$<$:/Qpar>") - #maximum optimization in Release mode - add_compile_options("$<$,$>:/Ox>") - else() - add_compiler_flag_if_supported("-O3") - endif() + if(MSVC) + #maximum optimization in Release mode + add_compile_options("$<$:/Ox>") + #add_compile_options("$<$:/Ox>") #uncomment if consistent compiler settings are more important then binary size + #add_compile_options("$<$:/Ox>") #uncomment if consistent compiler settings are more important then binary size + else() + add_compiler_flag_if_supported("-O3") + endif() endif() # Generate a version file containing repository info. From b83f22b16b16f6546d97b45324bcd437882329a8 Mon Sep 17 00:00:00 2001 From: tomfinegan Date: Wed, 29 Nov 2017 08:58:49 -0800 Subject: [PATCH 3/3] Increase optimization level in release builds. When users pass turn on ENABLE_EXTRA_SPEED at CMake generation, use -O3 in gcc like compilers, and /Ox in MSVC. --- CMakeLists.txt | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d3bd3cd..d002e4e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -103,10 +103,8 @@ endif () if(ENABLE_EXTRA_SPEED) if(MSVC) - #maximum optimization in Release mode + # Maximum optimization in Release mode. add_compile_options("$<$:/Ox>") - #add_compile_options("$<$:/Ox>") #uncomment if consistent compiler settings are more important then binary size - #add_compile_options("$<$:/Ox>") #uncomment if consistent compiler settings are more important then binary size else() add_compiler_flag_if_supported("-O3") endif()