From 4c41811bb43d51c31aa5e3babf9b7d4ab5923a85 Mon Sep 17 00:00:00 2001 From: Jean Pierre Cimalando Date: Thu, 27 Feb 2020 20:48:51 +0100 Subject: [PATCH] Static linking for MinGW --- .travis/script.sh | 4 ++-- lv2/CMakeLists.txt | 3 +++ src/CMakeLists.txt | 1 - 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.travis/script.sh b/.travis/script.sh index 06871fe6..0ecc8086 100755 --- a/.travis/script.sh +++ b/.travis/script.sh @@ -7,11 +7,11 @@ mkdir -p build/${INSTALL_DIR} && cd build if [[ ${CROSS_COMPILE} == "mingw32" ]]; then - buildenv i686-w64-mingw32-cmake -DCMAKE_BUILD_TYPE=Release -DSFIZZ_JACK=OFF .. + buildenv i686-w64-mingw32-cmake -DCMAKE_BUILD_TYPE=Release -DSFIZZ_JACK=OFF -DSFIZZ_STATIC_LIBSNDFILE=ON .. buildenv make -j elif [[ ${CROSS_COMPILE} == "mingw64" ]]; then - buildenv x86_64-w64-mingw32-cmake -DCMAKE_BUILD_TYPE=Release -DSFIZZ_JACK=OFF .. + buildenv x86_64-w64-mingw32-cmake -DCMAKE_BUILD_TYPE=Release -DSFIZZ_JACK=OFF -DSFIZZ_STATIC_LIBSNDFILE=ON .. buildenv make -j elif [[ ${BUILD_TYPE} == "lv2" ]]; then diff --git a/lv2/CMakeLists.txt b/lv2/CMakeLists.txt index 2ae9b0e7..e3683f77 100644 --- a/lv2/CMakeLists.txt +++ b/lv2/CMakeLists.txt @@ -22,6 +22,9 @@ if (${CMAKE_SYSTEM_NAME} MATCHES "Linux") endif() target_include_directories(${LV2PLUGIN_PRJ_NAME} PRIVATE . external/ardour) sfizz_enable_lto_if_needed (${LV2PLUGIN_PRJ_NAME}) +if (MINGW) + target_link_options (${LV2PLUGIN_PRJ_NAME} PRIVATE "-static") +endif() # Remove the "lib" prefix, rename the target name and build it in the .lv build dir # /lv2/_lv2. to diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index a03a1b66..959f4587 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -68,4 +68,3 @@ if (SFIZZ_SHARED) endif() endif() endif() -