1
0
mirror of synced 2024-11-28 01:20:51 +01:00

build: Add checked option to enable LTO

This commit is contained in:
WerWolv 2023-07-09 20:34:49 +02:00
parent ce9ce42c1c
commit 65d9509c38
3 changed files with 15 additions and 3 deletions

View File

@ -291,7 +291,7 @@ jobs:
-DIMHEX_COMMIT_HASH_SHORT="${{env.COMMIT_SHA_SHORT}}" \
-DIMHEX_COMMIT_HASH_LONG="${{env.COMMIT_SHA_LONG}}" \
-DIMHEX_COMMIT_BRANCH="${{env.COMMIT_BRANCH}}" \
-DCMAKE_INTERPROCEDURAL_OPTIMIZATION=ON \
-DIMHEX_ENABLE_LTO=ON \
..
make -j 4 install DESTDIR=DebDir
@ -364,7 +364,7 @@ jobs:
-DIMHEX_COMMIT_HASH_SHORT="${GITHUB_SHA::7}" \
-DIMHEX_COMMIT_HASH_LONG="${GITHUB_SHA}" \
-DIMHEX_COMMIT_BRANCH="${GITHUB_REF##*/}" \
-DCMAKE_INTERPROCEDURAL_OPTIMIZATION=ON \
-DIMHEX_ENABLE_LTO=ON \
-DIMHEX_PLUGINS_IN_SHARE=ON \
-DIMHEX_USE_BUNDLED_CA=ON \
..
@ -447,7 +447,7 @@ jobs:
-DIMHEX_COMMIT_HASH_SHORT="${GITHUB_SHA::7}" \
-DIMHEX_COMMIT_HASH_LONG="${GITHUB_SHA}" \
-DIMHEX_COMMIT_BRANCH="${GITHUB_REF##*/}" \
-DCMAKE_INTERPROCEDURAL_OPTIMIZATION=ON \
-DIMHEX_ENABLE_LTO=ON \
..
make -j 4 install DESTDIR=installDir

View File

@ -10,6 +10,7 @@ option(IMHEX_PATTERNS_PULL_MASTER "Download latest files from master branch of t
option(IMHEX_IGNORE_BAD_COMPILER "Allow compiling with an unsupported compiler" OFF)
option(IMHEX_USE_GTK_FILE_PICKER "Use GTK file picker instead of xdg-desktop-portals" OFF)
option(IMHEX_DISABLE_STACKTRACE "Disables support for printing stack traces" OFF)
option(IMHEX_ENABLE_LTO "Enables Link Time Optimizations if possible" OFF)
# Basic compiler and cmake configurations
set(CMAKE_CXX_STANDARD 23)

View File

@ -284,6 +284,17 @@ function(JOIN OUTPUT GLUE)
endfunction()
macro(configureCMake)
# Enable LTO if desired and supported
if (IMHEX_ENABLE_LTO)
include(CheckIPOSupported)
check_ipo_supported(RESULT result)
if (result)
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE)
else ()
message(WARNING "LTO is not supported!")
endif ()
endif ()
endmacro()
function(message ${ARGN})