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

Cleanup of OpenXR module SCons config #86537

Merged
merged 1 commit into from
Jan 25, 2024

Conversation

BastiaanOlij
Copy link
Contributor

This PR makes a few changes to the scons setup in the OpenXR modules:

  • extensions that are included depending on platform/switches have been moved into the extensions/platform
  • all *.cpp files in the extensions folder are now compiled and linked, they no longer need to be individually added
  • action_map, extensions and scene now have their own SCsub file

@BastiaanOlij BastiaanOlij added this to the 4.3 milestone Dec 27, 2023
@BastiaanOlij BastiaanOlij self-assigned this Dec 27, 2023
@BastiaanOlij BastiaanOlij requested a review from a team as a code owner December 27, 2023 03:53
@BastiaanOlij
Copy link
Contributor Author

I could use some pointers here by scons aficionados, I'm sure some of the SCsub files can be done better (cc @akien-mga ).

The main goal here was to not have to list all the extensions as we're slowly adding more.

Copy link
Contributor

@dsnopek dsnopek left a comment

Choose a reason for hiding this comment

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

Thanks!

The scons changes look great to me and I did some minimal testing, although, I'm not a scons expert, so this probably still needs feedback from the buildsystem team

#include "../action_map/openxr_interaction_profile_metadata.h"
#include "modules/openxr/action_map/openxr_interaction_profile_metadata.h"
Copy link
Contributor

@dsnopek dsnopek Dec 30, 2023

Choose a reason for hiding this comment

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

This may be a personal preference thing, but because these includes are all within the same module, I personally like the relative includes better than the absolute. Doing a quick grep through the rest of the code, it seems like other modules also prefer including other things within the same module using relative paths. Not sure this actually matters, though :-)

Copy link
Member

Choose a reason for hiding this comment

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

The code style does demand absolute paths, and I believe it additionally caused issues with SCU

Copy link
Contributor

@dsnopek dsnopek Dec 30, 2023

Choose a reason for hiding this comment

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

Hm, ok. I guess it's one of those cases where existing code hasn't been updated to match the code style yet?

Grepping for include.*\.\. shows lots of includes for headers inside of the same driver or module. Whereas grepping for include.*modules/ only shows includes to modules from outside a given module. I don't see any current examples of a module including headers within the same module using an absolute path.

Copy link
Member

Choose a reason for hiding this comment

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

It does seem unclear, the code style should probably be updated here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm really on the fence, I agree with the absolute paths but we have started to use local paths especially with modules. It's also normal for the include file that belongs with a cpp file to not have the path.

But there doesn't seem to be much rule to it.

Here I've changed it to absolute paths because we now have extensions in the platform folder (those that are not always compiled in) and in the extensions folder (those that are always compiled), and where they include the same files I personally prefer it if the code looks similar.

When it comes to text, I'm very visual, I see patterns in what is written, so if things are different when they should be the same, it stands out like a sore thumb.

Copy link
Member

@akien-mga akien-mga Jan 3, 2024

Choose a reason for hiding this comment

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

The higher authority is me :P

But I haven't had time to review now, I'll assess soon. I can just point out that

we now have extensions in the platform folder (those that are not always compiled in) and in the extensions folder (those that are always compiled)

May be going backward with regard to the kind of encapulsation we've been striving to get with platforms and modules. It's a bit of a chicken and egg problem since both are meant to be pluggable/modular, but so far the status quo seemed to be that modules should be the most modular part that can be taken in/out at will, so it should contain its own conditionally compiled platform code.

Modules config.py include information about the env and platform so they can be configured conditionally, while platform detect.py in theory shouldn't know much about the internals of a module. It's not always been fully respected, e.g. we had some gcc optimization flags for theora set in the Linux detect.py, but I would consider this a bug nowadays.

Anyway, TIWAGOS, I haven't reviewed any of the changes in this PR yet.

But generally speaking, we strive to use relative paths within modules and platforms for their respective "own" files, with the idea that the module/platform can be renamed/removed and everything should still all compile fine.

Copy link
Member

Choose a reason for hiding this comment

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

The code style does demand absolute paths, and I believe it additionally caused issues with SCU

The code style hasn't been updated yet to take these refactorings into account:

These should be taken as the reference of how includes should be handled in modules and platforms. It's slightly convoluted, because the various aspects we're trying to convey are more complex than it looks :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've changed it to relative paths, @akien-mga if you have time to take another look and let me know if you think this is good :)

Copy link
Contributor

Choose a reason for hiding this comment

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

Looking at the current PR, I'm still seeing lots of paths starting with "modules/openxr/..." (what we've been calling "absolute", but I guess is technically still relative, but relative to the top of the Godot source code) rather than relative to source file (which we've been calling "relative").

Copy link
Contributor Author

@BastiaanOlij BastiaanOlij Jan 25, 2024

Choose a reason for hiding this comment

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

ah crap, I only checked the header files..

ok got them all this time :)

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 great to me!

@akien-mga akien-mga changed the title Cleanup of OpenXR module scons config Cleanup of OpenXR module SCons config Jan 25, 2024
Copy link
Contributor

@dsnopek dsnopek left a comment

Choose a reason for hiding this comment

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

Looks great to me!

@YuriSizov YuriSizov merged commit 1949d91 into godotengine:master Jan 25, 2024
16 checks passed
@YuriSizov
Copy link
Contributor

Thanks!

@BastiaanOlij BastiaanOlij deleted the openxr_cleanup_scons branch February 27, 2024 23:42
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.

5 participants