From 57e44acdc18cc3b23b3bd9ef7218848bfc1d6166 Mon Sep 17 00:00:00 2001 From: MichalPetryka <35800402+MichalPetryka@users.noreply.github.com> Date: Fri, 2 Apr 2021 18:57:27 +0200 Subject: [PATCH 1/6] Enable LTO in GCC --- CMakeLists.txt | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8ec23c0b..1a8b7a2b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -56,10 +56,17 @@ if (MSVC) SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /arch:SSE2") endif () SET(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /LTCG") + SET(CMAKE_MODULE_LINKER_FLAGS_RELEASE "${CMAKE_MODULE_LINKER_FLAGS_RELEASE} /LTCG") + SET(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} /LTCG") + SET(CMAKE_STATIC_LINKER_FLAGS_RELEASE "${CMAKE_STATIC_LINKER_FLAGS_RELEASE} /LTCG") else () message("Enabling non-MSVC optimizations") - SET(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -O2 -mfpmath=sse -mmmx -msse -msse2") - SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O2 -mfpmath=sse -mmmx -msse -msse2") + SET(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -flto -O2 -mfpmath=sse -mmmx -msse -msse2") + SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -flto -O2 -mfpmath=sse -mmmx -msse -msse2") + SET(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} ${CMAKE_C_FLAGS_RELEASE} ${CMAKE_CXX_FLAGS_RELEASE}") + SET(CMAKE_MODULE_LINKER_FLAGS_RELEASE "${CMAKE_MODULE_LINKER_FLAGS_RELEASE} ${CMAKE_C_FLAGS_RELEASE} ${CMAKE_CXX_FLAGS_RELEASE}") + SET(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} ${CMAKE_C_FLAGS_RELEASE} ${CMAKE_CXX_FLAGS_RELEASE}") + SET(CMAKE_STATIC_LINKER_FLAGS_RELEASE "${CMAKE_STATIC_LINKER_FLAGS_RELEASE} ${CMAKE_C_FLAGS_RELEASE} ${CMAKE_CXX_FLAGS_RELEASE}") endif () project(Poltergeist) From 523528bf53552fc140ce5e11d2fc8933f2dd0f85 Mon Sep 17 00:00:00 2001 From: MichalPetryka <35800402+MichalPetryka@users.noreply.github.com> Date: Fri, 2 Apr 2021 19:05:25 +0200 Subject: [PATCH 2/6] Update CMakeLists.txt --- CMakeLists.txt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1a8b7a2b..0fd6aa08 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -63,10 +63,10 @@ else () message("Enabling non-MSVC optimizations") SET(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -flto -O2 -mfpmath=sse -mmmx -msse -msse2") SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -flto -O2 -mfpmath=sse -mmmx -msse -msse2") - SET(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} ${CMAKE_C_FLAGS_RELEASE} ${CMAKE_CXX_FLAGS_RELEASE}") - SET(CMAKE_MODULE_LINKER_FLAGS_RELEASE "${CMAKE_MODULE_LINKER_FLAGS_RELEASE} ${CMAKE_C_FLAGS_RELEASE} ${CMAKE_CXX_FLAGS_RELEASE}") - SET(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} ${CMAKE_C_FLAGS_RELEASE} ${CMAKE_CXX_FLAGS_RELEASE}") - SET(CMAKE_STATIC_LINKER_FLAGS_RELEASE "${CMAKE_STATIC_LINKER_FLAGS_RELEASE} ${CMAKE_C_FLAGS_RELEASE} ${CMAKE_CXX_FLAGS_RELEASE}") + SET(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} -flto -O2 -mfpmath=sse -mmmx -msse -msse2") + SET(CMAKE_MODULE_LINKER_FLAGS_RELEASE "${CMAKE_MODULE_LINKER_FLAGS_RELEASE} -flto -O2 -mfpmath=sse -mmmx -msse -msse2") + SET(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} -flto -O2 -mfpmath=sse -mmmx -msse -msse2") + SET(CMAKE_STATIC_LINKER_FLAGS_RELEASE "${CMAKE_STATIC_LINKER_FLAGS_RELEASE} -flto -O2 -mfpmath=sse -mmmx -msse -msse2") endif () project(Poltergeist) From 8e53f70bf2d769054113d98d96359f159c83aac0 Mon Sep 17 00:00:00 2001 From: MichalPetryka <35800402+MichalPetryka@users.noreply.github.com> Date: Fri, 2 Apr 2021 19:13:28 +0200 Subject: [PATCH 3/6] Update CMakeLists.txt --- CMakeLists.txt | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0fd6aa08..d35914aa 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -22,6 +22,11 @@ endif () enable_language(C) enable_language(CXX) +include(CheckIPOSupported) +check_ipo_supported() + +set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE) + # Warning settings if (MSVC) message("Enabling MSVC warnings") @@ -61,12 +66,8 @@ if (MSVC) SET(CMAKE_STATIC_LINKER_FLAGS_RELEASE "${CMAKE_STATIC_LINKER_FLAGS_RELEASE} /LTCG") else () message("Enabling non-MSVC optimizations") - SET(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -flto -O2 -mfpmath=sse -mmmx -msse -msse2") - SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -flto -O2 -mfpmath=sse -mmmx -msse -msse2") - SET(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} -flto -O2 -mfpmath=sse -mmmx -msse -msse2") - SET(CMAKE_MODULE_LINKER_FLAGS_RELEASE "${CMAKE_MODULE_LINKER_FLAGS_RELEASE} -flto -O2 -mfpmath=sse -mmmx -msse -msse2") - SET(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} -flto -O2 -mfpmath=sse -mmmx -msse -msse2") - SET(CMAKE_STATIC_LINKER_FLAGS_RELEASE "${CMAKE_STATIC_LINKER_FLAGS_RELEASE} -flto -O2 -mfpmath=sse -mmmx -msse -msse2") + SET(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -O2 -mfpmath=sse -mmmx -msse -msse2") + SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O2 -mfpmath=sse -mmmx -msse -msse2") endif () project(Poltergeist) From 9f0e91b6c069f507a84f616d49c65115bd62293a Mon Sep 17 00:00:00 2001 From: petris Date: Mon, 5 Apr 2021 17:04:19 +0200 Subject: [PATCH 4/6] Revert "Update CMakeLists.txt" This reverts commit 8e53f70bf2d769054113d98d96359f159c83aac0. --- CMakeLists.txt | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d35914aa..0fd6aa08 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -22,11 +22,6 @@ endif () enable_language(C) enable_language(CXX) -include(CheckIPOSupported) -check_ipo_supported() - -set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE) - # Warning settings if (MSVC) message("Enabling MSVC warnings") @@ -66,8 +61,12 @@ if (MSVC) SET(CMAKE_STATIC_LINKER_FLAGS_RELEASE "${CMAKE_STATIC_LINKER_FLAGS_RELEASE} /LTCG") else () message("Enabling non-MSVC optimizations") - SET(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -O2 -mfpmath=sse -mmmx -msse -msse2") - SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O2 -mfpmath=sse -mmmx -msse -msse2") + SET(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -flto -O2 -mfpmath=sse -mmmx -msse -msse2") + SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -flto -O2 -mfpmath=sse -mmmx -msse -msse2") + SET(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} -flto -O2 -mfpmath=sse -mmmx -msse -msse2") + SET(CMAKE_MODULE_LINKER_FLAGS_RELEASE "${CMAKE_MODULE_LINKER_FLAGS_RELEASE} -flto -O2 -mfpmath=sse -mmmx -msse -msse2") + SET(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} -flto -O2 -mfpmath=sse -mmmx -msse -msse2") + SET(CMAKE_STATIC_LINKER_FLAGS_RELEASE "${CMAKE_STATIC_LINKER_FLAGS_RELEASE} -flto -O2 -mfpmath=sse -mmmx -msse -msse2") endif () project(Poltergeist) From d0e74495a69ab0568a5d751ea67bd4f182113c3a Mon Sep 17 00:00:00 2001 From: MichalPetryka <35800402+MichalPetryka@users.noreply.github.com> Date: Mon, 5 Apr 2021 17:05:41 +0200 Subject: [PATCH 5/6] Update CMakeLists.txt --- CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0fd6aa08..b0c5c200 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -67,6 +67,7 @@ else () SET(CMAKE_MODULE_LINKER_FLAGS_RELEASE "${CMAKE_MODULE_LINKER_FLAGS_RELEASE} -flto -O2 -mfpmath=sse -mmmx -msse -msse2") SET(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} -flto -O2 -mfpmath=sse -mmmx -msse -msse2") SET(CMAKE_STATIC_LINKER_FLAGS_RELEASE "${CMAKE_STATIC_LINKER_FLAGS_RELEASE} -flto -O2 -mfpmath=sse -mmmx -msse -msse2") + message("${CMAKE_C_FLAGS_RELEASE} ---- ${CMAKE_CXX_FLAGS_RELEASE} ---- ${CMAKE_EXE_LINKER_FLAGS_RELEASE} ---- ${CMAKE_MODULE_LINKER_FLAGS_RELEASE} ---- ${CMAKE_SHARED_LINKER_FLAGS_RELEASE} ---- ${CMAKE_STATIC_LINKER_FLAGS_RELEASE}") endif () project(Poltergeist) From f9254504b61b442b73af38dd1e16f212de4f9516 Mon Sep 17 00:00:00 2001 From: MichalPetryka <35800402+MichalPetryka@users.noreply.github.com> Date: Mon, 5 Apr 2021 17:15:49 +0200 Subject: [PATCH 6/6] Update CMakeLists.txt --- CMakeLists.txt | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b0c5c200..da558f9f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -61,12 +61,12 @@ if (MSVC) SET(CMAKE_STATIC_LINKER_FLAGS_RELEASE "${CMAKE_STATIC_LINKER_FLAGS_RELEASE} /LTCG") else () message("Enabling non-MSVC optimizations") - SET(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -flto -O2 -mfpmath=sse -mmmx -msse -msse2") - SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -flto -O2 -mfpmath=sse -mmmx -msse -msse2") - SET(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} -flto -O2 -mfpmath=sse -mmmx -msse -msse2") - SET(CMAKE_MODULE_LINKER_FLAGS_RELEASE "${CMAKE_MODULE_LINKER_FLAGS_RELEASE} -flto -O2 -mfpmath=sse -mmmx -msse -msse2") - SET(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} -flto -O2 -mfpmath=sse -mmmx -msse -msse2") - SET(CMAKE_STATIC_LINKER_FLAGS_RELEASE "${CMAKE_STATIC_LINKER_FLAGS_RELEASE} -flto -O2 -mfpmath=sse -mmmx -msse -msse2") + SET(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -flto -mfpmath=sse -mmmx -msse -msse2") + SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -flto -mfpmath=sse -mmmx -msse -msse2") + SET(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} ${CMAKE_CXX_FLAGS_RELEASE}") + SET(CMAKE_MODULE_LINKER_FLAGS_RELEASE "${CMAKE_MODULE_LINKER_FLAGS_RELEASE} ${CMAKE_CXX_FLAGS_RELEASE}") + SET(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} ${CMAKE_CXX_FLAGS_RELEASE}") + SET(CMAKE_STATIC_LINKER_FLAGS_RELEASE "${CMAKE_STATIC_LINKER_FLAGS_RELEASE} ${CMAKE_CXX_FLAGS_RELEASE}") message("${CMAKE_C_FLAGS_RELEASE} ---- ${CMAKE_CXX_FLAGS_RELEASE} ---- ${CMAKE_EXE_LINKER_FLAGS_RELEASE} ---- ${CMAKE_MODULE_LINKER_FLAGS_RELEASE} ---- ${CMAKE_SHARED_LINKER_FLAGS_RELEASE} ---- ${CMAKE_STATIC_LINKER_FLAGS_RELEASE}") endif ()