From 364e2a915ae2cf8a90d4b7c02bb803b70c893415 Mon Sep 17 00:00:00 2001 From: Carsten Teibes Date: Sun, 14 Apr 2024 01:46:47 +0200 Subject: [PATCH] Windows: Bundle dependency libraries --- .github/workflows/ci.yml | 1 - CMakeLists.txt | 24 +++++++++++++++++++++++- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 815fc9e..337ea0c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -142,7 +142,6 @@ jobs: SHORT_SHA: ${{ needs.prepare.outputs.short_sha }} run: | cmake --install build-release --prefix $PWD - cp /mingw64/bin/SDL2.dll dist/ builds/ci/adoc2html ${SHORT_SHA} < res/unix/OpenJazz.6.adoc > dist/OpenJazzManual.html builds/ci/docs2dist dist mv dist OJ-${SHORT_SHA} diff --git a/CMakeLists.txt b/CMakeLists.txt index 3890691..3e04a0f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -315,7 +315,29 @@ endif() if(WIN32) # put everything in a folder - install(TARGETS OpenJazz DESTINATION dist) + install(TARGETS OpenJazz RUNTIME DESTINATION dist) + install(CODE [[ + file(GET_RUNTIME_DEPENDENCIES + EXECUTABLES + $ + RESOLVED_DEPENDENCIES_VAR _r_deps + UNRESOLVED_DEPENDENCIES_VAR _u_deps + DIRECTORIES + $ + ) + foreach(_file ${_r_deps}) + string(TOLOWER ${_file} _file_lower) + if(NOT ${_file_lower} MATCHES "c:[\\/]windows[\\/]system32.*") + file(INSTALL + DESTINATION "${CMAKE_INSTALL_PREFIX}" + TYPE SHARED_LIBRARY + FOLLOW_SYMLINK_CHAIN + FILES "${_file}" + ) + endif() + endforeach() + #message("UNRESOLVED_DEPENDENCIES_VAR: ${_u_deps}") + ]]) elseif(3DS) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/OpenJazz.3dsx DESTINATION OpenJazz COMPONENT 3ds)