Skip to content

Commit

Permalink
Simplify CMakeLists.txt - Static build of SDL by default
Browse files Browse the repository at this point in the history
  • Loading branch information
jorio committed Jan 8, 2023
1 parent 2c8cf7b commit 8871dfa
Show file tree
Hide file tree
Showing 17 changed files with 370 additions and 824 deletions.
32 changes: 0 additions & 32 deletions .github/workflows/CompileCheck.yml

This file was deleted.

80 changes: 0 additions & 80 deletions .github/workflows/ReleaseBuilds.yml

This file was deleted.

84 changes: 84 additions & 0 deletions .github/workflows/release-aarch64.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
name: Make Release Builds (linux/aarch64)

on: [workflow_dispatch]

jobs:
build-linux-appimage-aarch64:
runs-on: ubuntu-20.04
timeout-minutes: 100 # this job may take up to an hour

steps:
- uses: actions/checkout@v3
with:
submodules: 'recursive'

# Create shared directory ON HOST. (If it's done within qemu, it'll be created with root permissions)
- name: Create artifacts directory shared with docker
run: |
mkdir -p "artifacts"
# QEMU can't run appimagetool-aarch64, so we have to build the AppImage on x86_64
- name: Download appimagetool
run : |
pushd artifacts
wget -q https://github.com/AppImage/AppImageKit/releases/download/13/appimagetool-x86_64.AppImage
wget -q https://github.com/AppImage/AppImageKit/releases/download/13/runtime-aarch64
chmod +x appimagetool-x86_64.AppImage
chmod +x runtime-aarch64
popd
- uses: uraimo/run-on-arch-action@v2
name: Build game via QEMU
id: buildgame
with:
arch: aarch64

# Distro must be kept in sync with `runs-on` above.
# See: https://github.com/uraimo/run-on-arch-action#supported-platforms
distro: ubuntu20.04

# (Optional) Speeds up builds by storing container images in a GitHub package registry.
githubToken: ${{ github.token }}

