Skip to content

Commit

Permalink
Allow compiling orchestrator as doubles.
Browse files Browse the repository at this point in the history
  • Loading branch information
Naros authored and fire committed Jun 30, 2024
1 parent cc8e799 commit 45a65a0
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 deletions.
11 changes: 8 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ jobs:
target: template_release
platform: linux
arch: x86_64
precision: double
# - identifier: windows-debug
# name: 🪟 Windows (Debug)
# build_type: Debug
Expand All @@ -43,6 +44,7 @@ jobs:
target: template_release
platform: windows
arch: x86_64
precision: double
# - identifier: macos-debug
# name: 🍎 MacOS (Debug)
# build_type: Debug
Expand All @@ -55,18 +57,21 @@ jobs:
runner: macos-latest
target: template_release
platform: macos
precision: double
- identifier: android-arm64
name: 🤖 Android Arm64
build_type: Release
runner: ubuntu-20.04
platform: android
arch: arm64-v8a
precision: double
- identifier: android-arm32
name: 🤖 Android Arm32
build_type: Release
runner: ubuntu-20.04
platform: android
arch: armeabi-v7a
precision: double

runs-on: ${{ matrix.runner }}
name: ${{ matrix.name }}
Expand Down Expand Up @@ -106,21 +111,21 @@ jobs:
if: startsWith(matrix.identifier, 'linux-') || startsWith(matrix.identifier, 'macos-')
shell: sh
run: |
cmake -B ${{ github.workspace }}/.out-${{ matrix.identifier }} -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_C_COMPILER_LAUNCHER=ccache -S ${{ github.workspace }} -G Ninja
cmake -B ${{ github.workspace }}/.out-${{ matrix.identifier }} -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_C_COMPILER_LAUNCHER=ccache -S ${{ github.workspace }} -G Ninja -DGODOT_FLOAT_PRECISION=${{ matrix.precision }}
cmake --build ${{ github.workspace }}/.out-${{ matrix.identifier }} --target orchestrator -j 18
- name: Build Orchestrator (Windows)
if: startsWith(matrix.identifier, 'windows-')
shell: bash
run: |
cmake -B '${{ github.workspace }}/.out-${{ matrix.identifier }}' -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER=cl -DCMAKE_C_COMPILER=cl -S '${{ github.workspace }}' -G Ninja
cmake -B '${{ github.workspace }}/.out-${{ matrix.identifier }}' -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER=cl -DCMAKE_C_COMPILER=cl -S '${{ github.workspace }}' -G Ninja -DGODOT_FLOAT_PRECISION=${{ matrix.precision }}
cmake --build '${{ github.workspace }}/.out-${{ matrix.identifier }}' --target orchestrator -j 18
- name: Build Orchestrator (Android)
if: startsWith(matrix.identifier, 'android-')
shell: sh
run: |
cmake -B ${{ github.workspace }}/.out-${{ matrix.identifier }} -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DCMAKE_ANDROID_ARCH_ABI=${{ matrix.arch }} -DANDROID_ABI=${{ matrix.arch }} -DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK/build/cmake/android.toolchain.cmake -DANDROID_TOOLCHAIN_NAME=arm-linux-androideabi-4.9 -DANDROID_PLATFORM=android-23 -DANDROID_TOOLCHAIN=clang -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_C_COMPILER_LAUNCHER=ccache -S ${{ github.workspace }}
cmake -B ${{ github.workspace }}/.out-${{ matrix.identifier }} -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DCMAKE_ANDROID_ARCH_ABI=${{ matrix.arch }} -DANDROID_ABI=${{ matrix.arch }} -DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK/build/cmake/android.toolchain.cmake -DANDROID_TOOLCHAIN_NAME=arm-linux-androideabi-4.9 -DANDROID_PLATFORM=android-23 -DANDROID_TOOLCHAIN=clang -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_C_COMPILER_LAUNCHER=ccache -S ${{ github.workspace }} -DGODOT_FLOAT_PRECISION=${{ matrix.precision }}
cmake --build ${{ github.workspace }}/.out-${{ matrix.identifier }} --target orchestrator -j 18
- name: Prepare addon files
Expand Down
7 changes: 7 additions & 0 deletions 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(GODOT_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 @@ -89,6 +91,10 @@ FILE(GLOB_RECURSE gdext_sources
"${CMAKE_CURRENT_SOURCE_DIR}/src/*.[hc]pp"
)

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

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

Expand All @@ -100,6 +106,7 @@ TARGET_COMPILE_OPTIONS(${PROJECT_NAME} PUBLIC
$<${compiler_is_msvc}:
/EHsc
/utf-8
$<$<STREQUAL:${GODOT_FLOAT_PRECISION},double>:/DREAL_T_IS_DOUBLE>
/Zc:preprocessor
/wd5054 # operator '|' deprecated between enumerations of different types
$<$<CONFIG:Debug>:
Expand Down
2 changes: 1 addition & 1 deletion extern/godot-engine

0 comments on commit 45a65a0

Please sign in to comment.