From 4491e001ea2966657b6e0b8490e19962e190dcf8 Mon Sep 17 00:00:00 2001 From: Sander Cox Date: Fri, 16 Dec 2022 16:54:22 +0100 Subject: [PATCH] Make it compile and don't ship PDBs when not there --- CMakeLists.txt | 66 +++++++++++++++++++++++++++++++------------------- 1 file changed, 41 insertions(+), 25 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 455d8c6..4b3c46e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -50,13 +50,14 @@ include_directories( ${Qt5Widgets_INCLUDES} ) -set(SPOUTDX_LIB "${CMAKE_SOURCE_DIR}/plugins/win-spout/deps/Spout2/BUILD/Binaries/x64/SpoutDX.lib") +set(SPOUTDX_LIB "${CMAKE_CURRENT_SOURCE_DIR}/deps/Spout2/BUILD/Binaries/x64/SpoutDX.lib") target_link_libraries(win-spout ${OBS_FRONTEND_LIB} ${PTHREAD_LIB} ${LIBOBS_LIB} ${SPOUTDX_LIB} + OBS::w32-pthreads Qt::Core Qt::Widgets ) @@ -77,31 +78,46 @@ function(copy_spout_file) COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/deps/Spout2/BUILD/Binaries/${_src_suffix}/SpoutDX.dll" "${OBS_OUTPUT_DIR}/$/${OBS_PLUGIN_DESTINATION}/SpoutDX.dll" - COMMAND if $==1 ( - "${CMAKE_COMMAND}" -E copy - "${CMAKE_CURRENT_SOURCE_DIR}/deps/Spout2/BUILD/Binaries/${_src_suffix}/Spout.pdb" - "${OBS_OUTPUT_DIR}/$/${OBS_PLUGIN_DESTINATION}/Spout.pdb") - COMMAND if $==1 ( - "${CMAKE_COMMAND}" -E copy - "${CMAKE_CURRENT_SOURCE_DIR}/deps/Spout2/BUILD/Binaries/${_src_suffix}/SpoutLibrary.pdb" - "${OBS_OUTPUT_DIR}/$/${OBS_PLUGIN_DESTINATION}/SpoutLibrary.pdb") - COMMAND if $==1 ( - "${CMAKE_COMMAND}" -E copy - "${CMAKE_CURRENT_SOURCE_DIR}/deps/Spout2/BUILD/Binaries/${_src_suffix}/SpoutDX.pdb" - "${OBS_OUTPUT_DIR}/$/${OBS_PLUGIN_DESTINATION}/SpoutDX.pdb") - COMMAND if $==1 ( - "${CMAKE_COMMAND}" -E copy - "${CMAKE_CURRENT_SOURCE_DIR}/deps/Spout2/BUILD/Binaries/${_src_suffix}/Spout.pdb" - "${OBS_OUTPUT_DIR}/$/${OBS_PLUGIN_DESTINATION}/Spout.pdb") - COMMAND if $==1 ( - "${CMAKE_COMMAND}" -E copy - "${CMAKE_CURRENT_SOURCE_DIR}/deps/Spout2/BUILD/Binaries/${_src_suffix}/SpoutLibrary.pdb" - "${OBS_OUTPUT_DIR}/$/${OBS_PLUGIN_DESTINATION}/SpoutLibrary.pdb") - COMMAND if $==1 ( - "${CMAKE_COMMAND}" -E copy - "${CMAKE_CURRENT_SOURCE_DIR}/deps/Spout2/BUILD/Binaries/${_src_suffix}/SpoutDX.pdb" - "${OBS_OUTPUT_DIR}/$/${OBS_PLUGIN_DESTINATION}/SpoutDX.pdb") ) + + if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/deps/Spout2/BUILD/Binaries/${_src_suffix}/Spout.pdb") + add_custom_command(TARGET win-spout POST_BUILD + COMMAND if $==1( + "${CMAKE_COMMAND}" -E copy + "${CMAKE_CURRENT_SOURCE_DIR}/deps/Spout2/BUILD/Binaries/${_src_suffix}/Spout.pdb" + "${OBS_OUTPUT_DIR}/$/${OBS_PLUGIN_DESTINATION}/Spout.pdb") + COMMAND if $==1( + "${CMAKE_COMMAND}" -E copy + "${CMAKE_CURRENT_SOURCE_DIR}/deps/Spout2/BUILD/Binaries/${_src_suffix}/Spout.pdb" + "${OBS_OUTPUT_DIR}/$/${OBS_PLUGIN_DESTINATION}/Spout.pdb") + ) + endif() + + if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/deps/Spout2/BUILD/Binaries/${_src_suffix}/SpoutLibrary.pdb") + add_custom_command(TARGET win-spout POST_BUILD + COMMAND if $==1( + "${CMAKE_COMMAND}" -E copy + "${CMAKE_CURRENT_SOURCE_DIR}/deps/Spout2/BUILD/Binaries/${_src_suffix}/SpoutLibrary.pdb" + "${OBS_OUTPUT_DIR}/$/${OBS_PLUGIN_DESTINATION}/SpoutLibrary.pdb") + COMMAND if $==1( + "${CMAKE_COMMAND}" -E copy + "${CMAKE_CURRENT_SOURCE_DIR}/deps/Spout2/BUILD/Binaries/${_src_suffix}/SpoutLibrary.pdb" + "${OBS_OUTPUT_DIR}/$/${OBS_PLUGIN_DESTINATION}/SpoutLibrary.pdb") + ) + endif() + + if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/deps/Spout2/BUILD/Binaries/${_src_suffix}/SpoutDX.pdb") + add_custom_command(TARGET win-spout POST_BUILD + COMMAND if $==1( + "${CMAKE_COMMAND}" -E copy + "${CMAKE_CURRENT_SOURCE_DIR}/deps/Spout2/BUILD/Binaries/${_src_suffix}/SpoutDX.pdb" + "${OBS_OUTPUT_DIR}/$/${OBS_PLUGIN_DESTINATION}/SpoutDX.pdb") + COMMAND if $==1( + "${CMAKE_COMMAND}" -E copy + "${CMAKE_CURRENT_SOURCE_DIR}/deps/Spout2/BUILD/Binaries/${_src_suffix}/SpoutDX.pdb" + "${OBS_OUTPUT_DIR}/$/${OBS_PLUGIN_DESTINATION}/SpoutDX.pdb") + ) + endif() endfunction() setup_plugin_target(win-spout)