Skip to content

Commit b2eda43

Browse files
authored
Merge pull request #4500 from ag-pix4d/win-generate-pdbs
Add an option to ship PDB files
2 parents a132ed5 + 262f7b5 commit b2eda43

2 files changed

Lines changed: 24 additions & 0 deletions

File tree

.github/workflows/windows.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ jobs:
7575
if "${{ env.BUILD_TYPE }}"=="Release" (set CMAKE_UNITY_BUILD_OPT="-DCMAKE_UNITY_BUILD=ON")
7676
cmake -D CMAKE_BUILD_TYPE="${{ env.BUILD_TYPE }}" ^
7777
-D BUILD_SHARED_LIBS="${{ env.BUILD_SHARED_LIBS }}" ^
78+
-D EXPORT_PDB="ON" ^
7879
-D CMAKE_C_FLAGS="/WX" ^
7980
-D CMAKE_CXX_FLAGS="/WX" ^
8081
%CMAKE_CXX_STANDARD% ^

CMakeLists.txt

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -432,6 +432,29 @@ set(docfiles COPYING NEWS.md AUTHORS.md)
432432
install(FILES ${docfiles}
433433
DESTINATION ${CMAKE_INSTALL_DOCDIR})
434434

435+
################################################################################
436+
# Build debug symbols
437+
################################################################################
438+
option(EXPORT_PDB "Export PDB file" OFF)
439+
440+
if (WIN32 AND EXPORT_PDB)
441+
target_compile_options(proj PRIVATE /Zi /Zf)
442+
target_link_options(proj PRIVATE /DEBUG /OPT:REF /OPT:ICF)
443+
444+
if(BUILD_SHARED_LIBS)
445+
set(pdbFile $<TARGET_PDB_FILE:proj>)
446+
else()
447+
set(pdbDirFullPath ${CMAKE_BINARY_DIR}/lib)
448+
set_target_properties(proj
449+
PROPERTIES
450+
COMPILE_PDB_OUTPUT_DIRECTORY ${pdbDirFullPath}
451+
COMPILE_PDB_NAME proj)
452+
set(pdbFile ${pdbDirFullPath}/proj.pdb)
453+
endif()
454+
455+
install(FILES ${pdbFile} DESTINATION lib)
456+
endif()
457+
435458
################################################################################
436459
# pkg-config support
437460
################################################################################

0 commit comments

Comments
 (0)