Skip to content

Commit

Permalink
build: Generate PDB file for Release builds
Browse files Browse the repository at this point in the history
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
  • Loading branch information
karl-lunarg committed Dec 9, 2020
1 parent ba459bd commit 7cf6e36
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions layers/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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 "$<$<CONFIG:Release>:/Zi>")
# Need to use this instead of target_link_options for older versions of CMake.
target_link_libraries(VkLayer_khronos_validation PRIVATE "$<$<CONFIG:Release>:-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)
Expand Down

1 comment on commit 7cf6e36

@Amirnateghi1
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update

Please sign in to comment.