Add module defines to the per-platform generated props file so VS knows which ones are enabled. #107709
+5
−0
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 insideMODULE_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 theNMakePreprocessorDefinitions
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