From 5b95cf9db949c68ed717a49e2e9e1eddbb2564b5 Mon Sep 17 00:00:00 2001 From: OPNA2608 Date: Mon, 28 Mar 2022 15:38:35 +0200 Subject: [PATCH 01/12] Add new CI job to prepare for artifact uploads --- .github/workflows/build.yml | 198 +++++++++++++++++- .../SDL-Fix-MSVC-static-runtime-linking.patch | 35 ++++ 2 files changed, 231 insertions(+), 2 deletions(-) create mode 100644 extern/SDL-Fix-MSVC-static-runtime-linking.patch diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4dce04678..e53d720c7 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -14,6 +14,7 @@ env: BUILD_TYPE: Release jobs: + # Do a plain build, like we would expect a user to do it on their end. build: strategy: matrix: @@ -24,7 +25,7 @@ jobs: - { name: 'Ubuntu', os: ubuntu-18.04, shell: bash } fail-fast: false - name: ${{ matrix.config.name }} + name: "Build: ${{ matrix.config.name }}" runs-on: ${{ matrix.config.os }} defaults: run: @@ -81,7 +82,7 @@ jobs: if [ '${{ matrix.config.compiler }}' == 'mingw' ]; then CMAKE_EXTRA_ARGS+=('-G' 'MSYS Makefiles') elif [ '${{ matrix.config.compiler }}' == 'msvc' ]; then - # We don't want all the MSVC warnings to cause errors yet + # FIXME We don't want all the MSVC warnings to cause errors yet export USE_WAE=OFF fi fi @@ -106,3 +107,196 @@ jobs: cmake \ --install ${PWD}/build \ --config ${{ env.BUILD_TYPE }} + + # Now do a build that we can package. (static runtime linking on MSVC, zipping on Windows, CPack on Darwin, appimage stuff on Ubuntu) + # We rebuild here because the build dependencies may be slightly different and might trigger a full rebuild anyway. + package: + needs: build + strategy: + matrix: + config: + - { name: 'Windows MSVC', os: windows-latest, compiler: msvc, shell: bash } + - { name: 'Windows MinGW', os: windows-latest, compiler: mingw, shell: 'msys2 {0}' } + - { name: 'macOS', os: macos-latest, shell: bash } + - { name: 'Ubuntu', os: ubuntu-18.04, shell: bash } + fail-fast: false + + name: "Package: ${{ matrix.config.name }}" + runs-on: ${{ matrix.config.os }} + defaults: + run: + shell: ${{ matrix.config.shell }} + + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + submodules: recursive + + - name: Setup Toolchain [Windows MSVC] + if: ${{ runner.os == 'Windows' && matrix.config.compiler == 'msvc' }} + uses: seanmiddleditch/gha-setup-vsdevenv@v3 + + - name: Setup Toolchain [Windows MinGW] + if: ${{ runner.os == 'Windows' && matrix.config.compiler == 'mingw' }} + uses: msys2/setup-msys2@v2 + with: + msystem: MINGW64 + update: true + install: | + mingw-w64-x86_64-toolchain + mingw-w64-x86_64-cmake + make + p7zip + + - name: Install Dependencies [macOS] + if: ${{ runner.os == 'macOS' }} + run: | + export HOMEBREW_NO_INSTALL_CLEANUP=1 + brew update + brew install \ + pkg-config \ + sdl2 \ + libsndfile \ + zlib \ + jack + + - name: Install Dependencies [Ubuntu] + if: ${{ runner.os == 'Linux' }} + run: | + sudo apt update + sudo apt install \ + libsdl2-dev \ + libsndfile1-dev \ + zlib1g-dev \ + libjack-jackd2-dev \ + appstream + wget "https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage" + chmod +x appimagetool-x86_64.AppImage + + - name: Set package identity + id: package-identity + run: | + package_name="furnace-${GITHUB_SHA}" + package_ext="" + if [ '${{ runner.os }}' == 'Windows' ]; then + package_name="${package_name}-Windows" + if [ '${{ matrix.config.compiler }}' == 'mingw' ]; then + package_name="${package_name}-MinGW" + else + package_name="${package_name}-MSVC" + fi + package_ext=".zip" + elif [ '${{ runner.os }}' == 'macOS' ]; then + package_name="${package_name}-macOS" + package_ext=".dmg" + else + package_name="${package_name}-Linux" + package_ext=".AppImage" + fi + + echo "Package identity: ${package_name}" + echo "Package file: ${package_name}${package_ext}" + + echo "::set-output name=id::${package_name}" + echo "::set-output name=filename::${package_name}${package_ext}" + + - name: Configure + run: | + export USE_WAE=ON + export CMAKE_EXTRA_ARGS=() + if [ '${{ runner.os }}' == 'Windows' ]; then + if [ '${{ matrix.config.compiler }}' == 'mingw' ]; then + CMAKE_EXTRA_ARGS+=('-G' 'MSYS Makefiles') + 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 + # 1. Make MSVC runtime configurable + CMAKE_EXTRA_ARGS+=('-DCMAKE_POLICY_DEFAULT_CMP0091=NEW') + # 2. Use static (debug) runtime + if [ '${{ env.BUILD_TYPE }}' == 'Debug' ]; then + CMAKE_EXTRA_ARGS+=('-DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreadedDebug') + else + 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 + elif [ '${{ runner.os }}' == 'macOS' ]; then + CMAKE_EXTRA_ARGS+=('-DCMAKE_OSX_DEPLOYMENT_TARGET="10.9"') + fi + + cmake \ + -B ${PWD}/build \ + -DCMAKE_INSTALL_PREFIX=/usr \ + -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} \ + -DWARNINGS_ARE_ERRORS=${USE_WAE} \ + "${CMAKE_EXTRA_ARGS[@]}" + + - name: Build + run: | + export VERBOSE=1 + cmake \ + --build ${PWD}/build \ + --config ${{ env.BUILD_TYPE }} \ + --parallel 2 + + - name: Package [Windows] + if: ${{ runner.os == 'Windows' }} + run: | + binPath=build + if [ '${{ matrix.config.compiler }}' == 'msvc' ]; then + binPath="${binPath}/${{ env.BUILD_TYPE }}" + fi + if [ '${{ matrix.config.compiler }}' == 'mingw' ]; then + strip -s "${binPath}/furnace.exe" + fi + + mkdir target + pushd target + + cp -v ../LICENSE LICENSE.txt + cp -v ../README.md README.txt + cp -vr ../{papers,demos} ../${binPath}/furnace.exe ./ + + 7z a -tzip ../${{ steps.package-identity.outputs.filename }} * + popd + + - name: Package [macOS] + if: ${{ runner.os == 'macOS' }} + run: | + pushd build + cpack + mv Furnace-*-Darwin.dmg ../${{ steps.package-identity.outputs.filename }} + popd + + - name: Package [Ubuntu] + if: ${{ runner.os == 'Linux' }} + run: | + strip -s build/furnace + + mkdir -p target/furnace.AppDir + make -C ${PWD}/build DESTDIR=${PWD}/target/furnace.AppDir install + pushd target + + pushd furnace.AppDir + cp -v usr/share/{icons/hicolor/1024x1024/apps/furnace.png,applications/furnace.desktop} ./ + ln -s furnace.png .DirIcon + mv -v usr/share/metainfo/{furnace.appdata,org.tildearrow.furnace.metainfo}.xml + cp -v ../../res/AppRun ./ + popd + + ../appimagetool-x86_64.AppImage furnace.AppDir + mv Furnace-*.AppImage ../${{ steps.package-identity.outputs.filename }} + popd + + - name: Upload artifact + uses: actions/upload-artifact@v3 + with: + name: ${{ steps.package-identity.outputs.id }} + path: ${{ steps.package-identity.outputs.filename }} diff --git a/extern/SDL-Fix-MSVC-static-runtime-linking.patch b/extern/SDL-Fix-MSVC-static-runtime-linking.patch new file mode 100644 index 000000000..31b9ea619 --- /dev/null +++ b/extern/SDL-Fix-MSVC-static-runtime-linking.patch @@ -0,0 +1,35 @@ +From 34d3dcd98697af081625ccea7a41a3c47806c4ff Mon Sep 17 00:00:00 2001 +From: OPNA2608 +Date: Mon, 28 Mar 2022 16:43:16 +0200 +Subject: [PATCH] SDL: Fix MSVC static runtime linking + +See https://github.com/libsdl-org/SDL/issues/3662, https://github.com/libsdl-org/SDL/issues/4258. +--- + src/stdlib/SDL_stdlib.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/src/stdlib/SDL_stdlib.c b/src/stdlib/SDL_stdlib.c +index 9d785aad5..dfac4d7c3 100644 +--- a/src/stdlib/SDL_stdlib.c ++++ b/src/stdlib/SDL_stdlib.c +@@ -550,7 +550,7 @@ __declspec(selectany) int _fltused = 1; + #endif + + /* The optimizer on Visual Studio 2005 and later generates memcpy() and memset() calls */ +-#if _MSC_VER >= 1400 ++#if (_MSC_VER >= 1400) && !defined(_MT) + extern void *memcpy(void* dst, const void* src, size_t len); + #pragma intrinsic(memcpy) + +@@ -570,7 +570,7 @@ memset(void *dst, int c, size_t len) + { + return SDL_memset(dst, c, len); + } +-#endif /* _MSC_VER >= 1400 */ ++#endif /* (_MSC_VER >= 1400) && !defined(_MT) */ + + #ifdef _M_IX86 + +-- +2.33.1 + From 8a6dfa8d199cdb66af6d88d257d5b75f0b0b3d63 Mon Sep 17 00:00:00 2001 From: OPNA2608 Date: Thu, 31 Mar 2022 15:57:52 +0200 Subject: [PATCH 02/12] pfd: Fixes for MinGW 10 --- extern/pfd-fixed/portable-file-dialogs.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/extern/pfd-fixed/portable-file-dialogs.h b/extern/pfd-fixed/portable-file-dialogs.h index 41e588acf..008fe0a94 100644 --- a/extern/pfd-fixed/portable-file-dialogs.h +++ b/extern/pfd-fixed/portable-file-dialogs.h @@ -57,7 +57,7 @@ #ifndef PFD_HAS_IFILEDIALOG # define PFD_HAS_IFILEDIALOG 1 # if (defined __MINGW64__ || defined __MINGW32__) && defined __GXX_ABI_VERSION -# if __GXX_ABI_VERSION <= 1013 +# if __GXX_ABI_VERSION <= 1014 # undef PFD_HAS_IFILEDIALOG # define PFD_HAS_IFILEDIALOG 0 # endif @@ -1383,7 +1383,7 @@ inline notify::notify(std::string const &title, /* case icon::info: */ default: nid->dwInfoFlags = NIIF_INFO; break; } - ENUMRESNAMEPROC icon_enum_callback = [](HMODULE, LPCTSTR, LPTSTR lpName, LONG_PTR lParam) -> BOOL + ENUMRESNAMEPROC icon_enum_callback = [](HMODULE, LPCTSTR, LPTSTR lpName, LONG_PTR lParam) -> BOOL WINAPI { ((NOTIFYICONDATAW *)lParam)->hIcon = ::LoadIcon(GetModuleHandle(nullptr), lpName); return false; From 0351388996d3ea1ac4741f00272b75b51bc4d74c Mon Sep 17 00:00:00 2001 From: OPNA2608 Date: Thu, 31 Mar 2022 16:20:51 +0200 Subject: [PATCH 03/12] Add MinGW cross-compiler toolchains --- scripts/Cross-MinGW-x86.cmake | 4 ++++ scripts/Cross-MinGW-x86_64.cmake | 4 ++++ scripts/Cross-MinGW.cmake | 14 ++++++++++++++ 3 files changed, 22 insertions(+) create mode 100644 scripts/Cross-MinGW-x86.cmake create mode 100644 scripts/Cross-MinGW-x86_64.cmake create mode 100644 scripts/Cross-MinGW.cmake diff --git a/scripts/Cross-MinGW-x86.cmake b/scripts/Cross-MinGW-x86.cmake new file mode 100644 index 000000000..4049ffdd0 --- /dev/null +++ b/scripts/Cross-MinGW-x86.cmake @@ -0,0 +1,4 @@ +set(CMAKE_SYSTEM_NAME Windows) +set(CMAKE_SYSTEM_PROCESSOR i686) + +include(${CMAKE_CURRENT_LIST_DIR}/Cross-MinGW.cmake) diff --git a/scripts/Cross-MinGW-x86_64.cmake b/scripts/Cross-MinGW-x86_64.cmake new file mode 100644 index 000000000..5b088cb30 --- /dev/null +++ b/scripts/Cross-MinGW-x86_64.cmake @@ -0,0 +1,4 @@ +set(CMAKE_SYSTEM_NAME Windows) +set(CMAKE_SYSTEM_PROCESSOR x86_64) + +include(${CMAKE_CURRENT_LIST_DIR}/Cross-MinGW.cmake) diff --git a/scripts/Cross-MinGW.cmake b/scripts/Cross-MinGW.cmake new file mode 100644 index 000000000..09871d6bb --- /dev/null +++ b/scripts/Cross-MinGW.cmake @@ -0,0 +1,14 @@ +set(TARGET_PREFIX ${CMAKE_SYSTEM_PROCESSOR}-w64-mingw32) + +set(CMAKE_C_COMPILER ${TARGET_PREFIX}-gcc-posix) +set(CMAKE_CXX_COMPILER ${TARGET_PREFIX}-g++-posix) +set(PKG_CONFIG_EXECUTABLE ${TARGET_PREFIX}-pkg-config) + +set(CMAKE_FIND_ROOT_PATH /usr/${TARGET_PREFIX}) + +# Search host system for programs +set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) +# Search target system for libraries, headers & CMake packages +set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) +set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) +set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) From 6c9f1c6d540e982c0e6f6ee72e3613f8a6933943 Mon Sep 17 00:00:00 2001 From: OPNA2608 Date: Fri, 1 Apr 2022 02:55:20 +0200 Subject: [PATCH 04/12] Cross-compile MinGW builds on CI --- .github/workflows/build.yml | 125 ++++++++++++++++-------------------- 1 file changed, 55 insertions(+), 70 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e53d720c7..7d3dd84f5 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -19,17 +19,14 @@ jobs: strategy: matrix: config: - - { name: 'Windows MSVC', os: windows-latest, compiler: msvc, shell: bash } - - { name: 'Windows MinGW', os: windows-latest, compiler: mingw, shell: 'msys2 {0}' } - - { name: 'macOS', os: macos-latest, shell: bash } - - { name: 'Ubuntu', os: ubuntu-18.04, shell: bash } + - { name: 'Windows MSVC', os: windows-latest, compiler: msvc } + - { name: 'Windows MinGW', os: ubuntu-20.04, compiler: mingw } + - { name: 'macOS', os: macos-latest } + - { name: 'Ubuntu', os: ubuntu-18.04 } fail-fast: false name: "Build: ${{ matrix.config.name }}" runs-on: ${{ matrix.config.os }} - defaults: - run: - shell: ${{ matrix.config.shell }} steps: - name: Checkout @@ -38,19 +35,16 @@ jobs: submodules: recursive - name: Setup Toolchain [Windows MSVC] - if: ${{ runner.os == 'Windows' && matrix.config.compiler == 'msvc' }} + if: ${{ matrix.config.compiler == 'msvc' }} uses: seanmiddleditch/gha-setup-vsdevenv@v3 - name: Setup Toolchain [Windows MinGW] - if: ${{ runner.os == 'Windows' && matrix.config.compiler == 'mingw' }} - uses: msys2/setup-msys2@v2 - with: - msystem: MINGW64 - update: true - install: | - mingw-w64-x86_64-toolchain - mingw-w64-x86_64-cmake - make + if: ${{ matrix.config.compiler == 'mingw' }} + run: | + sudo apt update + sudo apt install \ + mingw-w64 \ + mingw-w64-tools - name: Install Dependencies [macOS] if: ${{ runner.os == 'macOS' }} @@ -65,7 +59,7 @@ jobs: jack - name: Install Dependencies [Ubuntu] - if: ${{ runner.os == 'Linux' }} + if: ${{ runner.os == 'Linux' && matrix.config.compiler != 'mingw' }} run: | sudo apt update sudo apt install \ @@ -78,13 +72,11 @@ jobs: run: | export USE_WAE=ON export CMAKE_EXTRA_ARGS=() - if [ '${{ runner.os }}' == 'Windows' ]; then - if [ '${{ matrix.config.compiler }}' == 'mingw' ]; then - CMAKE_EXTRA_ARGS+=('-G' 'MSYS Makefiles') - elif [ '${{ matrix.config.compiler }}' == 'msvc' ]; then - # FIXME We don't want all the MSVC warnings to cause errors yet - export USE_WAE=OFF - fi + if [ '${{ matrix.config.compiler }}' == 'msvc' ]; then + # FIXME We don't want all the MSVC warnings to cause errors yet + export USE_WAE=OFF + elif [ '${{ matrix.config.compiler }}' == 'mingw' ]; then + CMAKE_EXTRA_ARGS+=('-DCMAKE_TOOLCHAIN_FILE=scripts/Cross-MinGW-x86.cmake') fi cmake \ @@ -115,17 +107,14 @@ jobs: strategy: matrix: config: - - { name: 'Windows MSVC', os: windows-latest, compiler: msvc, shell: bash } - - { name: 'Windows MinGW', os: windows-latest, compiler: mingw, shell: 'msys2 {0}' } - - { name: 'macOS', os: macos-latest, shell: bash } - - { name: 'Ubuntu', os: ubuntu-18.04, shell: bash } + - { name: 'Windows MSVC', os: windows-latest, compiler: msvc } + - { name: 'Windows MinGW', os: ubuntu-20.04, compiler: mingw } + - { name: 'macOS', os: macos-latest } + - { name: 'Ubuntu', os: ubuntu-18.04 } fail-fast: false name: "Package: ${{ matrix.config.name }}" runs-on: ${{ matrix.config.os }} - defaults: - run: - shell: ${{ matrix.config.shell }} steps: - name: Checkout @@ -134,20 +123,16 @@ jobs: submodules: recursive - name: Setup Toolchain [Windows MSVC] - if: ${{ runner.os == 'Windows' && matrix.config.compiler == 'msvc' }} + if: ${{ matrix.config.compiler == 'msvc' }} uses: seanmiddleditch/gha-setup-vsdevenv@v3 - name: Setup Toolchain [Windows MinGW] - if: ${{ runner.os == 'Windows' && matrix.config.compiler == 'mingw' }} - uses: msys2/setup-msys2@v2 - with: - msystem: MINGW64 - update: true - install: | - mingw-w64-x86_64-toolchain - mingw-w64-x86_64-cmake - make - p7zip + if: ${{ matrix.config.compiler == 'mingw' }} + run: | + sudo apt update + sudo apt install \ + mingw-w64 \ + mingw-w64-tools - name: Install Dependencies [macOS] if: ${{ runner.os == 'macOS' }} @@ -162,7 +147,7 @@ jobs: jack - name: Install Dependencies [Ubuntu] - if: ${{ runner.os == 'Linux' }} + if: ${{ runner.os == 'Linux' && matrix.config.compiler != 'mingw' }} run: | sudo apt update sudo apt install \ @@ -179,7 +164,7 @@ jobs: run: | package_name="furnace-${GITHUB_SHA}" package_ext="" - if [ '${{ runner.os }}' == 'Windows' ]; then + if [ '${{ runner.os }}' == 'Windows' ] || [ '${{ matrix.config.compiler }}' == 'mingw' ]; then package_name="${package_name}-Windows" if [ '${{ matrix.config.compiler }}' == 'mingw' ]; then package_name="${package_name}-MinGW" @@ -205,28 +190,26 @@ jobs: run: | export USE_WAE=ON export CMAKE_EXTRA_ARGS=() - if [ '${{ runner.os }}' == 'Windows' ]; then - if [ '${{ matrix.config.compiler }}' == 'mingw' ]; then - CMAKE_EXTRA_ARGS+=('-G' 'MSYS Makefiles') - elif [ '${{ matrix.config.compiler }}' == 'msvc' ]; then - # FIXME We don't want all the MSVC warnings to cause errors yet - export USE_WAE=OFF + if [ '${{ 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 - # 1. Make MSVC runtime configurable - CMAKE_EXTRA_ARGS+=('-DCMAKE_POLICY_DEFAULT_CMP0091=NEW') - # 2. Use static (debug) runtime - if [ '${{ env.BUILD_TYPE }}' == 'Debug' ]; then - CMAKE_EXTRA_ARGS+=('-DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreadedDebug') - else - 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 + # Force static linking + # 1. Make MSVC runtime configurable + CMAKE_EXTRA_ARGS+=('-DCMAKE_POLICY_DEFAULT_CMP0091=NEW') + # 2. Use static (debug) runtime + if [ '${{ env.BUILD_TYPE }}' == 'Debug' ]; then + CMAKE_EXTRA_ARGS+=('-DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreadedDebug') + else + 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 + elif [ '${{ matrix.config.compiler }}' == 'mingw' ]; then + CMAKE_EXTRA_ARGS+=('-DCMAKE_TOOLCHAIN_FILE=scripts/Cross-MinGW-x86.cmake') elif [ '${{ runner.os }}' == 'macOS' ]; then CMAKE_EXTRA_ARGS+=('-DCMAKE_OSX_DEPLOYMENT_TARGET="10.9"') fi @@ -247,14 +230,14 @@ jobs: --parallel 2 - name: Package [Windows] - if: ${{ runner.os == 'Windows' }} + if: ${{ runner.os == 'Windows' || matrix.config.compiler == 'mingw' }} run: | binPath=build if [ '${{ matrix.config.compiler }}' == 'msvc' ]; then binPath="${binPath}/${{ env.BUILD_TYPE }}" fi - if [ '${{ matrix.config.compiler }}' == 'mingw' ]; then - strip -s "${binPath}/furnace.exe" + if [ '${{ matrix.config.compiler }}' == 'mingw' ] && [ '${{ env.BUILD_TYPE }}' == 'Release' ]; then + i686-w64-mingw32-strip -s "${binPath}/furnace.exe" fi mkdir target @@ -276,9 +259,11 @@ jobs: popd - name: Package [Ubuntu] - if: ${{ runner.os == 'Linux' }} + if: ${{ runner.os == 'Linux' && matrix.config.compiler != 'mingw' }} run: | - strip -s build/furnace + if [ '${{ env.BUILD_TYPE }}' == 'Release' ]; then + strip -s build/furnace + fi mkdir -p target/furnace.AppDir make -C ${PWD}/build DESTDIR=${PWD}/target/furnace.AppDir install From 8483f853973349614282355d99f7dbd314a76b43 Mon Sep 17 00:00:00 2001 From: OPNA2608 Date: Sat, 2 Apr 2022 16:48:05 +0200 Subject: [PATCH 05/12] Modularise Windows arch on CI --- .github/workflows/build.yml | 81 ++++++++++++++++++++++++++++++++----- 1 file changed, 71 insertions(+), 10 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 7d3dd84f5..db59071ab 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -12,6 +12,7 @@ defaults: env: BUILD_TYPE: Release + WINDOWS_ARCH: x86 jobs: # Do a plain build, like we would expect a user to do it on their end. @@ -34,9 +35,37 @@ jobs: with: submodules: recursive + - name: Set Windows arch identifiers + id: windows-identify + if: ${{ matrix.config.compiler == 'msvc' || matrix.config.compiler == 'mingw' }} + run: | + vswhere_target="${{ env.WINDOWS_ARCH }}" + msvc_target="${{ env.WINDOWS_ARCH }}" + mingw_target="${{ env.WINDOWS_ARCH }}" + + if [ '${{ env.WINDOWS_ARCH }}' == 'x86' ]; then + msvc_target="Win32" + elif [ '${{ env.WINDOWS_ARCH }}' == 'x86_64' ]; then + vswhere_target="amd64" + msvc_target="x64" + fi + + if [ '${{ matrix.config.compiler }}' == 'msvc' ]; then + echo "vswhere target: ${vswhere_target}" + echo "MSVC target: ${msvc_target}" + else + echo "MinGW cross target: ${mingw_target}" + fi + + echo "::set-output name=vswhere-target::${vswhere_target}" + echo "::set-output name=msvc-target::${msvc_target}" + echo "::set-output name=mingw-target::${mingw_target}" + - name: Setup Toolchain [Windows MSVC] if: ${{ matrix.config.compiler == 'msvc' }} uses: seanmiddleditch/gha-setup-vsdevenv@v3 + with: + arch: ${{ steps.windows-identify.outputs.vswhere-target }} - name: Setup Toolchain [Windows MinGW] if: ${{ matrix.config.compiler == 'mingw' }} @@ -73,10 +102,12 @@ jobs: export USE_WAE=ON export CMAKE_EXTRA_ARGS=() if [ '${{ matrix.config.compiler }}' == 'msvc' ]; then + CMAKE_EXTRA_ARGS+=('-DCMAKE_GENERATOR_PLATFORM=${{ steps.windows-identify.outputs.msvc-target }}') + # FIXME We don't want all the MSVC warnings to cause errors yet export USE_WAE=OFF elif [ '${{ matrix.config.compiler }}' == 'mingw' ]; then - CMAKE_EXTRA_ARGS+=('-DCMAKE_TOOLCHAIN_FILE=scripts/Cross-MinGW-x86.cmake') + CMAKE_EXTRA_ARGS+=('-DCMAKE_TOOLCHAIN_FILE=scripts/Cross-MinGW-${{ steps.windows-identify.outputs.mingw-target }}.cmake') fi cmake \ @@ -122,9 +153,37 @@ jobs: with: submodules: recursive + - name: Set Windows arch identifiers + id: windows-identify + if: ${{ matrix.config.compiler == 'msvc' || matrix.config.compiler == 'mingw' }} + run: | + vswhere_target="${{ env.WINDOWS_ARCH }}" + msvc_target="${{ env.WINDOWS_ARCH }}" + mingw_target="${{ env.WINDOWS_ARCH }}" + + if [ '${{ env.WINDOWS_ARCH }}' == 'x86' ]; then + msvc_target="Win32" + elif [ '${{ env.WINDOWS_ARCH }}' == 'x86_64' ]; then + vswhere_target="amd64" + msvc_target="x64" + fi + + if [ '${{ matrix.config.compiler }}' == 'msvc' ]; then + echo "vswhere target: ${vswhere_target}" + echo "MSVC target: ${msvc_target}" + else + echo "MinGW cross target: ${mingw_target}" + fi + + echo "::set-output name=vswhere-target::${vswhere_target}" + echo "::set-output name=msvc-target::${msvc_target}" + echo "::set-output name=mingw-target::${mingw_target}" + - name: Setup Toolchain [Windows MSVC] if: ${{ matrix.config.compiler == 'msvc' }} uses: seanmiddleditch/gha-setup-vsdevenv@v3 + with: + arch: ${{ steps.windows-identify.outputs.vswhere-target }} - name: Setup Toolchain [Windows MinGW] if: ${{ matrix.config.compiler == 'mingw' }} @@ -159,8 +218,8 @@ jobs: wget "https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage" chmod +x appimagetool-x86_64.AppImage - - name: Set package identity - id: package-identity + - name: Set package identifier + id: package-identify run: | package_name="furnace-${GITHUB_SHA}" package_ext="" @@ -180,7 +239,7 @@ jobs: package_ext=".AppImage" fi - echo "Package identity: ${package_name}" + echo "Package identifier: ${package_name}" echo "Package file: ${package_name}${package_ext}" echo "::set-output name=id::${package_name}" @@ -191,6 +250,8 @@ jobs: export USE_WAE=ON export CMAKE_EXTRA_ARGS=() if [ '${{ matrix.config.compiler }}' == 'msvc' ]; then + CMAKE_EXTRA_ARGS+=('-DCMAKE_GENERATOR_PLATFORM=${{ steps.windows-identify.outputs.msvc-target }}') + # FIXME We don't want all the MSVC warnings to cause errors yet export USE_WAE=OFF @@ -209,7 +270,7 @@ jobs: 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') + CMAKE_EXTRA_ARGS+=('-DCMAKE_TOOLCHAIN_FILE=scripts/Cross-MinGW-${{ steps.windows-identify.outputs.mingw-target }}.cmake') elif [ '${{ runner.os }}' == 'macOS' ]; then CMAKE_EXTRA_ARGS+=('-DCMAKE_OSX_DEPLOYMENT_TARGET="10.9"') fi @@ -247,7 +308,7 @@ jobs: cp -v ../README.md README.txt cp -vr ../{papers,demos} ../${binPath}/furnace.exe ./ - 7z a -tzip ../${{ steps.package-identity.outputs.filename }} * + 7z a -tzip ../${{ steps.package-identify.outputs.filename }} * popd - name: Package [macOS] @@ -255,7 +316,7 @@ jobs: run: | pushd build cpack - mv Furnace-*-Darwin.dmg ../${{ steps.package-identity.outputs.filename }} + mv Furnace-*-Darwin.dmg ../${{ steps.package-identify.outputs.filename }} popd - name: Package [Ubuntu] @@ -277,11 +338,11 @@ jobs: popd ../appimagetool-x86_64.AppImage furnace.AppDir - mv Furnace-*.AppImage ../${{ steps.package-identity.outputs.filename }} + mv Furnace-*.AppImage ../${{ steps.package-identify.outputs.filename }} popd - name: Upload artifact uses: actions/upload-artifact@v3 with: - name: ${{ steps.package-identity.outputs.id }} - path: ${{ steps.package-identity.outputs.filename }} + name: ${{ steps.package-identify.outputs.id }} + path: ${{ steps.package-identify.outputs.filename }} From 54a36c495055720eb5320b42eb77872b6c5706cb Mon Sep 17 00:00:00 2001 From: OPNA2608 Date: Sat, 2 Apr 2022 17:36:04 +0200 Subject: [PATCH 06/12] Fix SDL static linking --- .github/workflows/build.yml | 5 --- CMakeLists.txt | 9 +++-- .../SDL-Fix-MSVC-static-runtime-linking.patch | 35 ------------------- 3 files changed, 7 insertions(+), 42 deletions(-) delete mode 100644 extern/SDL-Fix-MSVC-static-runtime-linking.patch diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index db59071ab..3fd8509f3 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -264,11 +264,6 @@ jobs: else 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 elif [ '${{ matrix.config.compiler }}' == 'mingw' ]; then CMAKE_EXTRA_ARGS+=('-DCMAKE_TOOLCHAIN_FILE=scripts/Cross-MinGW-${{ steps.windows-identify.outputs.mingw-target }}.cmake') elif [ '${{ runner.os }}' == 'macOS' ]; then diff --git a/CMakeLists.txt b/CMakeLists.txt index c5fc06e70..769842f33 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -167,8 +167,13 @@ if (SYSTEM_SDL2) endif() message(STATUS "Using system-installed SDL2") else() - set(SDL_SHARED OFF) - set(SDL_STATIC ON) + set(SDL_SHARED OFF CACHE BOOL "Force no dynamically-linked SDL" FORCE) + set(SDL_STATIC ON CACHE BOOL "Force statically-linked SDL" FORCE) + # https://github.com/libsdl-org/SDL/issues/1481 + # On 2014-06-22 17:15:50 +0000, Sam Lantinga wrote: + # If you link SDL statically, you also need to define HAVE_LIBC so it builds with the C runtime that your application uses. + # This should probably go in a FAQ. + set(SDL_LIBC ON CACHE BOOL "Tell SDL that we want it to use our C runtime (required for proper static linking)" FORCE) add_subdirectory(extern/SDL EXCLUDE_FROM_ALL) list(APPEND DEPENDENCIES_INCLUDE_DIRS extern/SDL/include) list(APPEND DEPENDENCIES_LIBRARIES SDL2-static) diff --git a/extern/SDL-Fix-MSVC-static-runtime-linking.patch b/extern/SDL-Fix-MSVC-static-runtime-linking.patch deleted file mode 100644 index 31b9ea619..000000000 --- a/extern/SDL-Fix-MSVC-static-runtime-linking.patch +++ /dev/null @@ -1,35 +0,0 @@ -From 34d3dcd98697af081625ccea7a41a3c47806c4ff Mon Sep 17 00:00:00 2001 -From: OPNA2608 -Date: Mon, 28 Mar 2022 16:43:16 +0200 -Subject: [PATCH] SDL: Fix MSVC static runtime linking - -See https://github.com/libsdl-org/SDL/issues/3662, https://github.com/libsdl-org/SDL/issues/4258. ---- - src/stdlib/SDL_stdlib.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/src/stdlib/SDL_stdlib.c b/src/stdlib/SDL_stdlib.c -index 9d785aad5..dfac4d7c3 100644 ---- a/src/stdlib/SDL_stdlib.c -+++ b/src/stdlib/SDL_stdlib.c -@@ -550,7 +550,7 @@ __declspec(selectany) int _fltused = 1; - #endif - - /* The optimizer on Visual Studio 2005 and later generates memcpy() and memset() calls */ --#if _MSC_VER >= 1400 -+#if (_MSC_VER >= 1400) && !defined(_MT) - extern void *memcpy(void* dst, const void* src, size_t len); - #pragma intrinsic(memcpy) - -@@ -570,7 +570,7 @@ memset(void *dst, int c, size_t len) - { - return SDL_memset(dst, c, len); - } --#endif /* _MSC_VER >= 1400 */ -+#endif /* (_MSC_VER >= 1400) && !defined(_MT) */ - - #ifdef _M_IX86 - --- -2.33.1 - From fa1e3ea3e1029918e08fdb2bd8c1ce4f2c8c7765 Mon Sep 17 00:00:00 2001 From: OPNA2608 Date: Sat, 2 Apr 2022 18:29:37 +0200 Subject: [PATCH 07/12] Fix zip-in-zip artifact upload for Windows --- .github/workflows/build.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 3fd8509f3..bbf80788b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -230,7 +230,7 @@ jobs: else package_name="${package_name}-MSVC" fi - package_ext=".zip" + package_ext="" # Directory, uploading will automatically zip it elif [ '${{ runner.os }}' == 'macOS' ]; then package_name="${package_name}-macOS" package_ext=".dmg" @@ -293,17 +293,17 @@ jobs: binPath="${binPath}/${{ env.BUILD_TYPE }}" fi if [ '${{ matrix.config.compiler }}' == 'mingw' ] && [ '${{ env.BUILD_TYPE }}' == 'Release' ]; then + # FIXME arch-specific strip prefix i686-w64-mingw32-strip -s "${binPath}/furnace.exe" fi - mkdir target - pushd target + mkdir ${{ steps.package-identify.outputs.filename }} + pushd ${{ steps.package-identify.outputs.filename }} cp -v ../LICENSE LICENSE.txt cp -v ../README.md README.txt cp -vr ../{papers,demos} ../${binPath}/furnace.exe ./ - 7z a -tzip ../${{ steps.package-identify.outputs.filename }} * popd - name: Package [macOS] From 28682b79d139d9514556430ee367ca77ca4a5d36 Mon Sep 17 00:00:00 2001 From: OPNA2608 Date: Sun, 3 Apr 2022 20:57:17 +0200 Subject: [PATCH 08/12] Build with system libs in first run --- .github/workflows/build.yml | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index bbf80788b..6e20265d3 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -83,6 +83,8 @@ jobs: brew install \ pkg-config \ sdl2 \ + fmt \ + rtmidi \ libsndfile \ zlib \ jack @@ -93,6 +95,8 @@ jobs: sudo apt update sudo apt install \ libsdl2-dev \ + libfmt-dev \ + librtmidi-dev \ libsndfile1-dev \ zlib1g-dev \ libjack-jackd2-dev @@ -108,6 +112,19 @@ jobs: export USE_WAE=OFF elif [ '${{ matrix.config.compiler }}' == 'mingw' ]; then CMAKE_EXTRA_ARGS+=('-DCMAKE_TOOLCHAIN_FILE=scripts/Cross-MinGW-${{ steps.windows-identify.outputs.mingw-target }}.cmake') + else + # Test with system libs + CMAKE_EXTRA_ARGS+=( + '-DSYSTEM_FMT=ON' + '-DSYSTEM_LIBSNDFILE=ON' + '-DSYSTEM_RTMIDI=ON' + '-DSYSTEM_ZLIB=ON' + '-DWITH_JACK=ON' + ) + # Too old on Ubuntu + if [ '${{ runner.os }}' == 'macOS' ]; then + CMAKE_EXTRA_ARGS+=('-DSYSTEM_SDL2=ON') + fi fi cmake \ @@ -201,6 +218,8 @@ jobs: brew install \ pkg-config \ sdl2 \ + fmt \ + rtmidi \ libsndfile \ zlib \ jack @@ -211,6 +230,8 @@ jobs: sudo apt update sudo apt install \ libsdl2-dev \ + libfmt-dev \ + librtmidi-dev \ libsndfile1-dev \ zlib1g-dev \ libjack-jackd2-dev \ From 759b5ab7d111a2deabfc1650981ad053f1b28a26 Mon Sep 17 00:00:00 2001 From: OPNA2608 Date: Thu, 7 Apr 2022 19:25:27 +0200 Subject: [PATCH 09/12] Don't install brew dependencies in package CI run --- .github/workflows/build.yml | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6e20265d3..3ab546e7a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -210,20 +210,6 @@ jobs: mingw-w64 \ mingw-w64-tools - - name: Install Dependencies [macOS] - if: ${{ runner.os == 'macOS' }} - run: | - export HOMEBREW_NO_INSTALL_CLEANUP=1 - brew update - brew install \ - pkg-config \ - sdl2 \ - fmt \ - rtmidi \ - libsndfile \ - zlib \ - jack - - name: Install Dependencies [Ubuntu] if: ${{ runner.os == 'Linux' && matrix.config.compiler != 'mingw' }} run: | From 3fbcc6be578059c394f8ff2eeb89cedb36c076b3 Mon Sep 17 00:00:00 2001 From: OPNA2608 Date: Fri, 8 Apr 2022 20:37:08 +0200 Subject: [PATCH 10/12] Build x86 & x86_64 on Windows CI --- .github/workflows/build.yml | 45 +++++++++++++++++++++++-------------- 1 file changed, 28 insertions(+), 17 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 3ab546e7a..a16439aa3 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -12,7 +12,6 @@ defaults: env: BUILD_TYPE: Release - WINDOWS_ARCH: x86 jobs: # Do a plain build, like we would expect a user to do it on their end. @@ -20,8 +19,10 @@ jobs: strategy: matrix: config: - - { name: 'Windows MSVC', os: windows-latest, compiler: msvc } - - { name: 'Windows MinGW', os: ubuntu-20.04, compiler: mingw } + - { name: 'Windows MSVC x86', os: windows-latest, compiler: msvc, arch: x86 } + - { name: 'Windows MSVC x86_64', os: windows-latest, compiler: msvc, arch: x86_64 } + - { name: 'Windows MinGW x86', os: ubuntu-20.04, compiler: mingw, arch: x86 } + - { name: 'Windows MinGW x86_64', os: ubuntu-20.04, compiler: mingw, arch: x86_64 } - { name: 'macOS', os: macos-latest } - { name: 'Ubuntu', os: ubuntu-18.04 } fail-fast: false @@ -39,13 +40,13 @@ jobs: id: windows-identify if: ${{ matrix.config.compiler == 'msvc' || matrix.config.compiler == 'mingw' }} run: | - vswhere_target="${{ env.WINDOWS_ARCH }}" - msvc_target="${{ env.WINDOWS_ARCH }}" - mingw_target="${{ env.WINDOWS_ARCH }}" + vswhere_target="${{ matrix.config.arch }}" + msvc_target="${{ matrix.config.arch }}" + mingw_target="${{ matrix.config.arch }}" - if [ '${{ env.WINDOWS_ARCH }}' == 'x86' ]; then + if [ '${{ matrix.config.arch }}' == 'x86' ]; then msvc_target="Win32" - elif [ '${{ env.WINDOWS_ARCH }}' == 'x86_64' ]; then + elif [ '${{ matrix.config.arch }}' == 'x86_64' ]; then vswhere_target="amd64" msvc_target="x64" fi @@ -155,8 +156,10 @@ jobs: strategy: matrix: config: - - { name: 'Windows MSVC', os: windows-latest, compiler: msvc } - - { name: 'Windows MinGW', os: ubuntu-20.04, compiler: mingw } + - { name: 'Windows MSVC x86', os: windows-latest, compiler: msvc, arch: x86 } + - { name: 'Windows MSVC x86_64', os: windows-latest, compiler: msvc, arch: x86_64 } + - { name: 'Windows MinGW x86', os: ubuntu-20.04, compiler: mingw, arch: x86 } + - { name: 'Windows MinGW x86_64', os: ubuntu-20.04, compiler: mingw, arch: x86_64 } - { name: 'macOS', os: macos-latest } - { name: 'Ubuntu', os: ubuntu-18.04 } fail-fast: false @@ -174,13 +177,13 @@ jobs: id: windows-identify if: ${{ matrix.config.compiler == 'msvc' || matrix.config.compiler == 'mingw' }} run: | - vswhere_target="${{ env.WINDOWS_ARCH }}" - msvc_target="${{ env.WINDOWS_ARCH }}" - mingw_target="${{ env.WINDOWS_ARCH }}" + vswhere_target="${{ matrix.config.arch }}" + msvc_target="${{ matrix.config.arch }}" + mingw_target="${{ matrix.config.arch }}" - if [ '${{ env.WINDOWS_ARCH }}' == 'x86' ]; then + if [ '${{ matrix.config.arch }}' == 'x86' ]; then msvc_target="Win32" - elif [ '${{ env.WINDOWS_ARCH }}' == 'x86_64' ]; then + elif [ '${{ matrix.config.arch }}' == 'x86_64' ]; then vswhere_target="amd64" msvc_target="x64" fi @@ -237,6 +240,7 @@ jobs: else package_name="${package_name}-MSVC" fi + package_name="${package_name}-${{ matrix.config.arch }}" package_ext="" # Directory, uploading will automatically zip it elif [ '${{ runner.os }}' == 'macOS' ]; then package_name="${package_name}-macOS" @@ -300,8 +304,15 @@ jobs: binPath="${binPath}/${{ env.BUILD_TYPE }}" fi if [ '${{ matrix.config.compiler }}' == 'mingw' ] && [ '${{ env.BUILD_TYPE }}' == 'Release' ]; then - # FIXME arch-specific strip prefix - i686-w64-mingw32-strip -s "${binPath}/furnace.exe" + # arch-specific strip prefix + # TODO maybe extract from cross toolchain files? + toolPrefix="-w64-mingw32-" + if [ '${{ matrix.config.arch }}' == 'x86_64' ]; then + toolPrefix="x86_64${toolPrefix}" + else + toolPrefix="i686${toolPrefix}" + fi + ${toolPrefix}strip -s "${binPath}/furnace.exe" fi mkdir ${{ steps.package-identify.outputs.filename }} From 5474f6899fa9291bd2f6221b5dd9b139cfae6af1 Mon Sep 17 00:00:00 2001 From: OPNA2608 Date: Fri, 8 Apr 2022 21:13:15 +0200 Subject: [PATCH 11/12] Merge CI phases --- .github/workflows/build.yml | 153 ++++++++++-------------------------- 1 file changed, 40 insertions(+), 113 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a16439aa3..94de2b50f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -14,7 +14,6 @@ env: BUILD_TYPE: Release jobs: - # Do a plain build, like we would expect a user to do it on their end. build: strategy: matrix: @@ -27,7 +26,7 @@ jobs: - { name: 'Ubuntu', os: ubuntu-18.04 } fail-fast: false - name: "Build: ${{ matrix.config.name }}" + name: "Test: ${{ matrix.config.name }}" runs-on: ${{ matrix.config.os }} steps: @@ -62,6 +61,34 @@ jobs: echo "::set-output name=msvc-target::${msvc_target}" echo "::set-output name=mingw-target::${mingw_target}" + - name: Set package identifier + id: package-identify + run: | + package_name="furnace-${GITHUB_SHA}" + package_ext="" + if [ '${{ runner.os }}' == 'Windows' ] || [ '${{ matrix.config.compiler }}' == 'mingw' ]; then + package_name="${package_name}-Windows" + if [ '${{ matrix.config.compiler }}' == 'mingw' ]; then + package_name="${package_name}-MinGW" + else + package_name="${package_name}-MSVC" + fi + package_name="${package_name}-${{ matrix.config.arch }}" + package_ext="" # Directory, uploading will automatically zip it + elif [ '${{ runner.os }}' == 'macOS' ]; then + package_name="${package_name}-macOS" + package_ext=".dmg" + else + package_name="${package_name}-Linux" + package_ext=".AppImage" + fi + + echo "Package identifier: ${package_name}" + echo "Package file: ${package_name}${package_ext}" + + echo "::set-output name=id::${package_name}" + echo "::set-output name=filename::${package_name}${package_ext}" + - name: Setup Toolchain [Windows MSVC] if: ${{ matrix.config.compiler == 'msvc' }} uses: seanmiddleditch/gha-setup-vsdevenv@v3 @@ -100,9 +127,12 @@ jobs: librtmidi-dev \ libsndfile1-dev \ zlib1g-dev \ - libjack-jackd2-dev + libjack-jackd2-dev \ + appstream + wget "https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage" + chmod +x appimagetool-x86_64.AppImage - - name: Configure + - name: Configure (Normal) run: | export USE_WAE=ON export CMAKE_EXTRA_ARGS=() @@ -135,7 +165,7 @@ jobs: -DWARNINGS_ARE_ERRORS=${USE_WAE} \ "${CMAKE_EXTRA_ARGS[@]}" - - name: Build + - name: Build (Normal) run: | export VERBOSE=1 cmake \ @@ -143,120 +173,17 @@ jobs: --config ${{ env.BUILD_TYPE }} \ --parallel 2 - - name: Install + - name: Install (Normal) run: | cmake \ --install ${PWD}/build \ --config ${{ env.BUILD_TYPE }} - # Now do a build that we can package. (static runtime linking on MSVC, zipping on Windows, CPack on Darwin, appimage stuff on Ubuntu) - # We rebuild here because the build dependencies may be slightly different and might trigger a full rebuild anyway. - package: - needs: build - strategy: - matrix: - config: - - { name: 'Windows MSVC x86', os: windows-latest, compiler: msvc, arch: x86 } - - { name: 'Windows MSVC x86_64', os: windows-latest, compiler: msvc, arch: x86_64 } - - { name: 'Windows MinGW x86', os: ubuntu-20.04, compiler: mingw, arch: x86 } - - { name: 'Windows MinGW x86_64', os: ubuntu-20.04, compiler: mingw, arch: x86_64 } - - { name: 'macOS', os: macos-latest } - - { name: 'Ubuntu', os: ubuntu-18.04 } - fail-fast: false - - name: "Package: ${{ matrix.config.name }}" - runs-on: ${{ matrix.config.os }} - - steps: - - name: Checkout - uses: actions/checkout@v2 - with: - submodules: recursive - - - name: Set Windows arch identifiers - id: windows-identify - if: ${{ matrix.config.compiler == 'msvc' || matrix.config.compiler == 'mingw' }} + - name: Cleanup (Normal) run: | - vswhere_target="${{ matrix.config.arch }}" - msvc_target="${{ matrix.config.arch }}" - mingw_target="${{ matrix.config.arch }}" + rm -rf build/ target/ - if [ '${{ matrix.config.arch }}' == 'x86' ]; then - msvc_target="Win32" - elif [ '${{ matrix.config.arch }}' == 'x86_64' ]; then - vswhere_target="amd64" - msvc_target="x64" - fi - - if [ '${{ matrix.config.compiler }}' == 'msvc' ]; then - echo "vswhere target: ${vswhere_target}" - echo "MSVC target: ${msvc_target}" - else - echo "MinGW cross target: ${mingw_target}" - fi - - echo "::set-output name=vswhere-target::${vswhere_target}" - echo "::set-output name=msvc-target::${msvc_target}" - echo "::set-output name=mingw-target::${mingw_target}" - - - name: Setup Toolchain [Windows MSVC] - if: ${{ matrix.config.compiler == 'msvc' }} - uses: seanmiddleditch/gha-setup-vsdevenv@v3 - with: - arch: ${{ steps.windows-identify.outputs.vswhere-target }} - - - name: Setup Toolchain [Windows MinGW] - if: ${{ matrix.config.compiler == 'mingw' }} - run: | - sudo apt update - sudo apt install \ - mingw-w64 \ - mingw-w64-tools - - - name: Install Dependencies [Ubuntu] - if: ${{ runner.os == 'Linux' && matrix.config.compiler != 'mingw' }} - run: | - sudo apt update - sudo apt install \ - libsdl2-dev \ - libfmt-dev \ - librtmidi-dev \ - libsndfile1-dev \ - zlib1g-dev \ - libjack-jackd2-dev \ - appstream - wget "https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage" - chmod +x appimagetool-x86_64.AppImage - - - name: Set package identifier - id: package-identify - run: | - package_name="furnace-${GITHUB_SHA}" - package_ext="" - if [ '${{ runner.os }}' == 'Windows' ] || [ '${{ matrix.config.compiler }}' == 'mingw' ]; then - package_name="${package_name}-Windows" - if [ '${{ matrix.config.compiler }}' == 'mingw' ]; then - package_name="${package_name}-MinGW" - else - package_name="${package_name}-MSVC" - fi - package_name="${package_name}-${{ matrix.config.arch }}" - package_ext="" # Directory, uploading will automatically zip it - elif [ '${{ runner.os }}' == 'macOS' ]; then - package_name="${package_name}-macOS" - package_ext=".dmg" - else - package_name="${package_name}-Linux" - package_ext=".AppImage" - fi - - echo "Package identifier: ${package_name}" - echo "Package file: ${package_name}${package_ext}" - - echo "::set-output name=id::${package_name}" - echo "::set-output name=filename::${package_name}${package_ext}" - - - name: Configure + - name: Configure (Package) run: | export USE_WAE=ON export CMAKE_EXTRA_ARGS=() @@ -288,7 +215,7 @@ jobs: -DWARNINGS_ARE_ERRORS=${USE_WAE} \ "${CMAKE_EXTRA_ARGS[@]}" - - name: Build + - name: Build (Package) run: | export VERBOSE=1 cmake \ From 0aef54400d637921598c923ebfc1e0331f054bd8 Mon Sep 17 00:00:00 2001 From: tildearrow Date: Fri, 8 Apr 2022 16:30:08 -0500 Subject: [PATCH 12/12] exclude Windows/macOS from system lib build in CI --- .github/workflows/build.yml | 32 +++++++++++--------------------- 1 file changed, 11 insertions(+), 21 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 94de2b50f..b48c493ba 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -26,7 +26,7 @@ jobs: - { name: 'Ubuntu', os: ubuntu-18.04 } fail-fast: false - name: "Test: ${{ matrix.config.name }}" + name: ${{ matrix.config.name }} runs-on: ${{ matrix.config.os }} steps: @@ -103,20 +103,6 @@ jobs: mingw-w64 \ mingw-w64-tools - - name: Install Dependencies [macOS] - if: ${{ runner.os == 'macOS' }} - run: | - export HOMEBREW_NO_INSTALL_CLEANUP=1 - brew update - brew install \ - pkg-config \ - sdl2 \ - fmt \ - rtmidi \ - libsndfile \ - zlib \ - jack - - name: Install Dependencies [Ubuntu] if: ${{ runner.os == 'Linux' && matrix.config.compiler != 'mingw' }} run: | @@ -132,7 +118,8 @@ jobs: wget "https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage" chmod +x appimagetool-x86_64.AppImage - - name: Configure (Normal) + - name: Configure (System Libraries) + if: ${{ runner.os == 'Linux' && matrix.config.compiler != 'mingw' }} run: | export USE_WAE=ON export CMAKE_EXTRA_ARGS=() @@ -165,7 +152,8 @@ jobs: -DWARNINGS_ARE_ERRORS=${USE_WAE} \ "${CMAKE_EXTRA_ARGS[@]}" - - name: Build (Normal) + - name: Build (System Libraries) + if: ${{ runner.os == 'Linux' && matrix.config.compiler != 'mingw' }} run: | export VERBOSE=1 cmake \ @@ -173,17 +161,19 @@ jobs: --config ${{ env.BUILD_TYPE }} \ --parallel 2 - - name: Install (Normal) + - name: Install (System Libraries) + if: ${{ runner.os == 'Linux' && matrix.config.compiler != 'mingw' }} run: | cmake \ --install ${PWD}/build \ --config ${{ env.BUILD_TYPE }} - - name: Cleanup (Normal) + - name: Cleanup (System Libraries) + if: ${{ runner.os == 'Linux' && matrix.config.compiler != 'mingw' }} run: | rm -rf build/ target/ - - name: Configure (Package) + - name: Configure run: | export USE_WAE=ON export CMAKE_EXTRA_ARGS=() @@ -215,7 +205,7 @@ jobs: -DWARNINGS_ARE_ERRORS=${USE_WAE} \ "${CMAKE_EXTRA_ARGS[@]}" - - name: Build (Package) + - name: Build run: | export VERBOSE=1 cmake \