-
-
Notifications
You must be signed in to change notification settings - Fork 97
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
Unify tools
/target
build type configuration to disambiguate "debug" (used for both game debugging and engine dev tools)
#3371
Comments
For the record, this is related to #1416 and would likely need to be done at the same time, as refactoring the Edit: Though realistically I'd probably start with this proposal before tackling #1416, which still needs to be further defined. |
It's not clear to me, but do we keep the individual options or do we only expose presets and those options are listed here just for explanation purpose? I think it would be useful to have individual flags available, but only active if you do not specify any preset. I.e. you either use |
In essence for this proposal these may just be internal booleans that will be registered in the We could also keep them as command line options that users can provide, but then we need to make sure that the aforementioned In other words, whatever we do for the command line interface, the first step for the buildsystem would be to parse the options, error if they're mutually exclusive indeed, and then if they're good, register them separately in booleans or a dict or whatever that would be the reference on the build config throughout the buildsystem. |
This also paves the way for something like a |
Why does "template-release" have a "-release" suffix, but "editor" does not? Would optimization being enabled include the current |
Because "editor-release" calls for "editor-debug", and this is the whole problem that this proposal aims to address. And "editor-release" would actually build with the same settings as "template-debug", which again is the whole problem here. There's only two types of builds for the editor: the main, production one, and dev builds for contributors.
Partly. I would probably make optimized builds disable debug symbols, but also
|
This comment was marked as outdated.
This comment was marked as outdated.
@aaronfranke Your example reintroduces the exact ambiguity that this proposal aims to solve. And you lack a preset for what we currently build as Debug templates, which are optimized templates with debug features. The whole point of this proposal is to make things clear and match what users and contributors are familiar with:
The other two presets are not intended for users and are only relevant for contributors who want to work on the engine itself:
Edit: One option however could be to keep only |
The distinction is because they are two completely different things, that are currently being confused by having the same name.
These two things need different names, as you may need different combinations of these. Users will typically want user debug features but NOT engine developer debugging. Thus the editor release build is built with user debugging features. The distinction is important because we also need the ability to add extra code that will only run in c++ debug builds (DEV), to add extra verification, tests etc that we don't want in the shipping builds. This can be confusing because mostly in c++ you are producing an app, you have an obvious debug build, and a release build (final product). If for example, your final product is a debugger, you then have a naming problem. You then have a debug-debugger, and a release-debugger. The same thing is happening in Godot, because we are essentially building a debugger. |
This will allow adding developer checks which will be fully compiled out in user builds, unlike `DEBUG_ENABLED` which is included in debug tempates and the editor builds. This define is not used yet, but we'll soon add code that uses it, and change some existing `DEBUG_ENABLED` checks to be performed only in dev builds. Related to godotengine/godot-proposals#3371.
I've added this to the It does not solve the ambiguity described in this proposal, which is why it's only for |
This will allow adding developer checks which will be fully compiled out in user builds, unlike `DEBUG_ENABLED` which is included in debug tempates and the editor builds. This define is not used yet, but we'll soon add code that uses it, and change some existing `DEBUG_ENABLED` checks to be performed only in dev builds. Related to godotengine/godot-proposals#3371.
This will allow adding developer checks which will be fully compiled out in user builds, unlike `DEBUG_ENABLED` which is included in debug tempates and the editor builds. This define is not used yet, but we'll soon add code that uses it, and change some existing `DEBUG_ENABLED` checks to be performed only in dev builds. Related to godotengine/godot-proposals#3371.
This will allow adding developer checks which will be fully compiled out in user builds, unlike `DEBUG_ENABLED` which is included in debug tempates and the editor builds. This define is not used yet, but we'll soon add code that uses it, and change some existing `DEBUG_ENABLED` checks to be performed only in dev builds. Related to godotengine/godot-proposals#3371.
For optimizations, we'll likely want to provide more flexibility than just the Something along the lines of what godotengine/godot-cpp#835 implemented for godot-cpp would likely be necessary to support the full range of options we already use in the codebase (and which users may want to use as override). |
Implements godotengine/godot-proposals#3371. New `target` presets ==================== The `tools` option is removed and `target` changes to use three new presets, which match the builds users are familiar with. These targets control the default optimization level and enable editor-specific and debugging code: - `editor`: Replaces `tools=yes target=release_debug`. * Defines: `TOOLS_ENABLED`, `DEBUG_ENABLED`, `-O2`/`/O2` - `template_debug`: Replaces `tools=no target=release_debug`. * Defines: `DEBUG_ENABLED`, `-O2`/`/O2` - `template_release`: Replaces `tools=no target=release`. * Defines: `-O3`/`/O2` New `dev_build` option ====================== The previous `target=debug` is now replaced by a separate `dev_build=yes` option, which can be used in combination with either of the three targets, and changes the following: - `dev_build`: Defines `DEV_ENABLED`, disables optimization (`-O0`/`/0d`), enables generating debug symbols, does not define `NDEBUG` so `assert()` works in thirdparty libraries, adds a `.dev` suffix to the binary name. Note: Unlike previously, `dev_build` defaults to off so that users who compile Godot from source get an optimized and small build by default. Engine contributors should now set `dev_build=yes` in their build scripts or IDE configuration manually. Changed binary names ==================== The name of generated binaries and object files are changed too, to follow this format: `godot.<platform>.<target>[.dev][.double].<arch>[.<extra_suffix>][.<ext>]` For example: - `godot.linuxbsd.editor.dev.arm64` - `godot.windows.template_release.double.x86_64.mono.exe` Be sure to update your links/scripts/IDE config accordingly. More flexible `optimize` and `debug_symbols` options ==================================================== The optimization level and whether to generate debug symbols can be further specified with the `optimize` and `debug_symbols` options. So the default values listed above for the various `target` and `dev_build` combinations are indicative and can be replaced when compiling, e.g.: `scons p=linuxbsd target=template_debug dev_build=yes optimize=debug` will make a "debug" export template with dev-only code enabled, `-Og` optimization level for GCC/Clang, and debug symbols. Perfect for debugging complex crashes at runtime in an exported project.
With the PR merged, should this issue be closed? |
Yes, this proposal has been fully implemented in godotengine/godot#66242. |
See godot commit 3d2dd79ecd2c8456ba9401f6b12333d01f61e13e godotengine/godot-proposals#3371 godotengine/godot#60723
Describe the project you are working on
The Godot buildsystem.
Describe the problem or limitation you are having in your project
The current Godot buildsystem uses command line options named
tools
andtarget
to configure a number of things. Not all combinations oftools
andtarget
are valid, and the exact meaning of the varioustarget
s (release
,release_debug
, anddebug
) is confusing to many contributors, but also especially to users who make their own custom builds.This confusion is also furthered into other Godot-related thirdparty projects such as GDNative plugins which try to replicate the Godot buildsystem.
I'll take the Linux platform as an example for what's currently confusing:
https://github.com/godotengine/godot/blob/b8c92828146ba22e2bb205da73aecc0619581829/platform/linuxbsd/detect.py#L92-L116
The
target
flag governs some semantically distinct options:-O3
or-O2
forrelease
andrelease_debug
respectively)-g3
fordebug
, and-g2
forrelease
andrelease_debug
only ifdebug_symbols=yes
)DEBUG_ENABLED
define). This is quite confusing as it's not at all related to either optimization or debug symbols (== information in C++ debugger), thisDEBUG_ENABLED
define controls a lot of code in the engine which is omitted when undefined. This enables debug templates and the editor (which are both built withtarget=release_debug
) to catch issues that would not be caught in atarget=release
template build.Moreover,
DEBUG_ENABLED
is mandatory to build the editor (tools=yes
). Sotools=yes target=release
is not possible, and it's prevented here:https://github.com/godotengine/godot/blob/b8c92828146ba22e2bb205da73aecc0619581829/SConstruct#L576-L579
Describe the feature / enhancement and how it helps to overcome the problem or limitation
Given the above problem, we have a semantic mixup in the meaning we give to "debug":
release
/production builds).I suggest to work this around by renaming the second usage to "dev" (for developer mode), and change the
target
/tools
partial matrix to a single preset system (probably still using the then uniquetarget
option).This should help better establish the relationship between the new
target
s and the actual binaries that we ship in official distributions (editor release binary (tools=yes target=release_debug
), release template (tools=no target=release
) and debug template (tools=no target=release_debug
)).Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams
I suggest a preset system like this:
The default target would be
target=editor
, i.e. users building Godot themselves would get the optimized version of the editor by default (same as the one in official builds, minus time consuming optimizations likeuse_lto=yes
).Engine contributors would have to build with
target=editor-dev
if they want to help with engine development by fixing bugs/crashes, etc. This disables optimizations, making the editor slower, but also makes it faster to build and thus iterate when writing C++ code for the engine.Export templates would be built with
target=template-release
andtarget=template-debug
for the "Release" and "Debug" templates respectively, so what you see in your export presets matches what you use for custom builds.The
target=template-dev
option would be for engine contributors who need to debug issues in export templates themselves by disabling optimizations and keeping debug symbols. This can also be used by users who need to debug e.g. a crash on Android and have a detailed stacktrace. This "dev" template can be used in place of the "debug" template in the export preset.If this enhancement will not be used often, can it be worked around with a few lines of script?
It will be used often. The current system works fine, but this should improve user-friendliness significantly.
Is there a reason why this should be core and not an add-on in the asset library?
This is the engine buildsystem, can't be third-party.
The text was updated successfully, but these errors were encountered: