Skip to content

SCons warning message with custom variables #1334

Open
@Kehom

Description

@Kehom

Godot version

4.2

godot-cpp version

4.2

System information

Windows 10 and Linux Mint

Issue description

SCons provides means for us to add custom variables and easily parse them within the build script. I started to explore this to give users options to disable certain parts of addon. While the build did work, I got the WARNING: Unknown SCons variables were passed and will be ignored message. Because I'm learning SCons this made me extremely confused, specially because I couldn't find any help regarding this error.

Upon digging up I did find this in the godot-cpp SConstruct script:

unknown = opts.UnknownVariables()
if unknown:
    print("WARNING: Unknown SCons variables were passed and will be ignored:")
    for item in unknown.items():
        print("    " + item[0] + "=" + item[1])

Ahhh, that's where the message is coming from! Since I still can deal with the extra variables and generate the expected binary I'm aware that I can safely ignore that warning message. However I think anyone attempting to perform a custom build will be greeted by the message and most likely be very confused by that.

I did a (rather small) local change to this script that allows me to create custom variables. So in my extension's SConstruct I can either

extraopts = [ ... custom options here ...]
SConscript("godot-cpp/SConstruct", exports='extraopts')

or

Export("extraopts")
SConscript("godot-cpp/SConstruct")

Then desirable custom variables won't generate the warning message. Is this a good solution or there something better? Also, if this is good enough I can PR the change.

Steps to reproduce

Somewhat in the description of the "bug"

Minimal reproduction project

N/A

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions