CMake/MSVC: Only generate/install stripped PDB for release builds
This renames the WITH_WINDOWS_PDB and WITH_WINDOWS_STRIPPED_PDB cmake options to WITH_WINDOWS_RELEASE_PDB WITH_WINDOWS_RELEASE_STRIPPED_PDB The Stripped PDB isn't cost free to generate, and is only needed for builds that are distributed to end users. There is no benefit in making one for a debug build as the debugger locally will prefer to use the bigger un-stripped PDB anyhow. This also stops the copy/install of the PDB for anything but a release build, this file is about 1.6G for a debug build, and there is really no need to do this for local development, as the debugger will find/use the PDB from its original location. This brings down the time needed for an incremental link on a debug build by about 30% (10->7 seconds on my local system)
This commit is contained in:
parent
99e78f1c7a
commit
0df3aedfa8
|
@ -944,11 +944,11 @@ Include the files needed for debugging python scripts with visual studio 2017+."
|
|||
option(WITH_WINDOWS_SCCACHE "Use sccache to speed up builds (Ninja builder only)" OFF)
|
||||
mark_as_advanced(WITH_WINDOWS_SCCACHE)
|
||||
|
||||
option(WITH_WINDOWS_PDB "Generate a pdb file for client side stacktraces" ON)
|
||||
mark_as_advanced(WITH_WINDOWS_PDB)
|
||||
option(WITH_WINDOWS_RELEASE_PDB "Generate a pdb file for client side stacktraces for release builds" ON)
|
||||
mark_as_advanced(WITH_WINDOWS_RELEASE_PDB)
|
||||
|
||||
option(WITH_WINDOWS_STRIPPED_PDB "Use a stripped PDB file" ON)
|
||||
mark_as_advanced(WITH_WINDOWS_STRIPPED_PDB)
|
||||
option(WITH_WINDOWS_RELEASE_STRIPPED_PDB "Use a stripped PDB file for release builds" ON)
|
||||
mark_as_advanced(WITH_WINDOWS_RELEASE_STRIPPED_PDB)
|
||||
|
||||
endif()
|
||||
|
||||
|
|
|
@ -1011,8 +1011,8 @@ elseif(WIN32)
|
|||
DEBUG
|
||||
)
|
||||
|
||||
if(WITH_WINDOWS_PDB)
|
||||
if(WITH_WINDOWS_STRIPPED_PDB)
|
||||
if(WITH_WINDOWS_RELEASE_PDB)
|
||||
if(WITH_WINDOWS_RELEASE_STRIPPED_PDB)
|
||||
# Icky hack for older CMAKE from https://stackoverflow.com/a/21198501
|
||||
# `$<CONFIG>` will work in newer CMAKE but the version currently (3.12)
|
||||
# on the build-bot does not support this endeavor.
|
||||
|
@ -1020,12 +1020,14 @@ elseif(WIN32)
|
|||
FILES ${CMAKE_CURRENT_BINARY_DIR}/\${CMAKE_INSTALL_CONFIG_NAME}/blender_public.pdb
|
||||
DESTINATION "."
|
||||
RENAME blender.pdb
|
||||
CONFIGURATIONS Release
|
||||
)
|
||||
else()
|
||||
install(
|
||||
FILES $<TARGET_PDB_FILE:blender>
|
||||
DESTINATION "."
|
||||
RENAME blender.pdb
|
||||
CONFIGURATIONS Release
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
|
@ -1724,19 +1726,19 @@ if(WIN32)
|
|||
PDB_NAME "blender_private"
|
||||
PDB_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/$<CONFIG>"
|
||||
)
|
||||
if(WITH_WINDOWS_PDB AND WITH_WINDOWS_STRIPPED_PDB)
|
||||
if(WITH_WINDOWS_RELEASE_PDB AND WITH_WINDOWS_RELEASE_STRIPPED_PDB)
|
||||
# This is slightly messy, but single target generators like ninja will not have the
|
||||
# `CMAKE_CFG_INTDIR` variable and multi-target generators like `msbuild` will not have
|
||||
# `CMAKE_BUILD_TYPE`. This can be simplified by `target_link_options` and the `$<CONFIG>`
|
||||
# generator expression in newer CMAKE (2.13+) but until that time this fill have suffice.
|
||||
if(CMAKE_BUILD_TYPE)
|
||||
set_property(
|
||||
TARGET blender APPEND_STRING PROPERTY LINK_FLAGS
|
||||
TARGET blender APPEND_STRING PROPERTY LINK_FLAGS_RELEASE
|
||||
" /PDBSTRIPPED:${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_BUILD_TYPE}/blender_public.pdb"
|
||||
)
|
||||
else()
|
||||
set_property(
|
||||
TARGET blender APPEND_STRING PROPERTY LINK_FLAGS
|
||||
TARGET blender APPEND_STRING PROPERTY LINK_FLAGS_RELEASE
|
||||
" /PDBSTRIPPED:${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/blender_public.pdb"
|
||||
)
|
||||
endif()
|
||||
|
|
Loading…
Reference in New Issue