asmaloney/GDExtensionTemplate

Setting FLOAT_PRECISION properly

BrianWiz opened this issue · 2 comments

I'm new to CMake so I'm not entirely sure if this is the best solution, I was running into issues with real_t not being set correctly on my project.

I fixed it by putting this in the main CMakeLists.txt and then using the following env when using cmake -B:
-DFLOAT_PRECISION=double

if ("${FLOAT_PRECISION}" STREQUAL "double")
	add_definitions(-DREAL_T_IS_DOUBLE)
endif()

Thanks so much for this project, it's been massively helpful.

Thanks Brian! Good catch - I've never used the doubles version of Godot, so it hadn't occurred to me.

I'll take a look and add something for this in my next release.

I submitted a fix to godot-cpp to resolve this.

godotengine/godot-cpp#1145

The correct solution is to add the define to the godot-cpp target using public target_compile_definitions. Then when that target is used, the define will come along for the ride...