diff options
Diffstat (limited to 'platform/javascript/detect.py')
| -rw-r--r-- | platform/javascript/detect.py | 43 | 
1 files changed, 22 insertions, 21 deletions
diff --git a/platform/javascript/detect.py b/platform/javascript/detect.py index 4297088c09..173b558b6d 100644 --- a/platform/javascript/detect.py +++ b/platform/javascript/detect.py @@ -7,7 +7,7 @@ from emscripten_helpers import (      add_js_libraries,      add_js_pre,      add_js_externs, -    get_build_version, +    create_template_zip,  )  from methods import get_compiler_version  from SCons.Util import WhereIs @@ -29,7 +29,7 @@ def get_opts():      from SCons.Variables import BoolVariable      return [ -        ("initial_memory", "Initial WASM memory (in MiB)", 16), +        ("initial_memory", "Initial WASM memory (in MiB)", 32),          BoolVariable("use_assertions", "Use Emscripten runtime assertions", False),          BoolVariable("use_thinlto", "Use ThinLTO", False),          BoolVariable("use_ubsan", "Use Emscripten undefined behavior sanitizer (UBSAN)", False), @@ -38,7 +38,7 @@ def get_opts():          BoolVariable("use_safe_heap", "Use Emscripten SAFE_HEAP sanitizer", False),          # eval() can be a security concern, so it can be disabled.          BoolVariable("javascript_eval", "Enable JavaScript eval interface", True), -        BoolVariable("threads_enabled", "Enable WebAssembly Threads support (limited browser support)", False), +        BoolVariable("threads_enabled", "Enable WebAssembly Threads support (limited browser support)", True),          BoolVariable("gdnative_enabled", "Enable WebAssembly GDNative support (produces bigger binaries)", False),          BoolVariable("use_closure_compiler", "Use closure compiler to minimize JavaScript code", False),      ] @@ -53,6 +53,7 @@ def get_flags():          # in this platform. For the available networking methods, the browser          # manages TLS.          ("module_mbedtls_enabled", False), +        ("vulkan", False),      ] @@ -64,21 +65,21 @@ def configure(env):          sys.exit(255)      ## Build type -    if env["target"] == "release": +    if env["target"].startswith("release"):          # Use -Os to prioritize optimizing for reduced file size. This is          # particularly valuable for the web platform because it directly          # decreases download time.          # -Os reduces file size by around 5 MiB over -O3. -Oz only saves about          # 100 KiB over -Os, which does not justify the negative impact on          # run-time performance. -        env.Append(CCFLAGS=["-Os"]) -        env.Append(LINKFLAGS=["-Os"]) -    elif env["target"] == "release_debug": -        env.Append(CCFLAGS=["-Os"]) -        env.Append(LINKFLAGS=["-Os"]) -        env.Append(CPPDEFINES=["DEBUG_ENABLED"]) -        # Retain function names for backtraces at the cost of file size. -        env.Append(LINKFLAGS=["--profiling-funcs"]) +        if env["optimize"] != "none": +            env.Append(CCFLAGS=["-Os"]) +            env.Append(LINKFLAGS=["-Os"]) + +        if env["target"] == "release_debug": +            env.Append(CPPDEFINES=["DEBUG_ENABLED"]) +            # Retain function names for backtraces at the cost of file size. +            env.Append(LINKFLAGS=["--profiling-funcs"])      else:  # "debug"          env.Append(CPPDEFINES=["DEBUG_ENABLED"])          env.Append(CCFLAGS=["-O1", "-g"]) @@ -95,8 +96,9 @@ def configure(env):          if env["initial_memory"] < 64:              print("Editor build requires at least 64MiB of initial memory. Forcing it.")              env["initial_memory"] = 64 -    elif env["builtin_icu"]:          env.Append(CCFLAGS=["-frtti"]) +    elif env["builtin_icu"]: +        env.Append(CCFLAGS=["-fno-exceptions", "-frtti"])      else:          # Disable exceptions and rtti on non-tools (template) builds          # These flags help keep the file size down. @@ -128,7 +130,6 @@ def configure(env):          env.Append(CCFLAGS=["-fsanitize=leak"])          env.Append(LINKFLAGS=["-fsanitize=leak"])      if env["use_safe_heap"]: -        env.Append(CCFLAGS=["-s", "SAFE_HEAP=1"])          env.Append(LINKFLAGS=["-s", "SAFE_HEAP=1"])      # Closure compiler @@ -147,12 +148,12 @@ def configure(env):      env.AddMethod(add_js_pre, "AddJSPre")      env.AddMethod(add_js_externs, "AddJSExterns") -    # Add method for getting build version string. -    env.AddMethod(get_build_version, "GetBuildVersion") -      # Add method that joins/compiles our Engine files.      env.AddMethod(create_engine_file, "CreateEngineFile") +    # Add method for creating the final zip file +    env.AddMethod(create_template_zip, "CreateTemplateZip") +      # Closure compiler extern and support for ecmascript specs (const, let, etc).      env["ENV"]["EMCC_CLOSURE_ARGS"] = "--language_in ECMASCRIPT6" @@ -174,7 +175,7 @@ def configure(env):      # Program() output consists of multiple files, so specify suffixes manually at builder.      env["PROGSUFFIX"] = ""      env["LIBPREFIX"] = "lib" -    env["LIBSUFFIX"] = ".bc" +    env["LIBSUFFIX"] = ".a"      env["LIBPREFIXES"] = ["$LIBPREFIX"]      env["LIBSUFFIXES"] = ["$LIBSUFFIX"] @@ -228,8 +229,8 @@ def configure(env):      # Allow use to take control of swapping WebGL buffers.      env.Append(LINKFLAGS=["-s", "OFFSCREEN_FRAMEBUFFER=1"]) -    # callMain for manual start. -    env.Append(LINKFLAGS=["-s", "EXTRA_EXPORTED_RUNTIME_METHODS=['callMain','cwrap']"]) +    # callMain for manual start, cwrap for the mono version. +    env.Append(LINKFLAGS=["-s", "EXPORTED_RUNTIME_METHODS=['callMain','cwrap']"])      # Add code that allow exiting runtime.      env.Append(LINKFLAGS=["-s", "EXIT_RUNTIME=1"]) @@ -238,6 +239,6 @@ def configure(env):      env.Append(          LINKFLAGS=[              "-s", -            "EXPORTED_FUNCTIONS=['_main', '_emscripten_webgl_get_current_context', '_emscripten_webgl_commit_frame', '_emscripten_webgl_create_context']", +            "EXPORTED_FUNCTIONS=['_main', '_emscripten_webgl_get_current_context']",          ]      )  |