Cross-compile MinGW builds on CI
This commit is contained in:
parent
0351388996
commit
6c9f1c6d54
125
.github/workflows/build.yml
vendored
125
.github/workflows/build.yml
vendored
|
@ -19,17 +19,14 @@ jobs:
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
config:
|
config:
|
||||||
- { name: 'Windows MSVC', os: windows-latest, compiler: msvc, shell: bash }
|
- { name: 'Windows MSVC', os: windows-latest, compiler: msvc }
|
||||||
- { name: 'Windows MinGW', os: windows-latest, compiler: mingw, shell: 'msys2 {0}' }
|
- { name: 'Windows MinGW', os: ubuntu-20.04, compiler: mingw }
|
||||||
- { name: 'macOS', os: macos-latest, shell: bash }
|
- { name: 'macOS', os: macos-latest }
|
||||||
- { name: 'Ubuntu', os: ubuntu-18.04, shell: bash }
|
- { name: 'Ubuntu', os: ubuntu-18.04 }
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
|
|
||||||
name: "Build: ${{ matrix.config.name }}"
|
name: "Build: ${{ matrix.config.name }}"
|
||||||
runs-on: ${{ matrix.config.os }}
|
runs-on: ${{ matrix.config.os }}
|
||||||
defaults:
|
|
||||||
run:
|
|
||||||
shell: ${{ matrix.config.shell }}
|
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
|
@ -38,19 +35,16 @@ jobs:
|
||||||
submodules: recursive
|
submodules: recursive
|
||||||
|
|
||||||
- name: Setup Toolchain [Windows MSVC]
|
- name: Setup Toolchain [Windows MSVC]
|
||||||
if: ${{ runner.os == 'Windows' && matrix.config.compiler == 'msvc' }}
|
if: ${{ matrix.config.compiler == 'msvc' }}
|
||||||
uses: seanmiddleditch/gha-setup-vsdevenv@v3
|
uses: seanmiddleditch/gha-setup-vsdevenv@v3
|
||||||
|
|
||||||
- name: Setup Toolchain [Windows MinGW]
|
- name: Setup Toolchain [Windows MinGW]
|
||||||
if: ${{ runner.os == 'Windows' && matrix.config.compiler == 'mingw' }}
|
if: ${{ matrix.config.compiler == 'mingw' }}
|
||||||
uses: msys2/setup-msys2@v2
|
run: |
|
||||||
with:
|
sudo apt update
|
||||||
msystem: MINGW64
|
sudo apt install \
|
||||||
update: true
|
mingw-w64 \
|
||||||
install: |
|
mingw-w64-tools
|
||||||
mingw-w64-x86_64-toolchain
|
|
||||||
mingw-w64-x86_64-cmake
|
|
||||||
make
|
|
||||||
|
|
||||||
- name: Install Dependencies [macOS]
|
- name: Install Dependencies [macOS]
|
||||||
if: ${{ runner.os == 'macOS' }}
|
if: ${{ runner.os == 'macOS' }}
|
||||||
|
@ -65,7 +59,7 @@ jobs:
|
||||||
jack
|
jack
|
||||||
|
|
||||||
- name: Install Dependencies [Ubuntu]
|
- name: Install Dependencies [Ubuntu]
|
||||||
if: ${{ runner.os == 'Linux' }}
|
if: ${{ runner.os == 'Linux' && matrix.config.compiler != 'mingw' }}
|
||||||
run: |
|
run: |
|
||||||
sudo apt update
|
sudo apt update
|
||||||
sudo apt install \
|
sudo apt install \
|
||||||
|
@ -78,13 +72,11 @@ jobs:
|
||||||
run: |
|
run: |
|
||||||
export USE_WAE=ON
|
export USE_WAE=ON
|
||||||
export CMAKE_EXTRA_ARGS=()
|
export CMAKE_EXTRA_ARGS=()
|
||||||
if [ '${{ runner.os }}' == 'Windows' ]; then
|
if [ '${{ matrix.config.compiler }}' == 'msvc' ]; then
|
||||||
if [ '${{ matrix.config.compiler }}' == 'mingw' ]; then
|
# FIXME We don't want all the MSVC warnings to cause errors yet
|
||||||
CMAKE_EXTRA_ARGS+=('-G' 'MSYS Makefiles')
|
export USE_WAE=OFF
|
||||||
elif [ '${{ matrix.config.compiler }}' == 'msvc' ]; then
|
elif [ '${{ matrix.config.compiler }}' == 'mingw' ]; then
|
||||||
# FIXME We don't want all the MSVC warnings to cause errors yet
|
CMAKE_EXTRA_ARGS+=('-DCMAKE_TOOLCHAIN_FILE=scripts/Cross-MinGW-x86.cmake')
|
||||||
export USE_WAE=OFF
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cmake \
|
cmake \
|
||||||
|
@ -115,17 +107,14 @@ jobs:
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
config:
|
config:
|
||||||
- { name: 'Windows MSVC', os: windows-latest, compiler: msvc, shell: bash }
|
- { name: 'Windows MSVC', os: windows-latest, compiler: msvc }
|
||||||
- { name: 'Windows MinGW', os: windows-latest, compiler: mingw, shell: 'msys2 {0}' }
|
- { name: 'Windows MinGW', os: ubuntu-20.04, compiler: mingw }
|
||||||
- { name: 'macOS', os: macos-latest, shell: bash }
|
- { name: 'macOS', os: macos-latest }
|
||||||
- { name: 'Ubuntu', os: ubuntu-18.04, shell: bash }
|
- { name: 'Ubuntu', os: ubuntu-18.04 }
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
|
|
||||||
name: "Package: ${{ matrix.config.name }}"
|
name: "Package: ${{ matrix.config.name }}"
|
||||||
runs-on: ${{ matrix.config.os }}
|
runs-on: ${{ matrix.config.os }}
|
||||||
defaults:
|
|
||||||
run:
|
|
||||||
shell: ${{ matrix.config.shell }}
|
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
|
@ -134,20 +123,16 @@ jobs:
|
||||||
submodules: recursive
|
submodules: recursive
|
||||||
|
|
||||||
- name: Setup Toolchain [Windows MSVC]
|
- name: Setup Toolchain [Windows MSVC]
|
||||||
if: ${{ runner.os == 'Windows' && matrix.config.compiler == 'msvc' }}
|
if: ${{ matrix.config.compiler == 'msvc' }}
|
||||||
uses: seanmiddleditch/gha-setup-vsdevenv@v3
|
uses: seanmiddleditch/gha-setup-vsdevenv@v3
|
||||||
|
|
||||||
- name: Setup Toolchain [Windows MinGW]
|
- name: Setup Toolchain [Windows MinGW]
|
||||||
if: ${{ runner.os == 'Windows' && matrix.config.compiler == 'mingw' }}
|
if: ${{ matrix.config.compiler == 'mingw' }}
|
||||||
uses: msys2/setup-msys2@v2
|
run: |
|
||||||
with:
|
sudo apt update
|
||||||
msystem: MINGW64
|
sudo apt install \
|
||||||
update: true
|
mingw-w64 \
|
||||||
install: |
|
mingw-w64-tools
|
||||||
mingw-w64-x86_64-toolchain
|
|
||||||
mingw-w64-x86_64-cmake
|
|
||||||
make
|
|
||||||
p7zip
|
|
||||||
|
|
||||||
- name: Install Dependencies [macOS]
|
- name: Install Dependencies [macOS]
|
||||||
if: ${{ runner.os == 'macOS' }}
|
if: ${{ runner.os == 'macOS' }}
|
||||||
|
@ -162,7 +147,7 @@ jobs:
|
||||||
jack
|
jack
|
||||||
|
|
||||||
- name: Install Dependencies [Ubuntu]
|
- name: Install Dependencies [Ubuntu]
|
||||||
if: ${{ runner.os == 'Linux' }}
|
if: ${{ runner.os == 'Linux' && matrix.config.compiler != 'mingw' }}
|
||||||
run: |
|
run: |
|
||||||
sudo apt update
|
sudo apt update
|
||||||
sudo apt install \
|
sudo apt install \
|
||||||
|
@ -179,7 +164,7 @@ jobs:
|
||||||
run: |
|
run: |
|
||||||
package_name="furnace-${GITHUB_SHA}"
|
package_name="furnace-${GITHUB_SHA}"
|
||||||
package_ext=""
|
package_ext=""
|
||||||
if [ '${{ runner.os }}' == 'Windows' ]; then
|
if [ '${{ runner.os }}' == 'Windows' ] || [ '${{ matrix.config.compiler }}' == 'mingw' ]; then
|
||||||
package_name="${package_name}-Windows"
|
package_name="${package_name}-Windows"
|
||||||
if [ '${{ matrix.config.compiler }}' == 'mingw' ]; then
|
if [ '${{ matrix.config.compiler }}' == 'mingw' ]; then
|
||||||
package_name="${package_name}-MinGW"
|
package_name="${package_name}-MinGW"
|
||||||
|
@ -205,28 +190,26 @@ jobs:
|
||||||
run: |
|
run: |
|
||||||
export USE_WAE=ON
|
export USE_WAE=ON
|
||||||
export CMAKE_EXTRA_ARGS=()
|
export CMAKE_EXTRA_ARGS=()
|
||||||
if [ '${{ runner.os }}' == 'Windows' ]; then
|
if [ '${{ matrix.config.compiler }}' == 'msvc' ]; then
|
||||||
if [ '${{ matrix.config.compiler }}' == 'mingw' ]; then
|
# FIXME We don't want all the MSVC warnings to cause errors yet
|
||||||
CMAKE_EXTRA_ARGS+=('-G' 'MSYS Makefiles')
|
export USE_WAE=OFF
|
||||||
elif [ '${{ matrix.config.compiler }}' == 'msvc' ]; then
|
|
||||||
# FIXME We don't want all the MSVC warnings to cause errors yet
|
|
||||||
export USE_WAE=OFF
|
|
||||||
|
|
||||||
# Force static linking
|
# Force static linking
|
||||||
# 1. Make MSVC runtime configurable
|
# 1. Make MSVC runtime configurable
|
||||||
CMAKE_EXTRA_ARGS+=('-DCMAKE_POLICY_DEFAULT_CMP0091=NEW')
|
CMAKE_EXTRA_ARGS+=('-DCMAKE_POLICY_DEFAULT_CMP0091=NEW')
|
||||||
# 2. Use static (debug) runtime
|
# 2. Use static (debug) runtime
|
||||||
if [ '${{ env.BUILD_TYPE }}' == 'Debug' ]; then
|
if [ '${{ env.BUILD_TYPE }}' == 'Debug' ]; then
|
||||||
CMAKE_EXTRA_ARGS+=('-DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreadedDebug')
|
CMAKE_EXTRA_ARGS+=('-DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreadedDebug')
|
||||||
else
|
else
|
||||||
CMAKE_EXTRA_ARGS+=('-DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded')
|
CMAKE_EXTRA_ARGS+=('-DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded')
|
||||||
fi
|
|
||||||
|
|
||||||
# Fix SDL static linking (see linked issues in patch file)
|
|
||||||
pushd extern/SDL
|
|
||||||
env EMAIL=root@localhost git am ../SDL-Fix-MSVC-static-runtime-linking.patch
|
|
||||||
popd
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Fix SDL static linking (see linked issues in patch file)
|
||||||
|
pushd extern/SDL
|
||||||
|
env EMAIL=root@localhost git am ../SDL-Fix-MSVC-static-runtime-linking.patch
|
||||||
|
popd
|
||||||
|
elif [ '${{ matrix.config.compiler }}' == 'mingw' ]; then
|
||||||
|
CMAKE_EXTRA_ARGS+=('-DCMAKE_TOOLCHAIN_FILE=scripts/Cross-MinGW-x86.cmake')
|
||||||
elif [ '${{ runner.os }}' == 'macOS' ]; then
|
elif [ '${{ runner.os }}' == 'macOS' ]; then
|
||||||
CMAKE_EXTRA_ARGS+=('-DCMAKE_OSX_DEPLOYMENT_TARGET="10.9"')
|
CMAKE_EXTRA_ARGS+=('-DCMAKE_OSX_DEPLOYMENT_TARGET="10.9"')
|
||||||
fi
|
fi
|
||||||
|
@ -247,14 +230,14 @@ jobs:
|
||||||
--parallel 2
|
--parallel 2
|
||||||
|
|
||||||
- name: Package [Windows]
|
- name: Package [Windows]
|
||||||
if: ${{ runner.os == 'Windows' }}
|
if: ${{ runner.os == 'Windows' || matrix.config.compiler == 'mingw' }}
|
||||||
run: |
|
run: |
|
||||||
binPath=build
|
binPath=build
|
||||||
if [ '${{ matrix.config.compiler }}' == 'msvc' ]; then
|
if [ '${{ matrix.config.compiler }}' == 'msvc' ]; then
|
||||||
binPath="${binPath}/${{ env.BUILD_TYPE }}"
|
binPath="${binPath}/${{ env.BUILD_TYPE }}"
|
||||||
fi
|
fi
|
||||||
if [ '${{ matrix.config.compiler }}' == 'mingw' ]; then
|
if [ '${{ matrix.config.compiler }}' == 'mingw' ] && [ '${{ env.BUILD_TYPE }}' == 'Release' ]; then
|
||||||
strip -s "${binPath}/furnace.exe"
|
i686-w64-mingw32-strip -s "${binPath}/furnace.exe"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
mkdir target
|
mkdir target
|
||||||
|
@ -276,9 +259,11 @@ jobs:
|
||||||
popd
|
popd
|
||||||
|
|
||||||
- name: Package [Ubuntu]
|
- name: Package [Ubuntu]
|
||||||
if: ${{ runner.os == 'Linux' }}
|
if: ${{ runner.os == 'Linux' && matrix.config.compiler != 'mingw' }}
|
||||||
run: |
|
run: |
|
||||||
strip -s build/furnace
|
if [ '${{ env.BUILD_TYPE }}' == 'Release' ]; then
|
||||||
|
strip -s build/furnace
|
||||||
|
fi
|
||||||
|
|
||||||
mkdir -p target/furnace.AppDir
|
mkdir -p target/furnace.AppDir
|
||||||
make -C ${PWD}/build DESTDIR=${PWD}/target/furnace.AppDir install
|
make -C ${PWD}/build DESTDIR=${PWD}/target/furnace.AppDir install
|
||||||
|
|
Loading…
Reference in a new issue