Skip to content

Commit 33dbb41

Browse files
committed
Make publishing test script a build rule
Previously it was only done when the projects were generated.
1 parent 492b560 commit 33dbb41

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

tests/CMakeLists.txt

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ target_include_directories(test_crypto PRIVATE ../src ../src/public ../src/commo
2525
target_link_libraries(test_crypto GameNetworkingSockets_s)
2626
add_sanitizers(test_crypto)
2727

28-
# Test data for the crypto test
28+
# Test data for the crypto test when the project is built
2929
file(COPY aesgcmtestvectors DESTINATION ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
3030

3131
# P2P test
@@ -38,7 +38,12 @@ if(USE_STEAMWEBRTC)
3838
set_target_common_gns_properties( test_p2p )
3939
target_link_libraries(test_p2p ${GAMENETWORKINGSOCKETS_LIB})
4040

41-
# NOTE: This happens when we generate the projects, and really we'd like to actually
42-
# make a build rule to copy it. I don't want to do that work right now.
43-
file(COPY test_p2p.py DESTINATION ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
41+
# Publish the test script
42+
set( P2P_TEST_SCRIPT ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/test_p2p.py )
43+
set( P2P_TEST_SCRIPT_SRC ${CMAKE_CURRENT_SOURCE_DIR}/test_p2p.py )
44+
add_custom_command(
45+
OUTPUT ${P2P_TEST_SCRIPT}
46+
COMMAND ${CMAKE_COMMAND} -E copy ${P2P_TEST_SCRIPT_SRC} ${P2P_TEST_SCRIPT}
47+
DEPENDS ${P2P_TEST_SCRIPT_SRC} )
48+
add_custom_target( publish_test_script ALL DEPENDS ${P2P_TEST_SCRIPT} )
4449
endif()

0 commit comments

Comments
 (0)