diff --git a/.github/actions/build/action.yml b/.github/actions/build/action.yml deleted file mode 100644 index 2294d2d..0000000 --- a/.github/actions/build/action.yml +++ /dev/null @@ -1,114 +0,0 @@ -name: GDExtension Build -description: Build GDExtension - -inputs: - platform: - required: true - description: Target platform. - arch: - required: true - description: Target architecture. - float-precision: - default: 'single' - description: Float precision (single or double). - build-target-type: - default: 'template_debug' - description: Build type (template_debug or template_release). - scons-cache: - default: '.scons-cache/' - description: Scons cache folder name, relative to each scons directory. Must not contain relative path signifiers (. or ..). Must be a transparent path part (empty or 'path/to/directory/', ending in a slash). - em_version: - default: 3.1.62 - description: Emscripten version. - em-cache-directory: - default: emsdk-cache - description: Emscripten cache directory. - gdextension-directory: - default: '' - description: Location of the gdextension project within the repository. Must not contain relative path signifiers (. or ..). Must be a transparent path part (empty or 'path/to/directory/', ending in a slash). - -runs: - using: composite - steps: -# Android only - - name: Android - Set up Java 17 - uses: actions/setup-java@v4 - if: ${{ inputs.platform == 'android' }} - with: - distribution: temurin - java-version: 17 - - - name: Android - Remove existing Android SDK, and set up ENV vars - if: ${{ inputs.platform == 'android' }} - shell: sh - run: | - sudo rm -r /usr/local/lib/android/sdk/** - export ANDROID_HOME=/usr/local/lib/android/sdk - export ANDROID_SDK_ROOT=$ANDROID_HOME - export ANDROID_NDK_VERSION=23.2.8568313 - export ANDROID_NDK_ROOT=${ANDROID_SDK_ROOT}/ndk/${ANDROID_NDK_VERSION} - echo "ANDROID_HOME=$ANDROID_HOME" >> "$GITHUB_ENV" - echo "ANDROID_SDK_ROOT=$ANDROID_SDK_ROOT" >> "$GITHUB_ENV" - echo "ANDROID_NDK_VERSION=$ANDROID_NDK_VERSION" >> "$GITHUB_ENV" - echo "ANDROID_NDK_ROOT=$ANDROID_NDK_ROOT" >> "$GITHUB_ENV" - - - name: Android - Set up Android SDK - if: ${{ inputs.platform == 'android' }} - uses: android-actions/setup-android@v3 - with: - packages: "ndk;${{ env.ANDROID_NDK_VERSION }} cmdline-tools;latest build-tools;34.0.0 platforms;android-34 cmake;3.22.1" -# Linux only - - name: Linux - dependencies - if: ${{ inputs.platform == 'linux' }} - shell: sh - run: | - sudo apt-get update -qq - sudo apt-get install -qqq build-essential pkg-config -# Web only - - name: Web - Set up Emscripten latest - if: ${{ inputs.platform == 'web' }} - uses: mymindstorm/setup-emsdk@v14 - with: - version: ${{ inputs.em_version }} - actions-cache-folder: ${{ inputs.em-cache-directory }}.${{ inputs.float-precision }}.${{ inputs.build-target-type }} - - name: Web - Verify Emscripten setup - if: ${{ inputs.platform == 'web' }} - shell: sh - run: | - emcc -v -# Windows only - - name: Windows - Setup MinGW for Windows/MinGW build - uses: egor-tensin/setup-mingw@v2 - if: ${{ inputs.platform == 'windows' }} - with: - version: 12.2.0 -# Dependencies of godot - # Use python 3.x release (works cross platform) - - name: Set up Python 3.x - uses: actions/setup-python@v5 - with: - # Semantic version range syntax or exact version of a Python version - python-version: "3.x" - # Optional - x64 or x86 architecture, defaults to x64 - architecture: "x64" - - name: Setup scons - shell: bash - run: | - python -c "import sys; print(sys.version)" - python -m pip install scons==4.4.0 - scons --version -# Build - - name: Cache .scons_cache - uses: actions/cache@v4 - with: - path: | - ${{ github.workspace }}/${{ inputs.gdextension-directory }}${{ inputs.scons-cache }} - key: ${{ inputs.platform }}_${{ inputs.arch }}_${{ inputs.float-precision }}_${{ inputs.build-target-type }}_cache -# Build gdextension - - name: Build GDExtension Debug Build - shell: sh - env: - SCONS_CACHE: ${{ github.workspace }}/${{ inputs.gdextension-directory }}${{ inputs.scons-cache }} - run: | - scons target=${{ inputs.build-target-type }} platform=${{ inputs.platform }} arch=${{ inputs.arch }} precision=${{ inputs.float-precision }} - working-directory: ${{ inputs.gdextension-directory }} diff --git a/.github/workflows/builds.yml b/.github/workflows/builds.yml index 0f7f2aa..6a0070d 100644 --- a/.github/workflows/builds.yml +++ b/.github/workflows/builds.yml @@ -5,9 +5,6 @@ on: pull_request: merge_group: -env: - LIBNAME: example - jobs: build: strategy: @@ -260,12 +257,13 @@ jobs: # os: ubuntu-20.04 runs-on: ${{ matrix.os }} steps: + # Clone this repository - name: Checkout uses: actions/checkout@v4 with: submodules: true -# Lint + # Lint #- name: Setup clang-format # shell: bash # run: | @@ -275,16 +273,27 @@ jobs: # run: | # clang-format src/** --dry-run --Werror -# Build - - name: 🔗 GDExtension Debug Build - uses: ./.github/actions/build + # Setup dependencies + - name: Setup godot-cpp + uses: ./godot-cpp/.github/actions/setup-godot-cpp with: platform: ${{ matrix.platform }} - arch: ${{ matrix.arch }} - float-precision: ${{ matrix.float-precision }} - build-target-type: ${{ matrix.target-type }} + em-version: 3.1.62 -# Sign + # Build GDExtension (with caches) + - name: Cache .scons_cache + uses: actions/cache@v4 + with: + path: ${{ github.workspace }}/.scons-cache/ + key: ${{ matrix.platform }}_${{ matrix.arch }}_${{ matrix.float-precision }}_${{ matrix.target-type }}_cache + - name: Build GDExtension Debug Build + shell: sh + env: + SCONS_CACHE: ${{ github.workspace }}/.scons-cache/ + run: | + scons target=${{ matrix.target-type }} platform=${{ matrix.platform }} arch=${{ matrix.arch }} precision=${{ matrix.float-precision }} + + # Sign the binary (macOS only) - name: Mac Sign # Disable sign if secrets are not set if: ${{ matrix.platform == 'macos' && env.APPLE_CERT_BASE64 }} @@ -300,11 +309,14 @@ jobs: APPLE_DEV_TEAM_ID: ${{ secrets.APPLE_DEV_TEAM_ID }} APPLE_DEV_APP_ID: ${{ secrets.APPLE_DEV_APP_ID }} + # Clean up compilation files - name: Windows - Delete compilation files if: ${{ matrix.platform == 'windows' }} shell: pwsh run: | Remove-Item bin/* -Include *.exp,*.lib,*.pdb -Force + + # Upload the build - name: Upload Artifact uses: actions/upload-artifact@v4 with: diff --git a/.gitmodules b/.gitmodules index 5f8a098..1c0d850 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,4 +1,4 @@ [submodule "godot-cpp"] path = godot-cpp url = https://github.com/godotengine/godot-cpp.git - branch = 4.0 + branch = 4.3 diff --git a/README.md b/README.md index 88cce92..af70feb 100644 --- a/README.md +++ b/README.md @@ -26,121 +26,8 @@ For getting started after cloning your own copy to your local machine, you shoul ## Usage - Actions -The actions builds `godot-cpp` at a specified location, and then builds the `gdextension` at a configurable location. It builds for desktop, mobile and web and allows for configuration on what platforms you need. It also supports configuration for debug and release builds, and for double builds. - -The action uses SConstruct for both godot-cpp and the GDExtension that is built. - -To reuse the build actions, in a github actions yml file, do the following: - -```yml -name: Build GDExtension -on: - workflow_call: - push: - -jobs: - build: - strategy: - fail-fast: false - matrix: - include: - - platform: linux - arch: x86_64 - os: ubuntu-20.04 - - platform: windows - arch: x86_32 - os: windows-latest - - platform: windows - arch: x86_64 - os: windows-latest - - platform: macos - arch: universal - os: macos-latest - - platform: android - arch: arm64 - os: ubuntu-20.04 - - platform: android - arch: arm32 - os: ubuntu-20.04 - - platform: android - arch: x86_64 - os: ubuntu-20.04 - - platform: android - arch: x86_32 - os: ubuntu-20.04 - - platform: ios - arch: arm64 - os: macos-latest - - platform: web - arch: wasm32 - os: ubuntu-20.04 - - runs-on: ${{ matrix.os }} - steps: - - name: Checkout - uses: actions/checkout@v4 - with: - submodules: true - - name: 🔗 GDExtension Build - uses: godotengine/godot-cpp-template/.github/actions/build@main - with: - platform: ${{ matrix.platform }} - arch: ${{ matrix.arch }} - float-precision: single - build-target-type: template_release - - name: 🔗 GDExtension Build - uses: ./.github/actions/build - with: - platform: ${{ matrix.platform }} - arch: ${{ matrix.arch }} - float-precision: ${{ matrix.float-precision }} - build-target-type: template_debug - - name: Mac Sign - if: ${{ matrix.platform == 'macos' && env.APPLE_CERT_BASE64 }} - env: - APPLE_CERT_BASE64: ${{ secrets.APPLE_CERT_BASE64 }} - uses: godotengine/godot-cpp-template/.github/actions/sign@main - with: - FRAMEWORK_PATH: bin/macos/macos.framework - APPLE_CERT_BASE64: ${{ secrets.APPLE_CERT_BASE64 }} - APPLE_CERT_PASSWORD: ${{ secrets.APPLE_CERT_PASSWORD }} - APPLE_DEV_PASSWORD: ${{ secrets.APPLE_DEV_PASSWORD }} - APPLE_DEV_ID: ${{ secrets.APPLE_DEV_ID }} - APPLE_DEV_TEAM_ID: ${{ secrets.APPLE_DEV_TEAM_ID }} - APPLE_DEV_APP_ID: ${{ secrets.APPLE_DEV_APP_ID }} - - name: Upload Artifact - uses: actions/upload-artifact@v4 - with: - name: GDExtension-${{ matrix.platform }}-${{ matrix.arch }} - path: | - ${{ github.workspace }}/bin/** - merge: - runs-on: ubuntu-latest - needs: build - steps: - - name: Merge Artifacts - uses: actions/upload-artifact/merge@v4 - with: - name: GDExtension-all - pattern: GDExtension-* - delete-merged: true -``` - -The above example is a lengthy one, so we will go through it action by action to see what is going on. - -In the `Checkout` step, we checkout the code. -In the `🔗 GDExtension Build` step, we are using the reusable action: -```yml -uses: godotengine/godot-cpp-template/.github/actions/build@main -with: - platform: ${{ matrix.platform }} - arch: ${{ matrix.arch }} - float-precision: single - build-target-type: template_release -``` -with the parameters from the matrix. - -As a result of this step, the binaries will be built in the `bin` folder (as specified in the SConstruct file). After all builds are completed, all individual builds will be merged into one common GDExtension-all zip that you can download. +This repository comes with a GitHub action that builds the GDExtension for cross-platform use. It triggers automatically for each pushed change. You can find and edit it in [builds.yml](.github/workflows/builds.yml). +After a workflow run is complete, you can find the file `godot-cpp-template.zip` on the `Actions` tab on GitHub. Note: for macos, you will have to build the binary as a `.dylib` in a `EXTENSION-NAME.framework` folder. The framework folder should also have a `Resources` folder with a file called `Info.plist`. Without this file, signing will fail. diff --git a/godot-cpp b/godot-cpp index fbbf9ec..f3a1a2f 160000 --- a/godot-cpp +++ b/godot-cpp @@ -1 +1 @@ -Subproject commit fbbf9ec4efd8f1055d00edb8d926eef8ba4c2cce +Subproject commit f3a1a2fd458dfaf4de08c906f22a2fe9e924b16f