Skip to content

Commit

Permalink
Enable Link-Time-Code-Generation for Release builds (shader-slang#5678)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
jkwak-work authored Nov 26, 2024
1 parent e6cf93e commit cf0e3a6
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions cmake/SlangTarget.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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
#
Expand Down

0 comments on commit cf0e3a6

Please sign in to comment.