diff options
| author | Ellie Hermaszewska <ellieh@nvidia.com> | 2024-12-03 23:13:52 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-12-03 23:13:52 +0800 |
| commit | 6c655ca927a440d1f03339295235fce2a764c26b (patch) | |
| tree | 89e03d5893bccb899783245e39b648b93538569a | |
| parent | 2f42388e31baef169911d6a4ce9737392ecd610c (diff) | |
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>
| -rw-r--r-- | CMakePresets.json | 2 | ||||
| -rw-r--r-- | cmake/SlangTarget.cmake | 26 | ||||
| -rw-r--r-- | include/slang.h | 4 | ||||
| -rw-r--r-- | source/slang-glslang/CMakeLists.txt | 1 |
4 files changed, 30 insertions, 3 deletions
diff --git a/CMakePresets.json b/CMakePresets.json index b09d1fff1..15bac9f44 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -119,7 +119,7 @@ "generators": ["ZIP"], "variables": { "CPACK_PACKAGE_FILE_NAME": "slang", - "CPACK_COMPONENTS_ALL": "Unspecified;metadata;slang-llvm" + "CPACK_COMPONENTS_ALL": "Unspecified;metadata;debug-info;slang-llvm" } }, { 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 $<TARGET_PDB_FILE:${target}> + 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() diff --git a/include/slang.h b/include/slang.h index 80a132914..3816ab70e 100644 --- a/include/slang.h +++ b/include/slang.h @@ -823,8 +823,8 @@ typedef uint32_t SlangSizeT; enum SlangDebugInfoFormat : SlangDebugInfoFormatIntegral { SLANG_DEBUG_INFO_FORMAT_DEFAULT, ///< Use the default debugging format for the target - SLANG_DEBUG_INFO_FORMAT_C7, ///< CodeView C7 format (typically means debugging information is - ///< embedded in the binary) + SLANG_DEBUG_INFO_FORMAT_C7, ///< CodeView C7 format (typically means debugging information + ///< is embedded in the binary) SLANG_DEBUG_INFO_FORMAT_PDB, ///< Program database SLANG_DEBUG_INFO_FORMAT_STABS, ///< Stabs diff --git a/source/slang-glslang/CMakeLists.txt b/source/slang-glslang/CMakeLists.txt index d28177ccc..d9d2dc45e 100644 --- a/source/slang-glslang/CMakeLists.txt +++ b/source/slang-glslang/CMakeLists.txt @@ -9,6 +9,7 @@ if(SLANG_ENABLE_SLANG_GLSLANG) LINK_WITH_PRIVATE glslang SPIRV SPIRV-Tools-opt INCLUDE_DIRECTORIES_PRIVATE ${slang_SOURCE_DIR}/include INSTALL + DEBUG_INFO_INSTALL_COMPONENT slang-glslang-debug-info ) # Our only interface is through what we define in source/slang-glslang, in the # interests of hygiene, hide anything else we link in. |
