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 object_prefix option #62652

Merged

Conversation

maiself
Copy link
Contributor

@maiself maiself commented Jul 2, 2022

Add object_prefix as an scons option to add a custom prefix to all generated object files, via the OBJPREFIX and SHOBJPREFIX environment variables.

This is useful for instance to hide object files on unix-like systems and make the source directories less cluttered by setting object_prefix = '.' in custom.py.

@maiself maiself requested a review from a team as a code owner July 2, 2022 23:40
@akien-mga akien-mga added this to the 4.0 milestone Jul 2, 2022
@akien-mga
Copy link
Member

This is useful for instance to hide object files on unix-like systems and make the source directories less cluttered by setting object_prefix = '.' in custom.py.

That's a pretty niche use case, I'm not sure it's worth adding an option just for this. Most IDEs will not show you the object files so the clutter shouldn't be a problem for development. And hiding several GBs worth of object files doesn't strike me as a good workflow to encourage.

@maiself
Copy link
Contributor Author

maiself commented Jul 3, 2022

Object files are intermediate artifacts, not unlike imports in .godot or a browser cache, and usually don't need to be interacted with. I'm not sure what workflow benefits from having them visible alongside source files.

scons lacks out of tree builds, prefixing object files with . is the easiest way to deal with the clutter.

I was hoping it might be useful for developers like myself who develop without an IDE. Such workflow maybe niche, but I prefer simplicity.

Alternative to this patch is hacking Environment via site_init.py which is not so simple and feels fragile.

Three lines for an option, and not a default one as to avoid affecting existing workflows, hardly seems like much to add for the gained simplicity.

I'm not extremely attached to this patch, and am fine with it not being accepted, but hope you can see how it could be beneficial and give it consideration.

@maiself maiself force-pushed the add-object-prefix-scons-option branch from 1aa8f11 to 4e7fa2d Compare July 3, 2022 02:30
@aaronfranke
Copy link
Member

It's true that this would mainly benefit people without an IDE. Really, I would recommend getting one, VS Code is free and allows you to hide .o and .a files. But if we want to support developing without an IDE, it would be nice to hide these files:

Screenshot from 2022-07-02 21-44-54

@YuriSizov YuriSizov modified the milestones: 4.0, 4.x Feb 9, 2023
@jukrb0x
Copy link

jukrb0x commented Mar 3, 2023

Indeed, CLion shows the .o files in the source tree, even though the Project Source View does help but it only shows the cpp source files such as .cpp and .h, the project requires other files like markdown, python, and configurations that are also needed in the IDEs.

In my mind, these output files can be put in separation from the source files, such as in a ${source_dir}/generated/*.o.

image

and this fix does help!

image

@dsnopek
Copy link
Contributor

dsnopek commented Oct 5, 2023

This is such a small change, and wouldn't require much maintenance, since the OBJPREFIX and SHOBJPREFIX come from scons. If folks find this useful, why not?

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.

Seems fine.

@akien-mga akien-mga modified the milestones: 4.x, 4.2 Oct 5, 2023
@akien-mga
Copy link
Member

Needs rebase.

Add `object_prefix` as an scons option to add a custom prefix to
all generated object files, via the `OBJPREFIX` and `SHOBJPREFIX`
environment variables.

This is useful for instance to hide object files on unix-like
systems and make the source directories less cluttered by
setting `object_prefix = '.'` in `custom.py`.
@maiself maiself force-pushed the add-object-prefix-scons-option branch from 4e7fa2d to a1e5ab6 Compare October 5, 2023 18:50
@akien-mga akien-mga changed the title Add object_prefix scons option SCons: Add object_prefix option Oct 5, 2023
@akien-mga akien-mga merged commit ee32ddb into godotengine:master Oct 5, 2023
15 checks passed
@akien-mga
Copy link
Member

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.

6 participants