You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-15 13:51:40 +00:00
SCons: "Environment" to "SConsEnvironment"
This commit is contained in:
@@ -6,7 +6,7 @@ import subprocess
|
|||||||
from typing import TYPE_CHECKING
|
from typing import TYPE_CHECKING
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from SCons import Environment
|
from SCons.Script.SConscript import SConsEnvironment
|
||||||
|
|
||||||
|
|
||||||
def get_name():
|
def get_name():
|
||||||
@@ -51,7 +51,7 @@ def get_min_sdk_version(platform):
|
|||||||
return int(platform.split("-")[1])
|
return int(platform.split("-")[1])
|
||||||
|
|
||||||
|
|
||||||
def get_android_ndk_root(env):
|
def get_android_ndk_root(env: "SConsEnvironment"):
|
||||||
return env["ANDROID_HOME"] + "/ndk/" + get_ndk_version()
|
return env["ANDROID_HOME"] + "/ndk/" + get_ndk_version()
|
||||||
|
|
||||||
|
|
||||||
@@ -74,7 +74,7 @@ def get_flags():
|
|||||||
|
|
||||||
# Check if Android NDK version is installed
|
# Check if Android NDK version is installed
|
||||||
# If not, install it.
|
# If not, install it.
|
||||||
def install_ndk_if_needed(env):
|
def install_ndk_if_needed(env: "SConsEnvironment"):
|
||||||
print("Checking for Android NDK...")
|
print("Checking for Android NDK...")
|
||||||
sdk_root = env["ANDROID_HOME"]
|
sdk_root = env["ANDROID_HOME"]
|
||||||
if not os.path.exists(get_android_ndk_root(env)):
|
if not os.path.exists(get_android_ndk_root(env)):
|
||||||
@@ -96,7 +96,7 @@ def install_ndk_if_needed(env):
|
|||||||
env["ANDROID_NDK_ROOT"] = get_android_ndk_root(env)
|
env["ANDROID_NDK_ROOT"] = get_android_ndk_root(env)
|
||||||
|
|
||||||
|
|
||||||
def configure(env: "Environment"):
|
def configure(env: "SConsEnvironment"):
|
||||||
# Validate arch.
|
# Validate arch.
|
||||||
supported_arches = ["x86_32", "x86_64", "arm32", "arm64"]
|
supported_arches = ["x86_32", "x86_64", "arm32", "arm64"]
|
||||||
if env["arch"] not in supported_arches:
|
if env["arch"] not in supported_arches:
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ from methods import detect_darwin_sdk_path
|
|||||||
from typing import TYPE_CHECKING
|
from typing import TYPE_CHECKING
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from SCons import Environment
|
from SCons.Script.SConscript import SConsEnvironment
|
||||||
|
|
||||||
|
|
||||||
def get_name():
|
def get_name():
|
||||||
@@ -54,7 +54,7 @@ def get_flags():
|
|||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
def configure(env: "Environment"):
|
def configure(env: "SConsEnvironment"):
|
||||||
# Validate arch.
|
# Validate arch.
|
||||||
supported_arches = ["x86_64", "arm64"]
|
supported_arches = ["x86_64", "arm64"]
|
||||||
if env["arch"] not in supported_arches:
|
if env["arch"] not in supported_arches:
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ from platform_methods import detect_arch
|
|||||||
from typing import TYPE_CHECKING
|
from typing import TYPE_CHECKING
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from SCons import Environment
|
from SCons.Script.SConscript import SConsEnvironment
|
||||||
|
|
||||||
|
|
||||||
def get_name():
|
def get_name():
|
||||||
@@ -70,7 +70,7 @@ def get_flags():
|
|||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
def configure(env: "Environment"):
|
def configure(env: "SConsEnvironment"):
|
||||||
# Validate arch.
|
# Validate arch.
|
||||||
supported_arches = ["x86_32", "x86_64", "arm32", "arm64", "rv64", "ppc32", "ppc64"]
|
supported_arches = ["x86_32", "x86_64", "arm32", "arm64", "rv64", "ppc32", "ppc64"]
|
||||||
if env["arch"] not in supported_arches:
|
if env["arch"] not in supported_arches:
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ from platform_methods import detect_arch, detect_mvk
|
|||||||
from typing import TYPE_CHECKING
|
from typing import TYPE_CHECKING
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from SCons import Environment
|
from SCons.Script.SConscript import SConsEnvironment
|
||||||
|
|
||||||
|
|
||||||
def get_name():
|
def get_name():
|
||||||
@@ -59,7 +59,7 @@ def get_flags():
|
|||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
def configure(env: "Environment"):
|
def configure(env: "SConsEnvironment"):
|
||||||
# Validate arch.
|
# Validate arch.
|
||||||
supported_arches = ["x86_64", "arm64"]
|
supported_arches = ["x86_64", "arm64"]
|
||||||
if env["arch"] not in supported_arches:
|
if env["arch"] not in supported_arches:
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ from SCons.Util import WhereIs
|
|||||||
from typing import TYPE_CHECKING
|
from typing import TYPE_CHECKING
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from SCons import Environment
|
from SCons.Script.SConscript import SConsEnvironment
|
||||||
|
|
||||||
|
|
||||||
def get_name():
|
def get_name():
|
||||||
@@ -81,7 +81,7 @@ def get_flags():
|
|||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
def configure(env: "Environment"):
|
def configure(env: "SConsEnvironment"):
|
||||||
# Validate arch.
|
# Validate arch.
|
||||||
supported_arches = ["wasm32"]
|
supported_arches = ["wasm32"]
|
||||||
if env["arch"] not in supported_arches:
|
if env["arch"] not in supported_arches:
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ from platform_methods import detect_arch
|
|||||||
from typing import TYPE_CHECKING
|
from typing import TYPE_CHECKING
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from SCons import Environment
|
from SCons.Script.SConscript import SConsEnvironment
|
||||||
|
|
||||||
# To match other platforms
|
# To match other platforms
|
||||||
STACK_SIZE = 8388608
|
STACK_SIZE = 8388608
|
||||||
@@ -251,7 +251,7 @@ def get_flags():
|
|||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
def build_res_file(target, source, env):
|
def build_res_file(target, source, env: "SConsEnvironment"):
|
||||||
arch_aliases = {
|
arch_aliases = {
|
||||||
"x86_32": "pe-i386",
|
"x86_32": "pe-i386",
|
||||||
"x86_64": "pe-x86-64",
|
"x86_64": "pe-x86-64",
|
||||||
@@ -286,7 +286,7 @@ def build_res_file(target, source, env):
|
|||||||
return 0
|
return 0
|
||||||
|
|
||||||
|
|
||||||
def setup_msvc_manual(env):
|
def setup_msvc_manual(env: "SConsEnvironment"):
|
||||||
"""Running from VCVARS environment"""
|
"""Running from VCVARS environment"""
|
||||||
|
|
||||||
env_arch = detect_build_env_arch()
|
env_arch = detect_build_env_arch()
|
||||||
@@ -303,7 +303,7 @@ def setup_msvc_manual(env):
|
|||||||
print("Found MSVC, arch %s" % (env_arch))
|
print("Found MSVC, arch %s" % (env_arch))
|
||||||
|
|
||||||
|
|
||||||
def setup_msvc_auto(env):
|
def setup_msvc_auto(env: "SConsEnvironment"):
|
||||||
"""Set up MSVC using SCons's auto-detection logic"""
|
"""Set up MSVC using SCons's auto-detection logic"""
|
||||||
|
|
||||||
# If MSVC_VERSION is set by SCons, we know MSVC is installed.
|
# If MSVC_VERSION is set by SCons, we know MSVC is installed.
|
||||||
@@ -339,7 +339,7 @@ def setup_msvc_auto(env):
|
|||||||
print("Found MSVC version %s, arch %s" % (env["MSVC_VERSION"], env["arch"]))
|
print("Found MSVC version %s, arch %s" % (env["MSVC_VERSION"], env["arch"]))
|
||||||
|
|
||||||
|
|
||||||
def setup_mingw(env):
|
def setup_mingw(env: "SConsEnvironment"):
|
||||||
"""Set up env for use with mingw"""
|
"""Set up env for use with mingw"""
|
||||||
|
|
||||||
env_arch = detect_build_env_arch()
|
env_arch = detect_build_env_arch()
|
||||||
@@ -374,7 +374,7 @@ def setup_mingw(env):
|
|||||||
print("Using MinGW, arch %s" % (env["arch"]))
|
print("Using MinGW, arch %s" % (env["arch"]))
|
||||||
|
|
||||||
|
|
||||||
def configure_msvc(env, vcvars_msvc_config):
|
def configure_msvc(env: "SConsEnvironment", vcvars_msvc_config):
|
||||||
"""Configure env to work with MSVC"""
|
"""Configure env to work with MSVC"""
|
||||||
|
|
||||||
## Build type
|
## Build type
|
||||||
@@ -417,7 +417,7 @@ def configure_msvc(env, vcvars_msvc_config):
|
|||||||
|
|
||||||
if vcvars_msvc_config: # should be automatic if SCons found it
|
if vcvars_msvc_config: # should be automatic if SCons found it
|
||||||
if os.getenv("WindowsSdkDir") is not None:
|
if os.getenv("WindowsSdkDir") is not None:
|
||||||
env.Prepend(CPPPATH=[os.getenv("WindowsSdkDir") + "/Include"])
|
env.Prepend(CPPPATH=[str(os.getenv("WindowsSdkDir")) + "/Include"])
|
||||||
else:
|
else:
|
||||||
print("Missing environment variable: WindowsSdkDir")
|
print("Missing environment variable: WindowsSdkDir")
|
||||||
|
|
||||||
@@ -522,7 +522,7 @@ def configure_msvc(env, vcvars_msvc_config):
|
|||||||
|
|
||||||
if vcvars_msvc_config:
|
if vcvars_msvc_config:
|
||||||
if os.getenv("WindowsSdkDir") is not None:
|
if os.getenv("WindowsSdkDir") is not None:
|
||||||
env.Append(LIBPATH=[os.getenv("WindowsSdkDir") + "/Lib"])
|
env.Append(LIBPATH=[str(os.getenv("WindowsSdkDir")) + "/Lib"])
|
||||||
else:
|
else:
|
||||||
print("Missing environment variable: WindowsSdkDir")
|
print("Missing environment variable: WindowsSdkDir")
|
||||||
|
|
||||||
@@ -543,8 +543,8 @@ def configure_msvc(env, vcvars_msvc_config):
|
|||||||
env.AppendUnique(LINKFLAGS=["/LTCG"])
|
env.AppendUnique(LINKFLAGS=["/LTCG"])
|
||||||
|
|
||||||
if vcvars_msvc_config:
|
if vcvars_msvc_config:
|
||||||
env.Prepend(CPPPATH=[p for p in os.getenv("INCLUDE").split(";")])
|
env.Prepend(CPPPATH=[p for p in str(os.getenv("INCLUDE")).split(";")])
|
||||||
env.Append(LIBPATH=[p for p in os.getenv("LIB").split(";")])
|
env.Append(LIBPATH=[p for p in str(os.getenv("LIB")).split(";")])
|
||||||
|
|
||||||
# Sanitizers
|
# Sanitizers
|
||||||
if env["use_asan"]:
|
if env["use_asan"]:
|
||||||
@@ -560,7 +560,7 @@ def configure_msvc(env, vcvars_msvc_config):
|
|||||||
env.AppendUnique(LINKFLAGS=["/STACK:" + str(STACK_SIZE)])
|
env.AppendUnique(LINKFLAGS=["/STACK:" + str(STACK_SIZE)])
|
||||||
|
|
||||||
|
|
||||||
def configure_mingw(env):
|
def configure_mingw(env: "SConsEnvironment"):
|
||||||
# Workaround for MinGW. See:
|
# Workaround for MinGW. See:
|
||||||
# https://www.scons.org/wiki/LongCmdLinesOnWin32
|
# https://www.scons.org/wiki/LongCmdLinesOnWin32
|
||||||
env.use_windows_spawn_fix()
|
env.use_windows_spawn_fix()
|
||||||
@@ -747,7 +747,7 @@ def configure_mingw(env):
|
|||||||
env.Append(BUILDERS={"RES": env.Builder(action=build_res_file, suffix=".o", src_suffix=".rc")})
|
env.Append(BUILDERS={"RES": env.Builder(action=build_res_file, suffix=".o", src_suffix=".rc")})
|
||||||
|
|
||||||
|
|
||||||
def configure(env: "Environment"):
|
def configure(env: "SConsEnvironment"):
|
||||||
# Validate arch.
|
# Validate arch.
|
||||||
supported_arches = ["x86_32", "x86_64", "arm32", "arm64"]
|
supported_arches = ["x86_32", "x86_64", "arm32", "arm64"]
|
||||||
if env["arch"] not in supported_arches:
|
if env["arch"] not in supported_arches:
|
||||||
|
|||||||
Reference in New Issue
Block a user