From 9fcff6f17d9fadfe28406a9fbdca4374242e5350 Mon Sep 17 00:00:00 2001 From: JustDoom <61824552+JustDoom@users.noreply.github.com> Date: Sat, 23 Mar 2024 16:10:43 +1000 Subject: [PATCH] dll maybe --- .github/workflows/build.yml | 4 +++- CMakeLists.txt | 5 ----- src/CMakeLists.txt | 19 ++++++++++--------- 3 files changed, 13 insertions(+), 15 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8acf5ca..24fa51b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -63,7 +63,9 @@ jobs: uses: actions/upload-artifact@v2 with: name: windows-executable - path: build/src/Debug/*.exe + path: | + build/src/Debug/*.exe + build/src/Debug/*.dll # - name: Configure build environment for target architecture # run: | diff --git a/CMakeLists.txt b/CMakeLists.txt index 7cadfde..44ee93a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,10 +3,5 @@ project(8ChocChip LANGUAGES CXX VERSION 0.1) -# Set the path to the vcpkg toolchain file for Windows -if(WIN32) - set(CMAKE_TOOLCHAIN_FILE "C:/tools/vcpkg/scripts/buildsystems/vcpkg.cmake" CACHE STRING "Vcpkg toolchain file") -endif() - add_subdirectory(dependencies) add_subdirectory(src) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index e5c8a80..a98ff0e 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -9,13 +9,14 @@ add_executable(8ChocChip main.cpp Cpu.h) target_link_libraries(8ChocChip PRIVATE sfml-graphics sfml-audio) -if (WIN32) - foreach (SFML_LIB ${SFML_LIBRARIES}) - get_filename_component(SFML_LIB_DIR ${SFML_LIB} DIRECTORY) - file(GLOB SFML_DLLS "${SFML_LIB_DIR}/*.dll") - foreach (SFML_DLL ${SFML_DLLS}) - add_custom_command(TARGET 8ChocChip POST_BUILD COMMAND - ${CMAKE_COMMAND} -E copy_if_different ${SFML_DLL} $) - endforeach() - endforeach() +# Copy DLLs needed for runtime on Windows +if(WIN32) + if (BUILD_SHARED_LIBS) + add_custom_command(TARGET 8ChocChip POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy_if_different + $ + $ + $ + $) + endif() endif()