Skip to content

Add module defines to the per-platform generated props file so VS knows which ones are enabled. #107709

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

Merged
merged 1 commit into from
Jun 20, 2025

Conversation

shana
Copy link
Contributor

@shana shana commented Jun 19, 2025

The modules_enabled.gen.h header containing the defines for the enabled modules is only generated on build, not during VS project generation, and it only reflects the list of modules enabled for the target and platform that was built most recently. That means that when you generate a project the first time, any code inside #ifdef MODULE_XXX_ENABLED will be shown as disabled, even if that module is actually enabled in the build, since the header doesn't exist yet. Additionally, if you generate the VS project with multiple targets and platforms, code inside MODULE_XXX_ENABLED conditions won't show up properly if the selected VS configuration doesn't match the most recent build target+platform combo, since the header only reflects the modules enabled on the latest build configuration.

This adds those defines to the VSHINT_DEFINES array, which goes into the NMakePreprocessorDefinitions property of per-platform generated props file that the project includes. This way, VS will have a better idea of the defines that are available and wil be able to render more better.

It's not a 100% accurate solution, because the generated header is still loaded and the list in it might not match the currently selected VS configuration. But, at least this guarantees that all modules that are enabled in the currently selected VS configuration will have their defines available to VS, making the code view more accurate.

/cc @akien-mga @Repiteo

@shana shana requested a review from a team as a code owner June 19, 2025 12:26
@shana shana force-pushed the shana/vs-module-defines branch from f821240 to 196d4d2 Compare June 19, 2025 12:27
@shana shana force-pushed the shana/vs-module-defines branch from 196d4d2 to 87a7c1d Compare June 19, 2025 12:43
@shana
Copy link
Contributor Author

shana commented Jun 19, 2025

Note: the force-pushes here are just me rebasing on the newest master, I was behind in my local history and CI doesn't like building stuff that old, apparently.

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.

The rationale makes sense to me and the change is pretty straightforward.

@akien-mga akien-mga modified the milestones: 4.x, 4.5 Jun 19, 2025
@Repiteo Repiteo merged commit 4de0f1b into godotengine:master Jun 20, 2025
20 checks passed
@Repiteo
Copy link
Contributor

Repiteo commented Jun 20, 2025

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants