Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ci] Add new double builds #770

Draft
wants to merge 8 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
89 changes: 68 additions & 21 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,49 +11,56 @@ concurrency:

jobs:
build:
name: ${{ matrix.name }}
runs-on: ${{ matrix.runner }}
strategy:
fail-fast: false
matrix:
include:
- identifier: linux-release
name: 🐧 Linux
build_type: Release
- name: 🐧 Linux
identifier: linux-release
runner: ubuntu-20.04
platform: linux
arch: x86_64
precision: single

- name: 🐧 Linux (Double Precision)
identifier: linux-double-release
runner: ubuntu-20.04
target: template_release
platform: linux
arch: x86_64
precision: double

- identifier: windows-release
name: 🪟 Windows
build_type: Release
- name: 🪟 Windows
identifier: windows-release
runner: windows-latest
target: template_release
platform: windows
arch: x86_64
precision: single

- identifier: macos-release
name: 🍎 MacOS
build_type: Release
- name: 🍎 MacOS
identifier: macos-release
runner: macos-latest
target: template_release
platform: macos
precision: single

- identifier: android-arm64
name: 🤖 Android (arm64)
build_type: Release
- name: 🤖 Android (arm64)
identifier: android-arm64
runner: ubuntu-20.04
platform: arm64-v8a
arch: arm64-v8a
precision: single

- identifier: android-arm32
name: 🤖 Android (arm32)
build_type: Release
- name: 🤖 Android (arm32)
identifier: android-arm32
runner: ubuntu-20.04
platform: armeabi-v7a
arch: armeabi-v7a
precision: single

runs-on: ${{ matrix.runner }}
name: ${{ matrix.name }}
env:
SCONS_CACHE: ${{ github.workspace }}/.scons-cache/
BUILD_NAME: official

steps:

Expand Down Expand Up @@ -86,10 +93,50 @@ jobs:
with:
key: ccache-${{ matrix.identifier }}

- name: Restore scons cache
if: ${{ matrix.precision == 'double' }}
uses: actions/cache/restore@v4
with:
path: ${{ github.workspace }}/.scons-cache/
key: ${{ matrix.identifier }}-scons-${{ github.ref }}-${{ github.sha }}
restore-keys: |
${{ matrix.identifier }}-scons-${{ github.ref }}-${{ github.sha }}
${{ matrix.identifier }}-scons-${{ github.ref }}
${{ matrix.identifier }}-scons

- name: Compile Godot (Double Precision)
if: ${{ matrix.precision == 'double' }}
shell: sh
working-directory: ./extern/godot-engine
run: |
scons precision=double

- name: Save scons cache
if: ${{ matrix.precision == 'double' }}
uses: actions/cache/save@v4
with:
path: ${{ github.workspace }}/.scons-cache/
key: ${{ matrix.identifier }}-scons-${{ github.ref }}-${{ github.sha }}

- name: Dump API
if: ${{ matrix.precision == 'double' }}
shell: sh
working-directory: ./extern/godot-engine/bin
run: |
./godot.linuxbsd.editor.double.x86_64 --headless --dump-gdextension-interface
./godot.linuxbsd.editor.double.x86_64 --headless --dump-extension-api

- name: Prepare double precision
if: ${{ matrix.precision == 'double' }}
shell: sh
run: |
cp 'extern/godot-engine/bin/extension_api.json' 'extern/godot-cpp/gdextension/extension_api.json'
cp 'extern/godot-engine/bin/gdextension_interface.h' 'extern/godot-cpp/gdextension/gdextension_interface.h'

- name: Generate Build Files (${{ matrix.identifier }})
shell: sh
run: |
cmake -B '${{ github.workspace }}/.out-${{ matrix.identifier }}' --preset ${{ matrix.platform }} -S '${{ github.workspace }}'
cmake -B '${{ github.workspace }}/.out-${{ matrix.identifier }}' --preset ${{ matrix.platform }} -S '${{ github.workspace }}' -DFLOAT_PRECISION=${{ matrix.precision }}

- name: Build Orchestrator (${{ matrix.identifier }})
shell: sh
Expand Down
13 changes: 12 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ SET(GDEXTENSION_LIB_PATH "${CMAKE_CURRENT_SOURCE_DIR}/project/addons/orchestrato
# ADD_COMPILE_DEFINITIONS(HOT_RELOAD_ENABLED)
add_compile_definitions(TOOLS_ENABLED)

set(FLOAT_PRECISION "single" CACHE STRING "")

OPTION(
AUTOFORMAT_SRC_ON_CONFIGURE
"If enabled, clang-format will be used to format all sources in src/ during configuration"
Expand Down Expand Up @@ -93,6 +95,10 @@ FILE(GLOB_RECURSE gdext_sources
"${CMAKE_BINARY_DIR}/_generated/*.cpp"
)

if ("${FLOAT_PRECISION}" STREQUAL "double")
add_compile_definitions(REAL_T_IS_DOUBLE)
endif()

# GDExtension library
ADD_LIBRARY(${PROJECT_NAME} SHARED ${gdext_sources})

Expand All @@ -104,6 +110,7 @@ TARGET_COMPILE_OPTIONS(${PROJECT_NAME} PUBLIC
$<${compiler_is_msvc}:
/EHsc
/utf-8
$<$<STREQUAL:${FLOAT_PRECISION},double>:/DREAL_T_IS_DOUBLE>
/Zc:preprocessor
/wd5054 # operator '|' deprecated between enumerations of different types
$<$<CONFIG:Debug>:
Expand Down Expand Up @@ -186,7 +193,11 @@ ELSE ()
ENDIF ()
ENDIF ()

STRING(TOLOWER "${PROJECT_NAME}.${CMAKE_SYSTEM_NAME}.${system_bits}.${CMAKE_BUILD_TYPE}" gde_lib_name)
if ("${FLOAT_PRECISION}" STREQUAL "double")
STRING(TOLOWER "${PROJECT_NAME}.${CMAKE_SYSTEM_NAME}.${system_bits}.double.${CMAKE_BUILD_TYPE}" gde_lib_name)
ELSE ()
STRING(TOLOWER "${PROJECT_NAME}.${CMAKE_SYSTEM_NAME}.${system_bits}.${CMAKE_BUILD_TYPE}" gde_lib_name)
ENDIF ()

# Generate library resource
IF(WIN32)
Expand Down
Loading