Skip to content

Commit 2a62408

Browse files
Narosfire
authored andcommitted
Allow compiling orchestrator as doubles.
1 parent cc8e799 commit 2a62408

File tree

3 files changed

+16
-4
lines changed

3 files changed

+16
-4
lines changed

.github/workflows/build.yml

+8-3
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ jobs:
2929
target: template_release
3030
platform: linux
3131
arch: x86_64
32+
precision: double
3233
# - identifier: windows-debug
3334
# name: 🪟 Windows (Debug)
3435
# build_type: Debug
@@ -43,6 +44,7 @@ jobs:
4344
target: template_release
4445
platform: windows
4546
arch: x86_64
47+
precision: double
4648
# - identifier: macos-debug
4749
# name: 🍎 MacOS (Debug)
4850
# build_type: Debug
@@ -55,18 +57,21 @@ jobs:
5557
runner: macos-latest
5658
target: template_release
5759
platform: macos
60+
precision: double
5861
- identifier: android-arm64
5962
name: 🤖 Android Arm64
6063
build_type: Release
6164
runner: ubuntu-20.04
6265
platform: android
6366
arch: arm64-v8a
67+
precision: double
6468
- identifier: android-arm32
6569
name: 🤖 Android Arm32
6670
build_type: Release
6771
runner: ubuntu-20.04
6872
platform: android
6973
arch: armeabi-v7a
74+
precision: double
7075

7176
runs-on: ${{ matrix.runner }}
7277
name: ${{ matrix.name }}
@@ -106,21 +111,21 @@ jobs:
106111
if: startsWith(matrix.identifier, 'linux-') || startsWith(matrix.identifier, 'macos-')
107112
shell: sh
108113
run: |
109-
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
114+
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 -DFLOAT_PRECISION=${{ matrix.precision }}
110115
cmake --build ${{ github.workspace }}/.out-${{ matrix.identifier }} --target orchestrator -j 18
111116
112117
- name: Build Orchestrator (Windows)
113118
if: startsWith(matrix.identifier, 'windows-')
114119
shell: bash
115120
run: |
116-
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
121+
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 -DFLOAT_PRECISION=${{ matrix.precision }}
117122
cmake --build '${{ github.workspace }}/.out-${{ matrix.identifier }}' --target orchestrator -j 18
118123
119124
- name: Build Orchestrator (Android)
120125
if: startsWith(matrix.identifier, 'android-')
121126
shell: sh
122127
run: |
123-
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 }}
128+
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 }} -DFLOAT_PRECISION=${{ matrix.precision }}
124129
cmake --build ${{ github.workspace }}/.out-${{ matrix.identifier }} --target orchestrator -j 18
125130
126131
- name: Prepare addon files

CMakeLists.txt

+7
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ SET(GDEXTENSION_LIB_PATH "${CMAKE_CURRENT_SOURCE_DIR}/project/addons/orchestrato
2323
# ADD_COMPILE_DEFINITIONS(HOT_RELOAD_ENABLED)
2424
add_compile_definitions(TOOLS_ENABLED)
2525

26+
set(FLOAT_PRECISION "single" CACHE STRING "")
27+
2628
OPTION(
2729
AUTOFORMAT_SRC_ON_CONFIGURE
2830
"If enabled, clang-format will be used to format all sources in src/ during configuration"
@@ -89,6 +91,10 @@ FILE(GLOB_RECURSE gdext_sources
8991
"${CMAKE_CURRENT_SOURCE_DIR}/src/*.[hc]pp"
9092
)
9193

94+
if ("${FLOAT_PRECISION}" STREQUAL "double")
95+
add_compile_definitions(REAL_T_IS_DOUBLE)
96+
endif()
97+
9298
# GDExtension library
9399
ADD_LIBRARY(${PROJECT_NAME} SHARED ${gdext_sources})
94100

@@ -100,6 +106,7 @@ TARGET_COMPILE_OPTIONS(${PROJECT_NAME} PUBLIC
100106
$<${compiler_is_msvc}:
101107
/EHsc
102108
/utf-8
109+
$<$<STREQUAL:${FLOAT_PRECISION},double>:/DREAL_T_IS_DOUBLE>
103110
/Zc:preprocessor
104111
/wd5054 # operator '|' deprecated between enumerations of different types
105112
$<$<CONFIG:Debug>:

0 commit comments

Comments
 (0)