Fix building for OpenBSD and FreeBSD #2118
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: 'Build' | |
| on: | |
| - pull_request | |
| jobs: | |
| linux: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - name: SDL 2 | |
| flags: '-DNBC_PLATFORM=sdl2 -DNBC_GFX_API=OGL' | |
| packages: 'libsdl2-dev' | |
| - name: SDL 1.2 | |
| flags: '-DNBC_PLATFORM=sdl1 -DNBC_GFX_API=OGL' | |
| packages: 'libsdl1.2-dev' | |
| name: Linux (${{ matrix.name }}) | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - name: Get Time | |
| id: get-time | |
| run: echo "time=$(date -u '+%Y-%m-%d-%H:%M:%S')" >> $GITHUB_OUTPUT | |
| - uses: actions/cache@v5 | |
| with: | |
| path: ~/ccache.tar.xz | |
| key: linux-${{ matrix.name }}-${{ steps.get-time.outputs.time }} | |
| restore-keys: linux-${{ matrix.name }}- | |
| - name: Unpack cache | |
| run: cd ~ && [ -f ccache.tar.xz ] && tar xf ccache.tar.xz || true | |
| - name: Checkout Repository | |
| uses: actions/checkout@v6 | |
| with: | |
| submodules: true | |
| - name: Install Dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install --no-install-recommends -y \ | |
| build-essential \ | |
| cmake ninja-build \ | |
| ccache \ | |
| libopenal-dev \ | |
| ${{ matrix.packages }} | |
| - name: Build | |
| run: | | |
| mkdir build | |
| cd build | |
| cmake .. -GNinja \ | |
| -DCMAKE_C_COMPILER_LAUNCHER=ccache \ | |
| -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \ | |
| -DWERROR=ON \ | |
| ${{ matrix.flags }} | |
| cmake --build . | |
| - name: Pack cache | |
| run: cd ~ && tar cJf ccache.tar.xz .cache/ccache | |
| wasm: | |
| name: WASM | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - name: Get Time | |
| id: get-time | |
| run: echo "time=$(date -u '+%Y-%m-%d-%H:%M:%S')" >> $GITHUB_OUTPUT | |
| - uses: actions/cache@v5 | |
| with: | |
| path: ~/ccache.tar.xz | |
| key: wasm-${{ steps.get-time.outputs.time }} | |
| restore-keys: wasm- | |
| - name: Unpack cache | |
| run: cd ~ && [ -f ccache.tar.xz ] && tar xf ccache.tar.xz || true | |
| - name: Checkout Repository | |
| uses: actions/checkout@v6 | |
| with: | |
| submodules: true | |
| - name: Install Dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install --no-install-recommends -y cmake ninja-build ccache | |
| - name: Build | |
| run: | | |
| ./platforms/emscripten/build.sh \ | |
| -DCMAKE_C_COMPILER_LAUNCHER=ccache \ | |
| -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \ | |
| -DWERROR=ON | |
| - name: Pack cache | |
| run: cd ~ && tar cJf ccache.tar.xz .cache/ccache | |
| macos: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - name: SDL 2 | |
| backend_name: 'SDL2' | |
| packages: 'sdl2' | |
| - name: SDL 1.2 | |
| backend_name: 'SDL1' | |
| packages: 'sdl12-compat' | |
| name: macOS (${{ matrix.name }}) | |
| runs-on: macos-26 | |
| steps: | |
| - name: Checkout Repository | |
| uses: actions/checkout@v6 | |
| with: | |
| submodules: true | |
| - name: Install Dependencies | |
| run: brew install ${{ matrix.packages }} | |
| - name: Build macOS Archive | |
| run: | | |
| cd projects/xcode | |
| xcodebuild -scheme "NBCraftClient.${{ matrix.backend_name }}" \ | |
| -archivePath $RUNNER_TEMP/GitHubActions_MacOS_${{ matrix.backend_name }}.xcarchive \ | |
| -sdk macosx \ | |
| -configuration "Release [${{ matrix.backend_name }}] (Default)" \ | |
| -destination generic/platform=macOS \ | |
| GCC_PREPROCESSOR_DEFINITIONS='$(GCC_PREPROCESSOR_DEFINITIONS)' \ | |
| ARCHS=arm64 \ | |
| -quiet \ | |
| clean archive | |
| ios: | |
| strategy: | |
| fail-fast: false | |
| name: iOS | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - name: Checkout Repository | |
| uses: actions/checkout@v6 | |
| with: | |
| submodules: true | |
| - name: Get Time | |
| id: get-time | |
| run: echo "time=$(date -u '+%Y-%m-%d-%H:%M:%S')" >> $GITHUB_OUTPUT | |
| - uses: actions/cache@v5 | |
| with: | |
| path: ~/ccache.tar.xz | |
| key: ios-${{ steps.get-time.outputs.time }} | |
| restore-keys: ios- | |
| - name: Unpack cache | |
| run: | | |
| cd ~ | |
| [ -f ccache.tar.xz ] && tar xf ccache.tar.xz || true | |
| [ -f workspacecache.tar ] && mv workspacecache.tar ${{ github.workspace }} || true | |
| - name: Install Dependencies | |
| run: | | |
| wget https://apt.llvm.org/llvm.sh | |
| sudo bash llvm.sh 21 | |
| sudo apt-get update | |
| sudo apt-get install --no-install-recommends -y \ | |
| cmake \ | |
| ccache \ | |
| clang-21 \ | |
| libplist-utils \ | |
| libplist-dev \ | |
| libssl-dev | |
| - name: Build | |
| run: | | |
| [ -f workspacecache.tar ] && tar xf workspacecache.tar || true | |
| ./platforms/ios/build.sh | |
| tar cf workspacecache.tar platforms/ios/build/work/toolchain | |
| mv workspacecache.tar ~ | |
| env: | |
| CLANG: clang-21 | |
| AR: llvm-ar-21 | |
| RANLIB: llvm-ranlib-21 | |
| LLVM_CONFIG: llvm-config-21 | |
| NBC_NO_IPA: 1 | |
| WERROR: ON | |
| - name: Pack cache | |
| run: cd ~ && tar cJf ccache.tar.xz .cache/ccache workspacecache.tar | |
| android: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - name: SDL 2 | |
| directory: platforms/sdl/sdl2/android | |
| - name: Native | |
| directory: platforms/android/project | |
| name: Android (${{ matrix.name }}) | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - name: Get Time | |
| id: get-time | |
| run: echo "time=$(date -u '+%Y-%m-%d-%H:%M:%S')" >> $GITHUB_OUTPUT | |
| - uses: actions/cache@v5 | |
| with: | |
| path: ~/ccache.tar.xz | |
| key: android-${{ matrix.name }}-${{ steps.get-time.outputs.time }} | |
| restore-keys: android- | |
| - name: Unpack cache | |
| run: cd ~ && [ -f ccache.tar.xz ] && tar xf ccache.tar.xz || true | |
| - name: Checkout Repository | |
| uses: actions/checkout@v6 | |
| with: | |
| submodules: true | |
| - name: Setup JDK | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: '17' | |
| distribution: 'temurin' | |
| cache: gradle | |
| - name: Install Dependencies | |
| run: sudo apt-get install --no-install-recommends -y ccache | |
| - name: Build | |
| run: | | |
| cd ${{ matrix.directory }} | |
| ./gradlew assembleDebug -Pandroid.injected.build.abi=arm64-v8a | |
| env: | |
| USE_CCACHE: 1 | |
| CCACHE_COMPILERCHECK: "%compiler% -v" | |
| - name: Pack cache | |
| run: cd ~ && tar cJf ccache.tar.xz .cache/ccache | |
| mingw: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - name: Win32 (OGL) | |
| flags: '-DNBC_PLATFORM=windows -DNBC_GFX_API=OGL' | |
| - name: Win32 (OGL + Shaders) | |
| flags: '-DNBC_PLATFORM=windows -DNBC_GFX_API=OGL_SHADERS' | |
| - name: Win32 (D3D11) | |
| flags: '-DNBC_PLATFORM=windows -DNBC_GFX_API=D3D11' | |
| - name: SDL2 | |
| flags: "-DNBC_PLATFORM=sdl2 -DNBC_GFX_API=OGL" | |
| # CMake can't find it | |
| #- name: SDL 1.2 | |
| # flags: '-DNBC_PLATFORM=sdl1 -DNBC_GFX_API=OGL' | |
| name: MinGW-w64 (${{ matrix.name }}) | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - name: Get Time | |
| id: get-time | |
| run: echo "time=$(date -u '+%Y-%m-%d-%H:%M:%S')" >> $GITHUB_OUTPUT | |
| - uses: actions/cache@v5 | |
| with: | |
| path: ~/ccache.tar.xz | |
| key: mingw-${{ steps.get-time.outputs.time }} | |
| restore-keys: mingw- | |
| - name: Unpack cache | |
| run: cd ~ && [ -f ccache.tar.xz ] && tar xf ccache.tar.xz || true | |
| - name: Checkout Repository | |
| uses: actions/checkout@v6 | |
| with: | |
| submodules: true | |
| - name: Install Dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install --no-install-recommends -y \ | |
| build-essential \ | |
| cmake ninja-build \ | |
| ccache \ | |
| mingw-w64 | |
| - name: Build | |
| run: | | |
| mkdir build | |
| cd build | |
| cmake .. -GNinja \ | |
| -DCMAKE_C_COMPILER_LAUNCHER=ccache \ | |
| -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \ | |
| -DWERROR=ON \ | |
| -DCMAKE_TOOLCHAIN_FILE=../cmake/mingw-w64-toolchain.cmake \ | |
| ${{ matrix.flags }} | |
| cmake --build . | |
| - name: Pack cache | |
| run: cd ~ && tar cJf ccache.tar.xz .cache/ccache | |
| switch: | |
| name: Nintendo Switch | |
| runs-on: ubuntu-24.04 | |
| container: | |
| image: devkitpro/devkita64@sha256:7ca6fb93e8f576a65bbfe07b537b67664a974e06eabe4e94359e3e026a0f0b0c | |
| steps: | |
| - name: Get Time | |
| id: get-time | |
| run: echo "time=$(date -u '+%Y-%m-%d-%H:%M:%S')" >> $GITHUB_OUTPUT | |
| - uses: actions/cache@v5 | |
| with: | |
| path: ~/ccache.tar.xz | |
| key: switch-${{ steps.get-time.outputs.time }} | |
| restore-keys: switch- | |
| - name: Unpack cache | |
| run: cd ~ && [ -f ccache.tar.xz ] && tar xf ccache.tar.xz || true | |
| - name: Checkout Repository | |
| uses: actions/checkout@v6 | |
| with: | |
| submodules: true | |
| - name: Install Dependencies | |
| run: apt-get install --no-install-recommends -y ccache | |
| - name: Build Switch binary | |
| run: | | |
| mkdir build | |
| cd build | |
| /opt/devkitpro/portlibs/switch/bin/aarch64-none-elf-cmake .. -GNinja \ | |
| -DCMAKE_C_COMPILER_LAUNCHER=ccache \ | |
| -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \ | |
| -DWERROR=ON | |
| /opt/devkitpro/portlibs/switch/bin/aarch64-none-elf-cmake --build . | |
| - name: Pack cache | |
| run: cd ~ && tar cJf ccache.tar.xz .cache/ccache | |
| windows: | |
| name: MSVC (Win32 (OGL)) | |
| runs-on: windows-2025 | |
| steps: | |
| - name: Checkout Repository | |
| uses: actions/checkout@v6 | |
| with: | |
| submodules: true | |
| - uses: ilammy/msvc-dev-cmd@v1 | |
| - name: Build | |
| run: msbuild NBCraftClient.Win32\NBCraftClient.Win32.vcxproj /p:PlatformToolset=v143 /p:Configuration=Debug | |
| working-directory: projects/visual-studio |