Skip to content

Commit

Permalink
Fix tests & examples on shared build on Windows
Browse files Browse the repository at this point in the history
On Windows DLLs are created which must be in the same folder as the
executables.
Do that in the main CML and add a matching CI job
  • Loading branch information
Flamefire committed Jun 1, 2024
1 parent 4858fb0 commit 97f9777
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
12 changes: 5 additions & 7 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,6 @@ jobs:
strategy:
fail-fast: false
matrix:
name: [
linux-cmake,
linux-autotools,
macos-cmake,
macos-autotools,
windows-cmake
]
include:
- name: linux-cmake
os: ubuntu-latest
Expand All @@ -38,6 +31,11 @@ jobs:
build-system: cmake
configure-options: -DCMAKE_TOOLCHAIN_FILE=c:/vcpkg/scripts/buildsystems/vcpkg.cmake -DVCPKG_TARGET_TRIPLET=x64-windows

- name: windows-cmake-shared
os: windows-latest
build-system: cmake
configure-options: -DCMAKE_TOOLCHAIN_FILE=c:/vcpkg/scripts/buildsystems/vcpkg.cmake -DVCPKG_TARGET_TRIPLET=x64-windows -DBUILD_SHARED_LIBS=ON

runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
Expand Down
6 changes: 6 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,12 @@ if(LIBSAMPLERATE_EXAMPLES OR BUILD_TESTING)
endif()

set(HAVE_SNDFILE ${SndFile_FOUND})

# Windows DLLs need to be in the same folder as the executable to be found
if(WIN32 AND NOT DEFINED CMAKE_RUNTIME_OUTPUT_DIRECTORY)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR})
endif()

endif()

# SampleRate library
Expand Down

0 comments on commit 97f9777

Please sign in to comment.