diff --git a/.travis.yml b/.travis.yml index d8123e45..0c5e7bde 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,6 +5,16 @@ env: jobs: include: + - os: linux + env: + - CROSS_COMPILE=mingw32 + - CONTAINER=cross + + - os: linux + env: + - CROSS_COMPILE=mingw64 + - 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..28d375f6 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" || ${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 < ${TRAVIS_BUILD_DIR}/docker-container-id + fi +} diff --git a/.travis/install.sh b/.travis/install.sh index 082c10e5..964170c3 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" || ${CROSS_COMPILE} == "mingw64" ]]; 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..0aa5c0f7 100755 --- a/.travis/script.sh +++ b/.travis/script.sh @@ -1,16 +1,26 @@ #!/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 [[ ${CROSS_COMPILE} == "mingw64" ]]; then + + buildenv x86_64-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 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) { diff --git a/src/sfizz/Config.h b/src/sfizz/Config.h index 0291c46a..92765c35 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