diff --git a/examples/client/CMakeLists.txt b/examples/client/CMakeLists.txt index f853cbf..3e064f4 100644 --- a/examples/client/CMakeLists.txt +++ b/examples/client/CMakeLists.txt @@ -4,10 +4,10 @@ if(POLICY CMP0079) endif() if(WIN32) -add_executable(datachannel-client main.cpp parse_cl.cpp parse_cl.h getopt.cpp getopt.h) -target_compile_definitions(datachannel-client PUBLIC STATIC_GETOPT) + add_executable(datachannel-client main.cpp parse_cl.cpp parse_cl.h getopt.cpp getopt.h) + target_compile_definitions(datachannel-client PUBLIC STATIC_GETOPT) else() -add_executable(datachannel-client main.cpp parse_cl.cpp parse_cl.h) + add_executable(datachannel-client main.cpp parse_cl.cpp parse_cl.h) endif() set_target_properties(datachannel-client PROPERTIES @@ -15,3 +15,10 @@ set_target_properties(datachannel-client PROPERTIES OUTPUT_NAME client) target_link_libraries(datachannel-client datachannel nlohmann_json) +if(WIN32) + add_custom_command(TARGET datachannel-client POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy_if_different + "$/datachannel.dll" + $ + ) +endif() diff --git a/examples/copy-paste-capi/CMakeLists.txt b/examples/copy-paste-capi/CMakeLists.txt index 3ba6d54..e7a3091 100644 --- a/examples/copy-paste-capi/CMakeLists.txt +++ b/examples/copy-paste-capi/CMakeLists.txt @@ -13,3 +13,15 @@ set_target_properties(datachannel-copy-paste-capi-answerer PROPERTIES OUTPUT_NAME answerer) target_link_libraries(datachannel-copy-paste-capi-answerer datachannel) +if(WIN32) + add_custom_command(TARGET datachannel-copy-paste-capi-offerer POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy_if_different + "$/datachannel.dll" + $ + ) + add_custom_command(TARGET datachannel-copy-paste-capi-answerer POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy_if_different + "$/datachannel.dll" + $ + ) +endif() diff --git a/examples/copy-paste/CMakeLists.txt b/examples/copy-paste/CMakeLists.txt index 8d65d24..2aa0a0a 100644 --- a/examples/copy-paste/CMakeLists.txt +++ b/examples/copy-paste/CMakeLists.txt @@ -12,3 +12,15 @@ set_target_properties(datachannel-copy-paste-answerer PROPERTIES OUTPUT_NAME answerer) target_link_libraries(datachannel-copy-paste-answerer datachannel) +if(WIN32) + add_custom_command(TARGET datachannel-copy-paste-offerer POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy_if_different + "$/datachannel.dll" + $ + ) + add_custom_command(TARGET datachannel-copy-paste-answerer POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy_if_different + "$/datachannel.dll" + $ + ) +endif() diff --git a/examples/media/CMakeLists.txt b/examples/media/CMakeLists.txt index 977f4ac..d21737b 100644 --- a/examples/media/CMakeLists.txt +++ b/examples/media/CMakeLists.txt @@ -6,3 +6,10 @@ set_target_properties(datachannel-media PROPERTIES OUTPUT_NAME media) target_link_libraries(datachannel-media datachannel nlohmann_json) +if(WIN32) + add_custom_command(TARGET datachannel-media POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy_if_different + "$/datachannel.dll" + $ + ) +endif() diff --git a/examples/sfu-media/CMakeLists.txt b/examples/sfu-media/CMakeLists.txt index 3f34d92..5939118 100644 --- a/examples/sfu-media/CMakeLists.txt +++ b/examples/sfu-media/CMakeLists.txt @@ -6,3 +6,10 @@ set_target_properties(datachannel-sfu-media PROPERTIES OUTPUT_NAME sfu-media) target_link_libraries(datachannel-sfu-media datachannel nlohmann_json) +if(WIN32) + add_custom_command(TARGET datachannel-sfu-media POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy_if_different + "$/datachannel.dll" + $ + ) +endif() diff --git a/examples/streamer/CMakeLists.txt b/examples/streamer/CMakeLists.txt index 33e09c3..21069eb 100644 --- a/examples/streamer/CMakeLists.txt +++ b/examples/streamer/CMakeLists.txt @@ -3,17 +3,38 @@ if(POLICY CMP0079) cmake_policy(SET CMP0079 NEW) endif() +add_executable(streamer + main.cpp + dispatchqueue.cpp + dispatchqueue.hpp + h264fileparser.cpp + h264fileparser.hpp + helpers.cpp + helpers.hpp + opusfileparser.cpp + opusfileparser.hpp + fileparser.cpp + fileparser.hpp + stream.cpp + stream.hpp + ArgParser.cpp + ArgParser.hpp +) + if(WIN32) -add_executable(streamer main.cpp dispatchqueue.cpp dispatchqueue.hpp h264fileparser.cpp h264fileparser.hpp helpers.cpp helpers.hpp opusfileparser.cpp opusfileparser.hpp fileparser.cpp fileparser.hpp stream.cpp stream.hpp ArgParser.hpp ArgParser.cpp) -target_compile_definitions(streamer PUBLIC STATIC_GETOPT) -else() -add_executable(streamer main.cpp dispatchqueue.cpp dispatchqueue.hpp h264fileparser.cpp h264fileparser.hpp helpers.cpp helpers.hpp opusfileparser.cpp opusfileparser.hpp fileparser.cpp fileparser.hpp stream.cpp stream.hpp ArgParser.hpp ArgParser.cpp) + target_compile_definitions(streamer PUBLIC STATIC_GETOPT) endif() + set_target_properties(streamer PROPERTIES CXX_STANDARD 17 OUTPUT_NAME streamer) -target_link_libraries(streamer datachannel) - target_link_libraries(streamer datachannel nlohmann_json) +if(WIN32) + add_custom_command(TARGET streamer POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy_if_different + "$/datachannel.dll" + $ + ) +endif()