Merged
Conversation
Member
Author
|
For unknown reasons, if I run |
Contributor
Make sure you have the same version of |
d23c1e4 to
1e3e304
Compare
Member
Author
|
@Faless It worked! Thanks! |
Faless
requested changes
Jul 10, 2023
Contributor
Faless
left a comment
There was a problem hiding this comment.
Looking good, just some nit picks to make the behavior clearer (I think?):
diff --git a/SConstruct b/SConstruct
index 0edf7fa..11ec4cf 100644
--- a/SConstruct
+++ b/SConstruct
@@ -4,19 +4,11 @@ import os
import platform
import sys
import subprocess
-from typing import TYPE_CHECKING
from binding_generator import scons_generate_bindings, scons_emit_files
-from SCons.Script import Environment
from SCons.Errors import UserError
-from SCons.Variables import BoolVariable, EnumVariable, PathVariable
EnsureSConsVersion(4, 0)
-try:
- Import("env")
-except:
- pass
-
def add_sources(sources, dir, extension):
for f in os.listdir(dir):
@@ -59,10 +51,13 @@ elif ARGUMENTS.get("platform", ""):
else:
raise ValueError("Could not detect platform automatically, please specify with platform=<platform>")
-# Default tools with no platform defaults to gnu toolchain.
-# We apply platform specific toolchains via our custom tools.
-if not "env" in globals() or TYPE_CHECKING:
+try:
+ Import("env")
+except:
+ # Default tools with no platform defaults to gnu toolchain.
+ # We apply platform specific toolchains via our custom tools.
env = Environment(tools=["default"], PLATFORM="")
+
env.PrependENVPath("PATH", os.getenv("PATH"))
# Default num_jobs to local cpu count if not user specified.This PR make it possible to import `env` and use it instead of creating one from scratch every time. Handy because we encourage users to use the godot-cpp SConstruct file as a base to their projects (see the test project). So, if a project want to override specific settings, (eg. make a path local to their SConstruct file, not local to the godot-cpp/SConstruct file), it can do so.
1e3e304 to
8155f35
Compare
dsnopek
approved these changes
Jul 13, 2023
Collaborator
dsnopek
left a comment
There was a problem hiding this comment.
This looks great to me! And Fabio's requested changes have been made
Collaborator
|
Discussed at the GDExtension meeting, and we think this makes sense. |
Collaborator
|
Thanks! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR make it possible to import
envand use it instead of creating one from scratch every time.Handy because we encourage users to use the godot-cpp SConstruct file as a base to their projects (see the test project). So, if a project want to override specific settings, (eg. make a path local to their SConstruct file, not local to the godot-cpp/SConstruct file), it can do so.