From 7cf6e361ee511723ae58fc17ffe88f16965be42b Mon Sep 17 00:00:00 2001 From: Karl Schultz Date: Tue, 8 Dec 2020 15:08:10 -0700 Subject: [PATCH] build: Generate PDB file for Release builds CMake's RelWithDebInfo build type reduces the optimization level of the code generation. This change allows us to make a fully-optimized Release build and still get a PDB file. Change-Id: I84dfc8fbed9fcd593ab065fc53c2836a87548ff9 --- layers/CMakeLists.txt | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/layers/CMakeLists.txt b/layers/CMakeLists.txt index a9e46f2bbaa..7b1ba729ac4 100644 --- a/layers/CMakeLists.txt +++ b/layers/CMakeLists.txt @@ -255,6 +255,14 @@ if(BUILD_LAYERS) target_include_directories(VkLayer_khronos_validation PRIVATE ${SPIRV_HEADERS_INCLUDE_DIR}) target_link_libraries(VkLayer_khronos_validation PRIVATE ${SPIRV_TOOLS_LIBRARIES}) + # Force generation of the PDB file for Release builds. + # Note that CMake reduces optimization levels for RelWithDebInfo builds. + if(MSVC) + target_compile_options(VkLayer_khronos_validation PRIVATE "$<$:/Zi>") + # Need to use this instead of target_link_options for older versions of CMake. + target_link_libraries(VkLayer_khronos_validation PRIVATE "$<$:-DEBUG:FULL>") + endif() + # The output file needs Unix "/" separators or Windows "\" separators On top of that, Windows separators actually need to be doubled # because the json format uses backslash escapes file(TO_NATIVE_PATH "./" RELATIVE_PATH_PREFIX)