From d3b0cef35fb284d12546c8069ddb7fb96b68a159 Mon Sep 17 00:00:00 2001 From: Jean Pierre Cimalando Date: Sun, 2 Feb 2020 14:43:39 +0100 Subject: [PATCH 1/4] Travis build with MinGW --- .travis.yml | 5 +++++ .travis/after_success.sh | 3 ++- .travis/before_install.sh | 17 +++++++++++++++-- .travis/discord_webhook.sh | 1 + .travis/environment.sh | 31 +++++++++++++++++++++++++++++++ .travis/install.sh | 7 ++++++- .travis/script.sh | 14 ++++++++++---- .travis/update_dox.sh | 3 ++- 8 files changed, 72 insertions(+), 9 deletions(-) create mode 100644 .travis/environment.sh diff --git a/.travis.yml b/.travis.yml index d8123e45..db37b78e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,6 +5,11 @@ env: jobs: include: + - os: linux + env: + - CROSS_COMPILE=mingw32 + - CONTAINER=cross + - os: linux arch: amd64 dist: bionic diff --git a/.travis/after_success.sh b/.travis/after_success.sh index ee85f9a2..3577bb62 100755 --- a/.travis/after_success.sh +++ b/.travis/after_success.sh @@ -1,9 +1,10 @@ #!/bin/bash set -ex +. .travis/environment.sh cd build -make install +buildenv make install tar -zcvf "${INSTALL_DIR}.tar.gz" ${INSTALL_DIR} mv "${INSTALL_DIR}.tar.gz" ${TRAVIS_BUILD_DIR} cd .. diff --git a/.travis/before_install.sh b/.travis/before_install.sh index 07707831..772cebfe 100755 --- a/.travis/before_install.sh +++ b/.travis/before_install.sh @@ -1,18 +1,31 @@ #!/bin/bash set -ex +. .travis/environment.sh cmake_dir="cmake-3.13.0-${TRAVIS_OS_NAME}-${TRAVIS_CPU_ARCH}" cmake_arc="${cmake_dir}.tar.gz" cmake_url="https://github.com/sfztools/cmake/releases/download/${TRAVIS_OS_NAME}/${cmake_arc}" -if [[ ${TRAVIS_OS_NAME} == "linux" ]]; then +if [[ ${CROSS_COMPILE} == "mingw32" ]]; then + buildenv bash -c "echo Hello from container" # ensure to start the container + docker cp "$container":/etc/pacman.conf pacman.conf + cat >>pacman.conf < ${TRAVIS_BUILD_DIR}/docker-container-id + fi +} diff --git a/.travis/install.sh b/.travis/install.sh index 082c10e5..cda08d97 100755 --- a/.travis/install.sh +++ b/.travis/install.sh @@ -1,8 +1,13 @@ #!/bin/bash set -ex +. .travis/environment.sh -if [[ ${TRAVIS_OS_NAME} == "linux" ]]; then +if [[ ${CROSS_COMPILE} == "mingw32" ]]; then + buildenv pacman -Sqy --noconfirm + buildenv pacman -Sq --noconfirm base-devel wget mingw-w64-cmake mingw-w64-gcc mingw-w64-pkg-config mingw-w64-libsndfile + buildenv i686-w64-mingw32-gcc -v && buildenv i686-w64-mingw32-g++ -v && buildenv i686-w64-mingw32-cmake --version +elif [[ ${TRAVIS_OS_NAME} == "linux" ]]; then sudo apt-get install libasound2-dev libjack-jackd2-dev libsndfile1-dev lv2-dev gcc -v && g++ -v && cmake --version && /usr/local/bin/cmake --version && $SHELL --version fi diff --git a/.travis/script.sh b/.travis/script.sh index 9c9da4a1..11ad9055 100755 --- a/.travis/script.sh +++ b/.travis/script.sh @@ -1,16 +1,22 @@ #!/bin/bash set -ex +. .travis/environment.sh mkdir -p build/${INSTALL_DIR} && cd build -/usr/local/bin/cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX:PATH=${PWD}/${INSTALL_DIR} .. -if [[ ${TRAVIS_OS_NAME} == "linux" ]]; then +if [[ ${CROSS_COMPILE} == "mingw32" ]]; then - make -j$(nproc) + buildenv i686-w64-mingw32-cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX:PATH=${PWD}/${INSTALL_DIR} -DSFIZZ_JACK=OFF .. + buildenv make -j +elif [[ ${TRAVIS_OS_NAME} == "linux" ]]; then + + buildenv cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX:PATH=${PWD}/${INSTALL_DIR} .. + buildenv make -j$(nproc) elif [[ ${TRAVIS_OS_NAME} == "osx" ]]; then - make -j$(sysctl -n hw.ncpu) + buildenv cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX:PATH=${PWD}/${INSTALL_DIR} .. + buildenv make -j$(sysctl -n hw.ncpu) # Xcode not currently supported, see https://gitlab.kitware.com/cmake/cmake/issues/18088 # xcodebuild -project sfizz.xcodeproj -alltargets -configuration Debug build diff --git a/.travis/update_dox.sh b/.travis/update_dox.sh index d36f4683..c316015c 100755 --- a/.travis/update_dox.sh +++ b/.travis/update_dox.sh @@ -1,9 +1,10 @@ #!/bin/bash set -x # No fail, we need to go back to the original branch at the end +. .travis/environment.sh # Build documentation only from Linux x86_64 builds -if [[ ${TRAVIS_CPU_ARCH} != "amd64" || ${TRAVIS_OS_NAME} != "linux" ]]; then +if [[ ${TRAVIS_CPU_ARCH} != "amd64" || ${TRAVIS_OS_NAME} != "linux" || "${CROSS_COMPILE}" != "" ]]; then exit 0 fi From e975b35a93a9b5fc01b9f3ac73833ef72a2a1136 Mon Sep 17 00:00:00 2001 From: Jean Pierre Cimalando Date: Sun, 2 Feb 2020 21:25:08 +0100 Subject: [PATCH 2/4] Add MinGW 64-bit --- .travis.yml | 5 +++++ .travis/before_install.sh | 2 +- .travis/environment.sh | 2 +- .travis/install.sh | 2 +- .travis/script.sh | 4 ++++ 5 files changed, 12 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index db37b78e..0c5e7bde 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,6 +10,11 @@ jobs: - CROSS_COMPILE=mingw32 - CONTAINER=cross + - os: linux + env: + - CROSS_COMPILE=mingw64 + - CONTAINER=cross + - os: linux arch: amd64 dist: bionic diff --git a/.travis/before_install.sh b/.travis/before_install.sh index 772cebfe..28d375f6 100755 --- a/.travis/before_install.sh +++ b/.travis/before_install.sh @@ -7,7 +7,7 @@ cmake_dir="cmake-3.13.0-${TRAVIS_OS_NAME}-${TRAVIS_CPU_ARCH}" cmake_arc="${cmake_dir}.tar.gz" cmake_url="https://github.com/sfztools/cmake/releases/download/${TRAVIS_OS_NAME}/${cmake_arc}" -if [[ ${CROSS_COMPILE} == "mingw32" ]]; then +if [[ ${CROSS_COMPILE} == "mingw32" || ${CROSS_COMPILE} == "mingw64" ]]; then buildenv bash -c "echo Hello from container" # ensure to start the container docker cp "$container":/etc/pacman.conf pacman.conf cat >>pacman.conf < Date: Sun, 2 Feb 2020 21:30:26 +0100 Subject: [PATCH 3/4] Suppress a windows warning --- src/sfizz/Config.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/sfizz/Config.h b/src/sfizz/Config.h index 69bf58b9..4a3a9e9d 100644 --- a/src/sfizz/Config.h +++ b/src/sfizz/Config.h @@ -7,7 +7,9 @@ #pragma once #ifdef _WIN32 // There's a spurious min/max function in MSVC that makes everything go badly... -#define NOMINMAX +#ifndef NOMINMAX +#define NOMINMAX 1 +#endif #define _SILENCE_CXX17_OLD_ALLOCATOR_MEMBERS_DEPRECATION_WARNING #endif #include From 19de6edd52f52bc620e153aa29abef3d961246ca Mon Sep 17 00:00:00 2001 From: Jean Pierre Cimalando Date: Sun, 2 Feb 2020 21:54:02 +0100 Subject: [PATCH 4/4] Suppress another warning --- src/external/ghc/filesystem.hpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/external/ghc/filesystem.hpp b/src/external/ghc/filesystem.hpp index 7af17abe..4e57b724 100644 --- a/src/external/ghc/filesystem.hpp +++ b/src/external/ghc/filesystem.hpp @@ -1578,6 +1578,11 @@ GHC_INLINE std::string systemErrorText(ErrorNumber code = 0) using CreateSymbolicLinkW_fp = BOOLEAN(WINAPI*)(LPCWSTR, LPCWSTR, DWORD); using CreateHardLinkW_fp = BOOLEAN(WINAPI*)(LPCWSTR, LPCWSTR, LPSECURITY_ATTRIBUTES); +#ifdef __GNUC__ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wcast-function-type" +#endif + GHC_INLINE void create_symlink(const path& target_name, const path& new_symlink, bool to_directory, std::error_code& ec) { std::error_code tec; @@ -1613,6 +1618,11 @@ GHC_INLINE void create_hardlink(const path& target_name, const path& new_hardlin ec = detail::make_system_error(ERROR_NOT_SUPPORTED); } } + +#ifdef __GNUC__ +#pragma GCC diagnostic pop +#endif + #else GHC_INLINE void create_symlink(const path& target_name, const path& new_symlink, bool, std::error_code& ec) {