Skip to content

Instantly share code, notes, and snippets.

@BtbN
Created July 15, 2014 14:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save BtbN/2f1d6a2366f8a9836a46 to your computer and use it in GitHub Desktop.
Save BtbN/2f1d6a2366f8a9836a46 to your computer and use it in GitHub Desktop.
string(REGEX REPLACE "\\.(dll|exe)$" ".pdb" FNAME "${FNAME}")
if(CONFIG STREQUAL Debug OR CONFIG STREQUAL RelWithDebInfo)
file(COPY "${INPUT}/${FNAME}" DESTINATION "${OUTPUT}")
elseif(EXISTS "${OUTPUT}/${FNAME}")
file(REMOVE "${OUTPUT}/${FNAME}")
endif()
function(obs_debug_copy_helper target dest)
add_custom_command(TARGET ${target} POST_BUILD
COMMAND "${CMAKE_COMMAND}"
"-DCONFIG=$<CONFIGURATION>"
"-DFNAME=$<TARGET_FILE_NAME:${target}>"
"-DINPUT=$<TARGET_FILE_DIR:${target}>"
"-DOUTPUT=${dest}"
-P "${CMAKE_SOURCE_DIR}/cmake/copy_on_debug_helper.cmake"
VERBATIM)
endfunction()
function(install_obs_pdb ttype target)
if(NOT MSVC)
return()
endif()
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
set(_bit_suffix "64bit")
else()
set(_bit_suffix "32bit")
endif()
obs_debug_copy_helper(${target} "${CMAKE_CURRENT_BINARY_DIR}/pdbs")
if("${ttype}" STREQUAL "PLUGIN")
obs_debug_copy_helper(${target} "${OBS_OUTPUT_DIR}/$<CONFIGURATION>/obs-plugins/${_bit_suffix}")
if(DEFINED ENV{obsInstallerTempDir})
obs_debug_copy_helper(${target} "$ENV{obsInstallerTempDir}/${OBS_EXECUTABLE_DESTINATION}")
endif()
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/pdbs/${tgt_out_name}.pdb"
DESTINATION "${OBS_EXECUTABLE_DESTINATION}"
CONFIGURATIONS Debug RelWithDebInfo)
else()
obs_debug_copy_helper(${target} "${OBS_OUTPUT_DIR}/$<CONFIGURATION>/bin/${_bit_suffix}")
if(DEFINED ENV{obsInstallerTempDir})
obs_debug_copy_helper(${target} "$ENV{obsInstallerTempDir}/${OBS_PLUGIN_DESTINATION}")
endif()
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/pdbs/${tgt_out_name}.pdb"
DESTINATION "${OBS_PLUGIN_DESTINATION}"
CONFIGURATIONS Debug RelWithDebInfo)
endif()
endfunction()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment