Skip to content

Commit

Permalink
Merge pull request #54 from GeniusVentures/actions-exploring
Browse files Browse the repository at this point in the history
Fixed builds for OSX, iOS, Android, Windows and sped them up
  • Loading branch information
EduMenges committed Jul 5, 2024
2 parents 00a95c9 + 05f33bd commit 2b2ee1f
Show file tree
Hide file tree
Showing 62 changed files with 3,269 additions and 302,728 deletions.
8 changes: 8 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Run this command to always ignore formatting commits in `git blame`
# git config blame.ignoreRevsFile .git-blame-ignore-revs

# Reformats
add3afe37be3f3e08f1139363d3c02270d21512d

# Documentation
4adbe3e8e55760ff78c38e455fa0cb45d6fcee01
124 changes: 43 additions & 81 deletions .github/workflows/Android-cmake.yml
Original file line number Diff line number Diff line change
@@ -1,87 +1,49 @@
# This is a basic workflow to help you get started with Actions

name: Android Build

# Controls when the workflow will run
# Triggers the workflow on push or pull request events and manually from the Actions tab
on:
push:
branches:
- master
paths-ignore:
- 'README.md'
- '.github/workflows/**'
- '.gitignore'
pull_request:
workflow_dispatch:

env:
CMAKE_BUILD_PARALLEL_LEVEL: 8

jobs:
Android:
runs-on: ubuntu-latest
env:
ANDROID_NDK_HOME: ${{github.workspace}}/android-ndk/android-ndk-r25b
ANDROID_TOOLCHAIN: ${{github.workspace}}/android-ndk/android-ndk-r25b/toolchains/llvm/prebuilt/linux-x86_64/bin
NDK_URL: "https://dl.google.com/android/repository/android-ndk-r25b-linux.zip"
MAKEFLAGS: "-j 8"

steps:
- name: Setup Git to make sure crlf -> lf
run: |
git config --global core.autocrlf false
git config --global core.eol lf
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
with:
submodules: 'recursive'

#- uses: nttld/setup-ndk@v1
# id: setup-ndk
# with:
# ndk-version: r21e

- name: Download Android NDK
run: |
mkdir "${{github.workspace}}/android-ndk"
cd "${{github.workspace}}/android-ndk"
curl -o ndk.zip ${{ env.NDK_URL }}
unzip ndk.zip
rm ndk.zip
- name: Install Rust dependencies
run: |
rustup update
rustup toolchain install stable
rustup default stable
rustup target add aarch64-linux-android armv7-linux-androideabi x86_64-linux-android i686-linux-android
cargo install cbindgen
- name: Create Build Directory
run: cmake -E make_directory ${{github.workspace}}/.build

- name: Set PATH
run: echo "${{env.ANDROID_TOOLCHAIN}}" >> $GITHUB_PATH

- name: Configure CMake
env:
CC: clang

working-directory: ${{github.workspace}}/.build
run: |
export ANDROID_NDK=${{env.ANDROID_NDK_HOME}}
export ANDROID_NDK_HOME=${{env.ANDROID_NDK_HOME}}
export ANDROID_TOOLCHAIN=${{env.ANDROID_TOOLCHAIN}}
echo $PATH
export PATH=${{env.ANDROID_TOOLCHAIN}}:$PATH
echo $PATH
echo $CC
ls -la $ANDROID_TOOLCHAIN
echo "Check clang path:"
which clang
env
cmake -S ../build/Android/ -DANDROID_ABI="arm64-v8a" -DCMAKE_ANDROID_NDK=$ANDROID_NDK -DANDROID_TOOLCHAIN=clang
- name: Compile
working-directory: ${{github.workspace}}/.build
run: make

build:
runs-on: ubuntu-latest
env:
ANDROID_NDK_HOME: ${{github.workspace}}/android-ndk/android-ndk-r25b
ANDROID_TOOLCHAIN: ${{github.workspace}}/android-ndk/android-ndk-r25b/toolchains/llvm/prebuilt/linux-x86_64/bin
NDK_URL: "https://dl.google.com/android/repository/android-ndk-r25b-linux.zip"

steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: "recursive"

- name: Set clang as the default compiler
run: |
sudo update-alternatives --install /usr/bin/cc cc $(which clang) 100
sudo update-alternatives --install /usr/bin/c++ c++ $(which clang++) 100
sudo update-alternatives --set cc $(which clang)
sudo update-alternatives --set c++ $(which clang++)
- name: Download Android NDK
run: |
mkdir -p "${{github.workspace}}/android-ndk"
cd "${{github.workspace}}/android-ndk"
curl -o ndk.zip ${{ env.NDK_URL }}
unzip ndk.zip
rm ndk.zip
echo "$ANDROID_TOOLCHAIN" >> $GITHUB_PATH
- name: Add Rust targets
run: rustup target add aarch64-linux-android armv7-linux-androideabi x86_64-linux-android i686-linux-android

- name: Install bindgen
run: cargo install cbindgen

- name: Install Ninja
run: sudo apt install ninja-build -y

- name: Configure CMake
run: cmake -S build/Android/ -DANDROID_ABI="arm64-v8a" -B build/Android/Release -DCMAKE_ANDROID_NDK=$ANDROID_NDK -DANDROID_TOOLCHAIN=clang -DCMAKE_BUILD_TYPE=Release -G Ninja

- name: Build project
run: cmake --build build/Android/Release --config Release -j
71 changes: 29 additions & 42 deletions .github/workflows/Linux-cmake.yml
Original file line number Diff line number Diff line change
@@ -1,49 +1,36 @@
# This is a basic workflow to help you get started with Actions

name: Linux Build

# Controls when the workflow will run
# Triggers the workflow on push or pull request events and manually from the Actions tab
on:
workflow_dispatch:

env:
CMAKE_BUILD_PARALLEL_LEVEL: 8

jobs:
Linux:
runs-on: ubuntu-latest
env:
MAKEFLAGS: "-j 8"
steps:
- name: Configure clang
run: |
sudo apt-get update && sudo apt install -y clang
sudo apt install -y libc++-dev libc++abi-dev
sudo update-alternatives --set cc /usr/bin/clang
sudo update-alternatives --set c++ /usr/bin/clang++
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
with:
submodules: 'recursive'

- name: Install Rust dependencies
run: |
rustup update
rustup toolchain install stable
rustup default stable
rustup target add x86_64-unknown-linux-gnu
rustup target add wasm32-unknown-emscripten
cargo install cbindgen
- name: Create Build Directory
run: cmake -E make_directory ${{github.workspace}}/.build

- name: Configure CMake
working-directory: ${{github.workspace}}/.build
run: cmake -S ../build/Linux/ -DCMAKE_BUILD_TYPE=Release

- name: Compile
working-directory: ${{github.workspace}}/.build
run: make
build:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: "recursive"

- name: Set clang as the default compiler
run: |
sudo update-alternatives --install /usr/bin/cc cc $(which clang) 100
sudo update-alternatives --install /usr/bin/c++ c++ $(which clang++) 100
sudo update-alternatives --set cc $(which clang)
sudo update-alternatives --set c++ $(which clang++)
- name: Add Rust target
run: rustup target add wasm32-unknown-emscripten

- name: Install Ninja
run: sudo apt install ninja-build -y

- name: Install ccache
run: sudo apt install ccache -y

- name: Configure CMake
run: cmake -S build/Linux/ -B build/Linux/Release -DCMAKE_BUILD_TYPE=Release -G Ninja

- name: Build project
run: cmake --build build/Linux/Release --config Release -j
54 changes: 14 additions & 40 deletions .github/workflows/OSX-cmake.yml
Original file line number Diff line number Diff line change
@@ -1,59 +1,33 @@
# This is a basic workflow to help you get started with Actions

name: Mac OSX Build