# Mount the artifacts directory as /artifacts in the container
dockerRunArgs: |
--volume "${PWD}/artifacts:/artifacts"
# Install build tools for the game and SDL build dependencies.
# See: https://github.com/libsdl-org/SDL/blob/main/docs/README-linux.md (last updated for SDL 2.26.0)
install: |
apt update -y
apt install -y build-essential cmake
#apt install -y libsdl2-dev #----- for quick testing
apt install -y libasound2-dev libpulse-dev \
libaudio-dev libjack-dev libsndio-dev libsamplerate0-dev libx11-dev libxext-dev \
libxrandr-dev libxcursor-dev libxfixes-dev libxi-dev libxss-dev libwayland-dev \
libxkbcommon-dev libdrm-dev libgbm-dev libgl1-mesa-dev libgles2-mesa-dev \
libegl1-mesa-dev libdbus-1-dev libibus-1.0-dev libudev-dev fcitx-libs-dev
# Build the aarch64 version under dist/, then tar it up and move it to /artifacts.
# (We're not building directly in /artifacts as this would cause permission issues when moving back to the x86_64 host)
run: |
cmake -S . -B build -DCMAKE_BUILD_TYPE=RelWithDebInfo
cmake --build build
bash packaging/prepare_appimage_appdir.sh build/CandyCrisis
cd build
tar cvf /artifacts/aarch64-dist.tar ./*.AppDir
# QEMU can't run appimagetool-aarch64, so we have to build the AppImage on x86_64
- name: Create AppImage on x86_64 host
run: |
cd artifacts
tar xvf aarch64-dist.tar
APPIMAGE_INPUT=$(ls -d --indicator-style=none *.AppDir)
APPIMAGE_OUTPUT=${APPIMAGE_INPUT%.AppDir}.AppImage
echo "APPIMAGE_OUTPUT=$APPIMAGE_OUTPUT" >> $GITHUB_ENV
./appimagetool-x86_64.AppImage -v --runtime-file runtime-aarch64 --no-appstream $APPIMAGE_INPUT $APPIMAGE_OUTPUT
- name: Upload
uses: actions/upload-artifact@v3
with:
name: ${{ env.APPIMAGE_OUTPUT }}
path: artifacts/${{ env.APPIMAGE_OUTPUT }}
127 changes: 127 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
name: Make Release Builds

on: [workflow_dispatch]

jobs:
build-linux-appimage:
runs-on: ubuntu-20.04 # Use oldest distro still supported by GitHub to cover the oldest possible glibc
timeout-minutes: 20

steps:
- name: Checkout
uses: actions/checkout@v3 # Checks out repository under $GITHUB_WORKSPACE so the job can access it
with:
submodules: 'recursive'

- name: Get CPU count
run: |
NPROC=$(python3 -c 'import multiprocessing; print(multiprocessing.cpu_count())')
echo "NPROC=$NPROC" >> $GITHUB_ENV
echo CPU count = $NPROC
- name: Get build dependencies for SDL from APT # cf. https://github.com/libsdl-org/SDL/blob/main/docs/README-linux.md
run: |
sudo apt update
sudo apt install -y libasound2-dev libpulse-dev \
libaudio-dev libjack-dev libsndio-dev libsamplerate0-dev libx11-dev libxext-dev \
libxrandr-dev libxcursor-dev libxfixes-dev libxi-dev libxss-dev libwayland-dev \
libxkbcommon-dev libdrm-dev libgbm-dev libgl1-mesa-dev libgles2-mesa-dev \
libegl1-mesa-dev libdbus-1-dev libibus-1.0-dev libudev-dev fcitx-libs-dev
- name: Configure
run: cmake -S . -B build -DCMAKE_BUILD_TYPE=RelWithDebInfo

- name: Build
run: cmake --build build -- -j ${{ env.NPROC }}

- name: Prepare AppDir
run: bash packaging/prepare_appimage_appdir.sh build/CandyCrisis

- name: Make AppImage
run: |
wget https://github.com/AppImage/AppImageKit/releases/download/13/appimagetool-x86_64.AppImage
chmod +x appimagetool-x86_64.AppImage
./appimagetool-x86_64.AppImage --no-appstream build/CandyCrisis.AppDir build/CandyCrisis.AppImage
- name: Upload
uses: actions/upload-artifact@v3
with:
name: linux-build
path: build/CandyCrisis.AppImage

build-windows:
runs-on: windows-2022
timeout-minutes: 20

steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: 'recursive'

- name: Configure
run: cmake -S . -B build -G 'Visual Studio 17 2022'

- name: Build
run: cmake --build build --config Release -- -m

- name: Copy vcredist
run: |
cmake --install build --prefix build/install
copy build/install/bin/msvcp140.dll build/Release
copy build/install/bin/vcruntime140.dll build/Release
copy build/install/bin/vcruntime140_1.dll build/Release
- name: Upload
uses: actions/upload-artifact@v3
with:
name: windows-build
path: build/Release

build-macos:
runs-on: macos-11
timeout-minutes: 20

steps:
- name: Import codesigning certs
uses: apple-actions/import-codesign-certs@v1
with:
p12-file-base64: ${{ secrets.APPLE_DEVELOPER_CERTIFICATE_P12_BASE64 }}
p12-password: ${{ secrets.APPLE_DEVELOPER_CERTIFICATE_PASSWORD }}

- name: Get CPU count
run: |
NPROC=$(python3 -c 'import multiprocessing; print(multiprocessing.cpu_count())')
echo "NPROC=$NPROC" >> $GITHUB_ENV
echo CPU count = $NPROC
- name: Checkout
uses: actions/checkout@v3
with:
submodules: 'recursive'

- name: Configure
run: cmake -S . -B build -G Xcode

- name: Build
run: cmake --build build --config RelWithDebInfo -- -j ${{ env.NPROC }}

- name: Codesign
run: codesign --force --sign ${{ secrets.APPLE_DEVELOPMENT_TEAM }} --options runtime build/RelWithDebInfo/CandyCrisis.app

- name: Create dmg
run: hdiutil create -fs HFS+ -srcfolder build/RelWithDebInfo -volname "Candy Crisis" build/game.dmg

- name: Notarize
run: |
xcrun notarytool store-credentials MyNotarizationProfileName --apple-id ${{ secrets.APPLE_NOTARIZATION_USERNAME }} --password ${{ secrets.APPLE_NOTARIZATION_PASSWORD }} --team-id ${{ secrets.APPLE_DEVELOPMENT_TEAM }}
xcrun notarytool submit build/game.dmg --keychain-profile MyNotarizationProfileName --wait
- name: Staple
run: xcrun stapler staple build/game.dmg

- name: Upload
uses: actions/upload-artifact@v3
with:
name: mac-build
path: build/game.dmg
12 changes: 7 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
build-*/
cache/
cmake-build-*/
dist/
extern/
/build*
/cache
/cmake-build*
/dist
/extern

.DS_Store
Loading

0 comments on commit 8871dfa

Please sign in to comment.