godotengine / godotengine/godot-cpp

SCons warning message with custom variables

Open
#1,334 6 comments 1 reaction 0 assignees View on GitHub
discussion topic:buildsystem
Dominant language
C++
Stars
2.7k
Forks
809
Avg merge
1d 3h
Merged PRs (30d)
8

Description

### 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:
```python
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

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

or

```python
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

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.