build: Add checked option to enable LTO
This commit is contained in:
parent
ce9ce42c1c
commit
65d9509c38
6
.github/workflows/build.yml
vendored
6
.github/workflows/build.yml
vendored
@ -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
|
||||
|
||||
|
@ -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)
|
||||
|
@ -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})
|
||||
|
Loading…
Reference in New Issue
Block a user