From cf0e3a636d500267bce212c61549db1367aff8c1 Mon Sep 17 00:00:00 2001 From: Jay Kwak <82421531+jkwak-work@users.noreply.github.com> Date: Mon, 25 Nov 2024 22:05:57 -0800 Subject: [PATCH] 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. --- cmake/SlangTarget.cmake | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/cmake/SlangTarget.cmake b/cmake/SlangTarget.cmake index 4a3b757046..89143dd2de 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 #