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 support for custom build tools and platforms #1391

Merged
merged 1 commit into from
Feb 15, 2024

Conversation

Faless
Copy link
Contributor

@Faless Faless commented Feb 14, 2024

Use with:

scons platform=os2 custom_tools=/path/to/tools

(assuming you have an os2.py inside /path/to/tools/)

E.g.:

# /path/to/tools/os2.py
def exists(env):
    return True


def generate(env):
    if env["arch"] not in ("x86_32", "ppc32"):
        print("Only x86_32 and ppc32 are supported on OS/2. Exiting.")
        env.Exit(1)

    env["CC"] = "echo"
    env["CXX"] = "echo"
    env["AR"] = "echo"
    env["LINK"] = "echo"
    env["RC"] = "echo"
    env["RANLIB"] = "echo"

@Faless Faless added enhancement This is an enhancement on the current functionality topic:buildsystem Related to the buildsystem or CI setup labels Feb 14, 2024
@Faless Faless requested a review from a team as a code owner February 14, 2024 13:40
@Faless
Copy link
Contributor Author

Faless commented Feb 14, 2024

Some notes (for future PRs maybe):

It might be nice to be able to override the allowed architectures (though it might end up being a feature creep)

It might be nice to add the possibility to override the default platforms with custom tools (Edit: Done via the patch mentioned below)

We might want to move (some or all) the "targets.py" back into the platform tools (maybe as an import?)
The main reason is that "targets" right now ends up making assumptions on build/link flags based on the default platforms which may be wrong when using custom tools. (EDIT: Proposed in #1392)

tools/godotcpp.py Outdated Show resolved Hide resolved
Use with:

`scons platform=os2 custom_tools=/path/to/tools`

(assuming you have an `os2.py` inside `/path/to/tools/`)
Copy link
Collaborator

@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.

This looks great to me! I tested it with the os2.py example script, and it seems to be working great too :-)

@dsnopek dsnopek merged commit 349b081 into godotengine:master Feb 15, 2024
12 checks passed
@AThousandShips AThousandShips modified the milestones: 4.x, 4.3 Feb 15, 2024
@Faless Faless deleted the build/custom_tools branch February 15, 2024 16:13
@dsnopek
Copy link
Collaborator

dsnopek commented Mar 11, 2024

Cherry-picked for 4.2 in PR #1410

@dsnopek
Copy link
Collaborator

dsnopek commented Mar 11, 2024

Cherry-picked for 4.1 in PR #1411

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