Skip to content

Commit

Permalink
Merge pull request #62 from grunt-lucas/meta/cmake-build
Browse files Browse the repository at this point in the history
Refactor build system to use CMake
  • Loading branch information
grunt-lucas authored Oct 14, 2024
2 parents 7308b30 + 90ef933 commit 439c7dd
Show file tree
Hide file tree
Showing 1,054 changed files with 134 additions and 321 deletions.
64 changes: 42 additions & 22 deletions .github/workflows/dev_build.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,23 @@
name: Porytiles Develop Branch Build
name: Porytiles PR Build
on:
pull_request:
branches: [ "develop" ]
push:
branches: [ "develop" ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

jobs:
dev-build-linux-amd64-clang-llvm:
name: Develop branch build on linux-amd64 with Clang+LLVM 16
build-linux-amd64-clang-llvm:
name: Build on linux-amd64 with clang
runs-on: ubuntu-latest
steps:
- name: Install Clang+LLVM 16 and dependencies
- name: Install Clang+LLVM 16 and other build dependencies
run: |
sudo apt-get update
sudo apt-get install zlib1g-dev
sudo apt-get install libpng-dev
sudo apt-get install cmake
wget https://apt.llvm.org/llvm.sh
chmod +x llvm.sh
sudo ./llvm.sh 16 all
Expand All @@ -24,61 +27,78 @@ jobs:
- name: Checkout porytiles
uses: actions/checkout@v3

- name: Build debug and release executables
- name: Build the project
run: |
CXX=clang++-16 make all
cd Porytiles-1.X.X
export CXX=clang++-16
cmake -B build
cd build
cmake --build .
- name: Run tests on debug and release
- name: Run test suite
run: |
CXX=clang++-16 make check
./Porytiles-1.X.X/build/test/PorytilesTestSuite
dev-build-linux-amd64-gcc:
name: Develop branch on linux-amd64 with GCC 13
build-linux-amd64-gcc:
name: Build on linux-amd64 with gcc
# As of 14-Jun-2024 need ubuntu-24.04 since GitHub removed GCC13 from ubuntu-latest
# https://github.com/actions/runner-images/issues/9866
# TODO : move to GCC 14?
runs-on: ubuntu-24.04
steps:
- name: Install GCC 13 and dependencies
run: |
sudo apt-get update
sudo apt-get install zlib1g-dev
sudo apt-get install libpng-dev
sudo apt-get install cmake
sudo apt-get install g++-13
g++-13 --version
g++-13 -v
- name: Checkout porytiles
uses: actions/checkout@v3

- name: Build debug and release executables
- name: Build the project
run: |
CXX=g++-13 make all
cd Porytiles-1.X.X
export CXX=g++-13
cmake -B build
cd build
cmake --build .
- name: Run tests on debug and release
- name: Run test suite
run: |
CXX=g++-13 make check
./Porytiles-1.X.X/build/test/PorytilesTestSuite
dev-build-macos-aarch4-clang-llvm:
name: Develop branch on macos-aarch64 with Clang+LLVM 16
build-macos-arm64-clang-llvm:
name: Build on macos-arm64 with clang
runs-on: macos-latest
# GitHub removed Intel Mac runners, so macos-latest is now aarch64
# GitHub removed Intel Mac runners, so macos-latest is now arm64
# We don't need to install zlib since it is shipped with MacOS, CMake will find it
steps:
- name: Install Clang+LLVM 16 and dependencies
run: |
brew update
brew install zlib || true
brew install libpng || true
brew install cmake || true
brew install llvm@16 || true
/opt/homebrew/opt/llvm@16/bin/clang++ --version
/opt/homebrew/opt/llvm@16/bin/clang++ -v
- name: Checkout porytiles
uses: actions/checkout@v3

- name: Build debug and release executables
# Use -DCMAKE_FIND_FRAMEWORK=NEVER, otherwise CMake sometimes picks up outdated
# package versions deeply buried in some ancient MacOS system framework
- name: Build the project
run: |
LDFLAGS='-L/opt/homebrew/opt/llvm@16/lib/c++ -Wl,-rpath,/opt/homebrew/opt/llvm@16/lib/c++' CXXFLAGS='-I/opt/homebrew/opt/llvm@16/include/c++/v1' CXX=/opt/homebrew/opt/llvm@16/bin/clang++ make all
cd Porytiles-1.X.X
export CXX=/opt/homebrew/opt/llvm@16/bin/clang++
cmake -DCMAKE_FIND_FRAMEWORK=NEVER -B build
cd build
cmake --build .
- name: Run tests on debug and release
- name: Run test suite
run: |
LDFLAGS='-L/opt/homebrew/opt/llvm@16/lib/c++ -Wl,-rpath,/opt/homebrew/opt/llvm@16/lib/c++' CXXFLAGS='-I/opt/homebrew/opt/llvm@16/include/c++/v1' CXX=/opt/homebrew/opt/llvm@16/bin/clang++ make check
./Porytiles-1.X.X/build/test/PorytilesTestSuite
12 changes: 6 additions & 6 deletions .github/workflows/nightly_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,10 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

nightly-release-macos-aarch64:
name: Release a nightly dynamically linked macos-aarch64 binary
nightly-release-macos-arm64:
name: Release a nightly dynamically linked macos-arm64 binary
runs-on: macos-latest
# GitHub removed Intel Mac runners, so macos-latest is now aarch64
# GitHub removed Intel Mac runners, so macos-latest is now arm64
needs: [create-release-tag]
if: needs.check-already-built.outputs.last_sha != github.sha
steps:
Expand All @@ -92,20 +92,20 @@ jobs:

- name: Create release package
run: |
./script/package.sh macos-aarch64 nightly-${{github.sha}} .
./script/package.sh macos-arm64 nightly-${{github.sha}} .
- name: Create release
uses: softprops/action-gh-release@v1
with:
tag_name: nightly-${{github.sha}}
files: porytiles-macos-aarch64.zip
files: porytiles-macos-arm64.zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

prune-old-nightlies:
name: Only keep the latest nightly build
runs-on: ubuntu-latest
needs: [nightly-release-linux-amd64, nightly-release-macos-aarch64]
needs: [nightly-release-linux-amd64, nightly-release-macos-arm64]
if: needs.check-already-built.outputs.last_sha != github.sha
steps:
- uses: dev-drprasad/[email protected]
Expand Down
84 changes: 0 additions & 84 deletions .github/workflows/pr_build.yml

This file was deleted.

5 changes: 1 addition & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,11 @@
.DS_Store

# Build artifacts and executables
Porytiles-1.X.X/build/**
build/**
release/**
debug/**
*.dSYM
porytiles
porytiles.exe
porytiles-tests
porytiles-tests.exe

# LLVM coverage files
default.profraw
Expand Down
21 changes: 0 additions & 21 deletions Algo.md

This file was deleted.

Loading

0 comments on commit 439c7dd

Please sign in to comment.