Skip to content

Commit 3b5e029

Browse files
authored
Merge pull request #454 from OSVR/ship-pdb-files
Ships .PDB files (debug symbols) for Debug and RelWithDebInfo configs…
2 parents b1d2cb6 + 4b4b8ca commit 3b5e029

File tree

3 files changed

+29
-0
lines changed

3 files changed

+29
-0
lines changed

apps/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ if(BUILD_CLIENT_APPS)
2626
FOLDER "OSVR Stock Applications")
2727
install(TARGETS osvr_print_tree
2828
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT Runtime)
29+
osvr_install_symbols_for_target(osvr_print_tree)
2930

3031
###
3132
# osvr_dump_tree_json - NOT installed
@@ -153,6 +154,7 @@ if(BUILD_SERVER_APP)
153154
FOLDER "OSVR Stock Applications")
154155
install(TARGETS osvr_server
155156
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT Runtime)
157+
osvr_install_symbols_for_target(osvr_server)
156158

157159
# Macro:
158160
# Copy contents of dir for both build and install trees - directories of JSON configs and descriptors
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
if(MSVC AND NOT CMAKE_VERSION VERSION_LESS 3.2)
2+
function(osvr_install_symbols_for_target _target)
3+
# debug symbols for MSVC: supported on CMake 3.2 and up where there's a
4+
# generator expression for a target's PDB file
5+
get_target_property(_target_type ${_target} TYPE)
6+
if("${_target_type}" STREQUAL "EXECUTABLE" OR "${_target_type}" STREQUAL "SHARED_LIBRARY")
7+
# exe or dll: put it alongside the runtime component
8+
set(DEST ${CMAKE_INSTALL_BINDIR})
9+
else()
10+
set(DEST ${CMAKE_INSTALL_LIBDIR})
11+
endif()
12+
set(HAS_SYMBOLS_CONDITION $<OR:$<CONFIG:RelWithDebInfo>,$<CONFIG:Debug>>)
13+
install(FILES $<${HAS_SYMBOLS_CONDITION}:$<TARGET_PDB_FILE:${_target}>>
14+
DESTINATION ${DEST}
15+
COMPONENT Devel
16+
${ARGN})
17+
endfunction()
18+
else()
19+
function(osvr_install_symbols_for_target)
20+
# do nothing if too old of CMake or not MSVC.
21+
endfunction()
22+
endif()

src/osvr/Macros.cmake

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
include(InstallDebugSymbols)
2+
13
set(LIB_FOLDER "OSVR Libraries")
24

35
set(OSVR_BUILDTREE_TARGETS "" CACHE INTERNAL "" FORCE)
@@ -71,6 +73,9 @@ macro(osvr_add_library)
7173
DESTINATION
7274
${CMAKE_INSTALL_INCLUDEDIR}/osvr/${LIBNAME}
7375
COMPONENT Devel)
76+
77+
osvr_install_symbols_for_target(${LIBNAME_FULL})
78+
7479
osvr_append_target(BUILDTREE ${LIBNAME_FULL})
7580
endmacro()
7681

0 commit comments

Comments
 (0)