# Controls when the workflow will run
# Triggers the workflow on push or pull request events and manually from the Actions tab
on:
push:
branches:
- master
paths-ignore:
- 'README.md'
- '.github/workflows/**'
- '.gitignore'
pull_request:
workflow_dispatch:

env:
CMAKE_BUILD_PARALLEL_LEVEL: 8

jobs:
MacOS:
env:
MAKEFLAGS: "-j 8"
runs-on: macos-latest
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
- name: Checkout
uses: actions/checkout@v4
with:
submodules: 'recursive'

# Workaround for arm64 build
- name: Ensure latest macOS SDK is used
run: |
sudo xcode-select --switch "$(find /Applications -mindepth 1 -maxdepth 1 ! -type l | grep "Xcode_[\.0-9]*app" | sort -V | tail -1)/Contents/Developer"
sudo rm -Rf /Library/Developer/CommandLineTools/SDKs/*
submodules: "recursive"

- name: Install Rust dependencies
- name: Add Rust targets
run: |
rustup update
rustup toolchain install stable
rustup default stable
rustup target add x86_64-apple-darwin
rustup target add aarch64-apple-darwin
rustup target add wasm32-unknown-emscripten
cargo install cbindgen cargo-lipo
- name: Create Build Directory
run: |
cmake -E make_directory ${{github.workspace}}/.build
- name: Install bindgen
run: cargo install cbindgen

- name: Install Ninja
run: brew install ninja

- name: Install ccache
run: brew install ccache

- name: Configure CMake
working-directory: ${{github.workspace}}/.build
run: cmake -S ../build/OSX/ -DCMAKE_BUILD_TYPE=Release
run: cmake -S build/OSX -B build/OSX/Release -DCMAKE_BUILD_TYPE=Release -G Ninja

- name: Compile
working-directory: ${{github.workspace}}/.build
run: make

run: cmake --build build/OSX/Release --config Release -j
55 changes: 11 additions & 44 deletions .github/workflows/Windows-cmake.yml
Original file line number Diff line number Diff line change
@@ -1,58 +1,25 @@
# This is a basic workflow to help you get started with Actions

name: Windows Build

# Controls when the workflow will run
# Triggers the workflow on push or pull request events and manually from the Actions tab
on:
push:
branches:
- master
paths-ignore:
- 'README.md'
- '.github/workflows/**'
- '.gitignore'
pull_request:
workflow_dispatch:

env:
CMAKE_BUILD_PARALLEL_LEVEL: 8

jobs:
Windows:
build:
runs-on: windows-2022
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
with:
submodules: 'recursive'
- uses: GuillaumeFalourd/setup-windows10-sdk-action@v1
- name: Checkout
uses: actions/checkout@v4
with:
sdk-version: 22000
submodules: "recursive"

# Sets up the visual studio environment to build x64
- name: Configure build for Windows 10 x64
uses: ilammy/msvc-dev-cmd@v1
with:
arch: amd64
- name: Install Rust dependencies
run: |
rustup update
rustup toolchain install stable
rustup default stable
rustup set default-host x86_64-pc-windows-msvc
rustup target add x86_64-pc-windows-msvc
rustup target add wasm32-unknown-emscripten
cargo install cbindgen
- name: Add Rust target
run: rustup target add wasm32-unknown-emscripten

- name: Create Build Directory
run: cmake -E make_directory ${{github.workspace}}/.build
- name: Install ccache
run: choco install ccache -y

- name: Configure CMake
working-directory: ${{github.workspace}}/.build
run: cmake -S ../build/Windows/ -G "Visual Studio 17 2022" -A x64 -DCMAKE_BUILD_TYPE=Release -DCMAKE_SYSTEM_VERSION="10.0"

- name: Compile
working-directory: ${{github.workspace}}/.build
run: cmake --build . --config Release
run: cmake -S build/Windows -B build/Windows/Release -DCMAKE_BUILD_TYPE=Release

- name: Build project
run: cmake --build build/Windows/Release --config Release -j
Loading

0 comments on commit 2b2ee1f

Please sign in to comment.