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

Add SCons variant_dir support #1669

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Ivorforce
Copy link
Contributor

@Ivorforce Ivorforce commented Dec 10, 2024

Supersedes #1439 - it's basically just a rebase. It compiles, but I haven't checked if it does what it says it does (allow godot-cpp to be included from elsewhere).

@Ivorforce Ivorforce requested a review from a team as a code owner December 10, 2024 15:02
Copy link
Contributor Author

@Ivorforce Ivorforce left a comment

Choose a reason for hiding this comment

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

Commenting "my own" PR because so far I've only rebased. Would like to see if anybody has comments on my comments, otherwise I'll probably just adjust things as I see fet.

@Ivorforce Ivorforce force-pushed the scons-variant_dir-support branch 5 times, most recently from 537328b to 55e93ea Compare December 18, 2024 14:04
@Ivorforce
Copy link
Contributor Author

Alright, code wise, I think this is ready now.
I still haven't tested it though. Someone should probably do that before a merge (i may, but it may take a few more days).

@dsnopek dsnopek added enhancement This is an enhancement on the current functionality topic:buildsystem Related to the buildsystem or CI setup labels Jan 12, 2025
@dsnopek dsnopek added this to the 4.x milestone Jan 12, 2025
@Ivorforce Ivorforce force-pushed the scons-variant_dir-support branch 2 times, most recently from 3078526 to f60cac5 Compare January 12, 2025 16:51
@Ivorforce Ivorforce force-pushed the scons-variant_dir-support branch from f60cac5 to 1345c46 Compare January 12, 2025 17:33
@Ivorforce
Copy link
Contributor Author

Ivorforce commented Jan 29, 2025

Alright, I tested this, it seems to work.

To use it, one has to call SConscript like env = SConscript("../SConstruct", variant_dir="build_folder"). I tested this from the test project.

@dsnopek
Copy link
Collaborator

dsnopek commented Feb 18, 2025

To use it, one has to call SConscript like env = SConscript("../SConstruct", variant_dir="build_folder"). I tested this from the test project.

I tested this in the same way and it worked for me!

However, shouldn't this be an option given on the command-line, rather than something that developers hard-code into their project? Why not add this to other default options?

Also, this only seemed to affect the build artifacts from godot-cpp itself, and not the test project. What do developers need to do so that their artifacts also build in a separate directory?

@Ivorforce
Copy link
Contributor Author

Ivorforce commented Feb 18, 2025

However, shouldn't this be an option given on the command-line, rather than something that developers hard-code into their project? Why not add this to other default options?
Also, this only seemed to affect the build artifacts from godot-cpp itself, and not the test project. What do developers need to do so that their artifacts also build in a separate directory?

This would be possible! I tested this as well, and arrived at this solution:

  • Add a variant_dir command line option
  • Call the VariantDir function with the appropriate value, if passed
  • Compile <variant_dir>/* instead of src/* in godotcpp.py (or analogously, the user SConstruct)

As you observed, applying variant_dir godot-cpp side would only move godot-cpp object files, so the option would need to be added on the user side (godot-cpp-template?).

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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants