mirror of
https://github.com/gbdev/rgbds.git
synced 2026-05-15 14:11:44 +00:00
Copy DLLs to appropriate dir for install-less Windows testing
Co-authored-by: vulcandth <6394873+vulcandth@users.noreply.github.com>
This commit is contained in:
@@ -108,6 +108,12 @@ set_target_properties(rgbasm rgblink rgbfix rgbgfx PROPERTIES
|
|||||||
# The generator expression (even if a no-op) stops muti-config generators using a of "per-configuration subdirectory".
|
# The generator expression (even if a no-op) stops muti-config generators using a of "per-configuration subdirectory".
|
||||||
RUNTIME_OUTPUT_DIRECTORY $<1:${CMAKE_SOURCE_DIR}>)
|
RUNTIME_OUTPUT_DIRECTORY $<1:${CMAKE_SOURCE_DIR}>)
|
||||||
target_link_libraries(rgbgfx PRIVATE PNG::PNG)
|
target_link_libraries(rgbgfx PRIVATE PNG::PNG)
|
||||||
|
# Copy the DLLs in the output directory so the program can be run for testing without having to `install`.
|
||||||
|
# From https://cmake.org/cmake/help/v4.3/manual/cmake-generator-expressions.7.html#genex:TARGET_RUNTIME_DLLS.
|
||||||
|
add_custom_command(TARGET rgbgfx POST_BUILD COMMENT "Copying rgbgfx's DLLs"
|
||||||
|
# It would be nice to symlink instead, but that only supports one file at a time.
|
||||||
|
COMMAND ${CMAKE_COMMAND} -E copy -t $<TARGET_FILE_DIR:rgbgfx> $<TARGET_RUNTIME_DLLS:rgbgfx>
|
||||||
|
COMMAND_EXPAND_LISTS VERBATIM)
|
||||||
|
|
||||||
# On Windows, you don't link against DLLs directly, but against an import library for that DLL.
|
# On Windows, you don't link against DLLs directly, but against an import library for that DLL.
|
||||||
# This leads to, sometimes, the DLL being stored in a directory far away from the import library itself!
|
# This leads to, sometimes, the DLL being stored in a directory far away from the import library itself!
|
||||||
|
|||||||
+10
-4
@@ -9,8 +9,15 @@ add_executable(rgbgfx_test gfx/rgbgfx_test.cpp)
|
|||||||
set_target_properties(randtilegen rgbgfx_test PROPERTIES
|
set_target_properties(randtilegen rgbgfx_test PROPERTIES
|
||||||
# hack for MSVC: no-op generator expression to stop generation of "per-configuration subdirectory"
|
# hack for MSVC: no-op generator expression to stop generation of "per-configuration subdirectory"
|
||||||
RUNTIME_OUTPUT_DIRECTORY $<1:${CMAKE_CURRENT_SOURCE_DIR}/gfx>)
|
RUNTIME_OUTPUT_DIRECTORY $<1:${CMAKE_CURRENT_SOURCE_DIR}/gfx>)
|
||||||
target_link_libraries(randtilegen PRIVATE PNG::PNG)
|
foreach(prog "randtilegen" "rgbgfx_test")
|
||||||
target_link_libraries(rgbgfx_test PRIVATE PNG::PNG)
|
target_link_libraries(${prog} PRIVATE PNG::PNG)
|
||||||
|
# Copy the DLLs in the output directory so the program can be run for testing without having to `install`.
|
||||||
|
# From https://cmake.org/cmake/help/v4.3/manual/cmake-generator-expressions.7.html#genex:TARGET_RUNTIME_DLLS.
|
||||||
|
add_custom_command(TARGET ${prog} POST_BUILD COMMENT "Copying ${prog}'s DLLs"
|
||||||
|
# It would be nice to symlink instead, but that only supports one file at a time.
|
||||||
|
COMMAND ${CMAKE_COMMAND} -E copy -t $<TARGET_FILE_DIR:${prog}> $<TARGET_RUNTIME_DLLS:${prog}>
|
||||||
|
COMMAND_EXPAND_LISTS VERBATIM)
|
||||||
|
endforeach()
|
||||||
|
|
||||||
set(ONLY_FREE)
|
set(ONLY_FREE)
|
||||||
if(NOT TESTS_RUN_NONFREE)
|
if(NOT TESTS_RUN_NONFREE)
|
||||||
@@ -31,5 +38,4 @@ configure_file(CTestCustom.cmake.in ${CMAKE_BINARY_DIR}/CTestCustom.cmake @ONLY)
|
|||||||
|
|
||||||
add_test(NAME all
|
add_test(NAME all
|
||||||
COMMAND ./run-tests.sh ${ONLY_FREE} ${ONLY_INTERNAL} ${OS_NAME}
|
COMMAND ./run-tests.sh ${ONLY_FREE} ${ONLY_INTERNAL} ${OS_NAME}
|
||||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
|
||||||
)
|
|
||||||
|
|||||||
Reference in New Issue
Block a user