Skip to content

Commit d3f722e

Browse files
committed
[Web] Include emscripten headers by default
1 parent be3ecae commit d3f722e

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

platform/web/detect.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import os
22
import sys
3+
from pathlib import Path
34
from typing import TYPE_CHECKING
45

56
from emscripten_helpers import (
@@ -112,6 +113,14 @@ def configure(env: "SConsEnvironment"):
112113
print_error("Initial memory must be a valid integer")
113114
sys.exit(255)
114115

116+
## Add Emscripten to the included paths (for compile_commands.json completion)
117+
emcc_path = Path(str(WhereIs("emcc")))
118+
while emcc_path.is_symlink():
119+
# For some reason, mypy trips on `Path.readlink` not being defined, somehow.
120+
emcc_path = emcc_path.readlink() # type: ignore[attr-defined]
121+
emscripten_include_path = emcc_path.parent.joinpath("cache", "sysroot", "include")
122+
env.Append(CPPPATH=[emscripten_include_path])
123+
115124
## Build type
116125

117126
if env.debug_features:

0 commit comments

Comments
 (0)