Skip to content
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

[SCons] Add "optimize" and "debug_symbols" options. #835

Merged
merged 1 commit into from
Sep 19, 2022

Conversation

Faless
Copy link
Contributor

@Faless Faless commented Sep 11, 2022

optimize = auto|none|debug|speed|size|0|1|2|3
debug_symbol = True|False

optimize == "auto" will produce:

Depends on: #836 Merged

@Faless Faless added enhancement This is an enhancement on the current functionality topic:buildsystem Related to the buildsystem or CI setup topic:gdextension This relates to the new Godot 4 extension implementation labels Sep 11, 2022
@Faless Faless added this to the 4.0 milestone Sep 11, 2022
@Faless Faless changed the title [SCons] Add "optimize" and "debug_symbols" options [SCons] Add "optimize" and "debug_symbols" options, "release_debug" target. Sep 12, 2022
@jordo
Copy link

jordo commented Sep 12, 2022

  • Add a release_debug target.
    People seem confused by the fact that it's missing, no matter how much we explain that it's just debug + optimize.

When I first started using godot, I was completely confused by how the godot build system uses 'debug' and 'release'. It's confusing to native & c++ developers because 'debug' and 'release' build profiles in other build systems usually translate directly to compiler switches of the compiler optimization levels & debug flags.

In godot, 'debug' and 'release' build targets are completely decoupled from the native build profiles in (compiler opt level, and debug flags), which is I think where the confusion comes from. So you can do a 'release' build, with -O0 and -g. And you can do a 'debug' build, with -O3 and no debug symbols.

So the question for me has always been, what does 'debug' and 'release' even mean as a godot build target? And that question I don't think is succinctly answered in the godot development docs, which is for me where the confusion comes from.

To me, the 'debug' and 'release' build target's for godot build system really just end up translating to the ability to debug scripts, which adds a lot of additional internal engine overhead, but it's completely orthogonal to the native compilation step.

@Faless
Copy link
Contributor Author

Faless commented Sep 12, 2022

To me, the 'debug' and 'release' build target's for godot build system really just end up translating to the ability to debug scripts

@jordo , well, that's probably another misunderstanding I guess, you might want to quote those comments to this proposal which concerns godot targets: godotengine/godot-proposals#3371 .

optimize = auto|none|debug|speed|size|0|1|2|3
debug_symbol = True|False

optimize == "auto" will produce:
- "debug" for "debug" builds
- "speed" for "release" builds
@jordo
Copy link

jordo commented Sep 12, 2022

@jordo , well, that's probably another misunderstanding I guess, you might want to quote those comments to this proposal which concerns godot targets

Wait... am I still misunderstanding that or is that correct?

@Faless Faless changed the title [SCons] Add "optimize" and "debug_symbols" options, "release_debug" target. [SCons] Add "optimize" and "debug_symbols" options. Sep 12, 2022
@Faless
Copy link
Contributor Author

Faless commented Sep 12, 2022

Wait... am I still misunderstanding that or is that correct?

Well, it's not just for "debugging scripts", but (some) engine internals too, and it is not completely orthogonal to the native compilation step. because it does require some specific compiler flags e.g. -frtti, and as explained by both scons and the linked proposal the editor cannot even build in release mode (only release_debug, or optimized debug if you wish).

@jordo
Copy link

jordo commented Sep 12, 2022

Well, it's not just for "debugging scripts", but (some) engine internals too, and it is not completely orthogonal to the native compilation step. because it does require some specific compiler flags e.g. -frtti, and as explained by both scons and the linked proposal the editor cannot even build in release mode (only release_debug, or optimized debug if you wish).

OK good, that's what my current understanding is. I should have said orthogonal to the native compiler optimization level & debug level. i.e. you can do target='debug' optimize=3 debug_symbol=false, and target='release' optimize=none debug_symbol=true

@Faless
Copy link
Contributor Author

Faless commented Sep 19, 2022

you can do target='debug' optimize=3 debug_symbol=false

No, you can't target=debug debug_symbol=false with the current Godot build system, or, better, you can, but debug_symbol=false is ignored.

The description states: "Add debugging symbols to release/release_debug builds"

Copy link
Member

@akien-mga akien-mga left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me.

This goes a bit beyond what we do in upstream Godot where the optimize and debug_symbols options are tied to target, but I think we should refactor Godot's scripts to do what is done here.

@akien-mga akien-mga merged commit bef1fa0 into godotengine:master Sep 19, 2022
@akien-mga
Copy link
Member

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement This is an enhancement on the current functionality topic:buildsystem Related to the buildsystem or CI setup topic:gdextension This relates to the new Godot 4 extension implementation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants