diff options
author | Fabio Alessandrelli <fabio.alessandrelli@gmail.com> | 2023-10-15 12:01:45 +0200 |
---|---|---|
committer | Fabio Alessandrelli <fabio.alessandrelli@gmail.com> | 2023-10-15 13:12:49 +0200 |
commit | 18bfa133ab3b6687fd742076cfd20ad7784d058d (patch) | |
tree | 09ae2612b54fa2dd7d535860bf07945e7d4e7557 /tools | |
parent | c4d3f019dab87aff7b36acc5071e1c9adf76f6dd (diff) | |
download | redot-cpp-18bfa133ab3b6687fd742076cfd20ad7784d058d.tar.gz |
[SCons] Rename javascript tool to web
And clean it up a bit.
Diffstat (limited to 'tools')
-rw-r--r-- | tools/godotcpp.py | 4 | ||||
-rw-r--r-- | tools/web.py (renamed from tools/javascript.py) | 32 |
2 files changed, 18 insertions, 18 deletions
diff --git a/tools/godotcpp.py b/tools/godotcpp.py index c89335d..69a4652 100644 --- a/tools/godotcpp.py +++ b/tools/godotcpp.py @@ -33,7 +33,7 @@ def validate_parent_dir(key, val, env): raise UserError("'%s' is not a directory: %s" % (key, os.path.dirname(val))) -platforms = ("linux", "macos", "windows", "android", "ios", "javascript") +platforms = ("linux", "macos", "windows", "android", "ios", "web") # CPU architecture options. architecture_array = [ @@ -222,7 +222,7 @@ def generate(env): env["arch"] = "universal" elif env["platform"] == "android": env["arch"] = "arm64" - elif env["platform"] == "javascript": + elif env["platform"] == "web": env["arch"] = "wasm32" else: host_machine = platform.machine().lower() diff --git a/tools/javascript.py b/tools/web.py index e8f6af1..a4620c3 100644 --- a/tools/javascript.py +++ b/tools/web.py @@ -11,34 +11,34 @@ def generate(env): print("Only wasm32 supported on web. Exiting.") env.Exit(1) + # Emscripten toolchain env["CC"] = "emcc" env["CXX"] = "em++" env["AR"] = "emar" env["RANLIB"] = "emranlib" - env.Append(CPPFLAGS=["-s", "SIDE_MODULE=1"]) - env.Append(LINKFLAGS=["-s", "SIDE_MODULE=1"]) - env["SHOBJSUFFIX"] = ".bc" - env["SHLIBSUFFIX"] = ".wasm" + # Use TempFileMunge since some AR invocations are too long for cmd.exe. # Use POSIX-style paths, required with TempFileMunge. env["ARCOM_POSIX"] = env["ARCOM"].replace("$TARGET", "$TARGET.posix").replace("$SOURCES", "$SOURCES.posix") env["ARCOM"] = "${TEMPFILE(ARCOM_POSIX)}" + # All intermediate files are just object files. + env["OBJSUFFIX"] = ".o" + env["SHOBJSUFFIX"] = ".o" + + # Static libraries clang-style. + env["LIBPREFIX"] = "lib" + env["LIBSUFFIX"] = ".a" + + # Shared library as wasm. + env["SHLIBSUFFIX"] = ".wasm" + # Thread support (via SharedArrayBuffer). env.Append(CCFLAGS=["-s", "USE_PTHREADS=1"]) env.Append(LINKFLAGS=["-s", "USE_PTHREADS=1"]) - # All intermediate files are just LLVM bitcode. - env["OBJPREFIX"] = "" - env["OBJSUFFIX"] = ".bc" - env["PROGPREFIX"] = "" - # Program() output consists of multiple files, so specify suffixes manually at builder. - env["PROGSUFFIX"] = "" - env["LIBPREFIX"] = "lib" - env["LIBSUFFIX"] = ".a" - env["LIBPREFIXES"] = ["$LIBPREFIX"] - env["LIBSUFFIXES"] = ["$LIBSUFFIX"] - env.Replace(SHLINKFLAGS="$LINKFLAGS") - env.Replace(SHLINKFLAGS="$LINKFLAGS") + # Build as side module (shared library). + env.Append(CPPFLAGS=["-s", "SIDE_MODULE=1"]) + env.Append(LINKFLAGS=["-s", "SIDE_MODULE=1"]) env.Append(CPPDEFINES=["WEB_ENABLED", "UNIX_ENABLED"]) |