From 6c655ca927a440d1f03339295235fce2a764c26b Mon Sep 17 00:00:00 2001 From: Ellie Hermaszewska Date: Tue, 3 Dec 2024 23:13:52 +0800 Subject: Install PDB files when available (#5665) * Install PDB files when available Closes https://github.com/shader-slang/slang/issues/5562 * format code * format code --------- Co-authored-by: Jay Kwak <82421531+jkwak-work@users.noreply.github.com> Co-authored-by: slangbot <186143334+slangbot@users.noreply.github.com> --- cmake/SlangTarget.cmake | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'cmake/SlangTarget.cmake') diff --git a/cmake/SlangTarget.cmake b/cmake/SlangTarget.cmake index 89143dd2d..17b017361 100644 --- a/cmake/SlangTarget.cmake +++ b/cmake/SlangTarget.cmake @@ -49,6 +49,10 @@ function(slang_add_target dir type) DEBUG_DIR # Install this target as part of a component INSTALL_COMPONENT + # Don't install debug info by default for this target and use this + # explicit name instead, used for externally built things such as + # slang-glslang and slang-llvm which have large pdb files + DEBUG_INFO_INSTALL_COMPONENT ) set(multi_value_args # Use exactly these sources, instead of globbing from the directory @@ -415,9 +419,31 @@ function(slang_add_target dir type) endmacro() if(ARG_INSTALL) i() + set(pdb_component "debug-info") endif() if(ARG_INSTALL_COMPONENT) i(EXCLUDE_FROM_ALL COMPONENT ${ARG_INSTALL_COMPONENT}) + set(pdb_component "${ARG_INSTALL_COMPONENT}-debug-info") + endif() + if(ARG_DEBUG_INFO_INSTALL_COMPONENT) + set(pdb_component ${ARG_DEBUG_INFO_INSTALL_COMPONENT}) + endif() + if(MSVC AND DEFINED pdb_component) + if( + type STREQUAL "EXECUTABLE" + OR type STREQUAL "SHARED" + OR type STREQUAL "MODULE" + ) + install( + FILES $ + DESTINATION ${runtime_subdir} + # Optional, because if we're building without debug info (like + # a release build) then we don't want to fail here. + OPTIONAL + COMPONENT ${pdb_component} + EXCLUDE_FROM_ALL + ) + endif() endif() endfunction() -- cgit v1.2.3