Merge pull request #38 from jpcima/ci-with-mingw

Travis build with MinGW (better)
This commit is contained in:
Paul Ferrand 2020-02-03 12:18:13 +01:00 committed by GitHub
commit ddb47f163d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 94 additions and 10 deletions

View file

@ -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

View file

@ -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 ..

View file

@ -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 <<EOF
[multilib]
Include = /etc/pacman.d/mirrorlist
[mingw-w64]
SigLevel = Optional TrustAll
Server = https://github.com/jpcima/arch-mingw-w64/releases/download/repo.\$arch/
EOF
docker cp pacman.conf "$container":/etc/pacman.conf
rm -f pacman.conf
elif [[ ${TRAVIS_OS_NAME} == "linux" ]]; then
wget -q ${cmake_url}
tar xzf ${cmake_arc}
cd ${TRAVIS_BUILD_DIR}/${cmake_dir}
sudo cp bin/* /usr/local/bin/
sudo cp -r share/* /usr/local/share/
export PATH="/usr/local/bin:$PATH" # FIXME
elif [[ ${TRAVIS_OS_NAME} == "osx" ]]; then
sudo ln -s /usr/local /opt/local
brew update

View file

@ -1,6 +1,7 @@
#!/bin/bash
set -ex
. .travis/environment.sh
# Travis Webhook
wget https://raw.githubusercontent.com/DiscordHooks/travis-ci-discord-webhook/master/send.sh

31
.travis/environment.sh Normal file
View file

@ -0,0 +1,31 @@
# ---------------------------------------------------------------------------- #
# Global environment included from all scripts #
# ---------------------------------------------------------------------------- #
# add /usr/local/bin to path, for custom cmake installs
if [[ ${TRAVIS_OS_NAME} == "linux" || ${TRAVIS_OS_NAME} == "osx" ]]; then
export PATH="/usr/local/bin:$PATH"
fi
# buildenv runs a command in host machine or container, depending on build
if [[ ${CROSS_COMPILE} == "mingw32" || ${CROSS_COMPILE} == "mingw64" ]]; then
buildenv() {
setup_container archlinux
docker exec -w "$(pwd)" -i -t "$container" "$@"
}
else
buildenv() {
"$@"
}
fi
# create a container based on given image if not existing
# the container id is persisted in a file across different scripts
setup_container() {
if [ -f ${TRAVIS_BUILD_DIR}/docker-container-id ]; then
container=$(cat ${TRAVIS_BUILD_DIR}/docker-container-id)
else
container=$(docker run -d -i -t -v /home:/home "$1" /bin/bash)
echo "$container" > ${TRAVIS_BUILD_DIR}/docker-container-id
fi
}

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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)
{

View file

@ -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 <cstddef>