summaryrefslogtreecommitdiffstats
path: root/cmake
diff options
context:
space:
mode:
authorJay Kwak <82421531+jkwak-work@users.noreply.github.com>2024-11-25 22:05:57 -0800
committerGitHub <noreply@github.com>2024-11-26 06:05:57 +0000
commitcf0e3a636d500267bce212c61549db1367aff8c1 (patch)
tree76f1d65fae9d595b290508a1018afc9554f1f08e /cmake
parente6cf93e3e638cb981a9be392a2f48ea06acd4e3f (diff)
Enable Link-Time-Code-Generation for Release builds (#5678)
This commit enables Link Time Code Generation, or LTCG for short, for the release builds. Because "incremental" build is enabled, this ends up using "/LTCG:incremental" rather than the full "/LTCG". It is still expected to more performant than without any "/LTCG" at all. In order to use the full LTCG, we will need to give up the incremental build option for the Release build. We will need to decide if we wants to do it later.
Diffstat (limited to 'cmake')
-rw-r--r--cmake/SlangTarget.cmake7
1 files changed, 7 insertions, 0 deletions
diff --git a/cmake/SlangTarget.cmake b/cmake/SlangTarget.cmake
index 4a3b75704..89143dd2d 100644
--- a/cmake/SlangTarget.cmake
+++ b/cmake/SlangTarget.cmake
@@ -156,6 +156,13 @@ function(slang_add_target dir type)
return()
endif()
+ # Enable link-time optimization for release builds
+ # See: https://cmake.org/cmake/help/latest/prop_tgt/INTERPROCEDURAL_OPTIMIZATION.html
+ set_target_properties(
+ ${target}
+ PROPERTIES INTERPROCEDURAL_OPTIMIZATION_RELEASE TRUE
+ )
+
#
# Set the output directory
#