godot-cpp-template
godot-cpp-template copied to clipboard
Refactor SConstruct, and add scu_build option.
The refactor aims to to separate library-specific options from those concerned with the build target. In this design, SConstruct exists to provide an 'unopinionated' framework between godot-cpp and the gdextension, which most gdextensions will share, while gdextension.py can be freely modified to fit the project.
I don't think the new structure is perfect yet, but I do prefer it to the structure we have currently, where SConstruct is kind of difficult to avoid messing up. The new structure roughly mimics the structure of the godot-cpp SConstruct, where most of the actual information is in godotcpp.py.
Add single compilation unit tool and option (scu_build). This option mimics godot's own scu_build option: It compiles the whole project as a single cpp file. This can improve binary size and speed, if supported by the project.
Finally, there is a change to how localEnv is handled: Any options or modifications applied to the gdextension env now do not affect godot-cpp (unless specified explicitly). For example, in my own project I compile with -DXTENSOR_USE_XSIMD. This used to be passed to all godot-cpp files too, which is of course nonsense. By cloning the godot-cpp env, you can modify the new env flags without affecting godot-cpp compilation. Loosely, this mimics how SCSubs are handled in godot upstream.
Making this a draft while I figure out current issues with the build, while striving to keep godot-cpp-template simple.