summaryrefslogtreecommitdiff
path: root/platform/web/detect.py
diff options
context:
space:
mode:
Diffstat (limited to 'platform/web/detect.py')
-rw-r--r--platform/web/detect.py33
1 files changed, 16 insertions, 17 deletions
diff --git a/platform/web/detect.py b/platform/web/detect.py
index 08f964db92..08c1ff7b4a 100644
--- a/platform/web/detect.py
+++ b/platform/web/detect.py
@@ -11,6 +11,10 @@ from emscripten_helpers import (
)
from methods import get_compiler_version
from SCons.Util import WhereIs
+from typing import TYPE_CHECKING
+
+if TYPE_CHECKING:
+ from SCons import Environment
def is_active():
@@ -47,7 +51,7 @@ def get_opts():
def get_flags():
return [
("arch", "wasm32"),
- ("tools", False),
+ ("target", "template_debug"),
("builtin_pcre2_with_jit", False),
("vulkan", False),
# Use -Os to prioritize optimizing for reduced file size. This is
@@ -60,7 +64,7 @@ def get_flags():
]
-def configure(env):
+def configure(env: "Environment"):
# Validate arch.
supported_arches = ["wasm32"]
if env["arch"] not in supported_arches:
@@ -77,26 +81,17 @@ def configure(env):
sys.exit(255)
## Build type
- if env["target"].startswith("release"):
- if env["optimize"] == "size":
- env.Append(CCFLAGS=["-Os"])
- env.Append(LINKFLAGS=["-Os"])
- elif env["optimize"] == "speed":
- env.Append(CCFLAGS=["-O3"])
- env.Append(LINKFLAGS=["-O3"])
-
- if env["target"] == "release_debug":
- # Retain function names for backtraces at the cost of file size.
- env.Append(LINKFLAGS=["--profiling-funcs"])
- else: # "debug"
- env.Append(CCFLAGS=["-O1", "-g"])
- env.Append(LINKFLAGS=["-O1", "-g"])
+
+ if env.debug_features:
+ # Retain function names for backtraces at the cost of file size.
+ env.Append(LINKFLAGS=["--profiling-funcs"])
+ else:
env["use_assertions"] = True
if env["use_assertions"]:
env.Append(LINKFLAGS=["-s", "ASSERTIONS=1"])
- if env["tools"]:
+ if env.editor_build:
if env["initial_memory"] < 64:
print('Note: Forcing "initial_memory=64" as it is required for the web editor.')
env["initial_memory"] = 64
@@ -109,6 +104,10 @@ def configure(env):
env["ENV"] = os.environ
# LTO
+
+ if env["lto"] == "auto": # Full LTO for production.
+ env["lto"] = "full"
+
if env["lto"] != "none":
if env["lto"] == "thin":
env.Append(CCFLAGS=["-flto=thin"])