Skip to content

Commit 467c7b6

Browse files
committed
allow web build to pass with latest changes
1 parent c2727ed commit 467c7b6

File tree

2 files changed

+21
-6
lines changed

2 files changed

+21
-6
lines changed

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,4 +136,6 @@ config.log
136136
demo/addons/fmod/libs/android/aar/
137137

138138
*.pdb
139-
.vs
139+
.vs
140+
141+
*.wasm

SConstruct

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,12 @@ target_path = ARGUMENTS.pop("target_path", "demo/addons/fmod/libs/")
99
target_name = ARGUMENTS.pop("target_name", "libGodotFmod")
1010
fmod_lib_dir = ARGUMENTS.pop("fmod_lib_dir", "../libs/fmod/")
1111

12+
# Although FMOD's WebAssembly libraries are built with pthreads / shared memory support, Godot doesn't yet like it.
13+
# For web builds, default to single-threaded godot-cpp (unless the user explicitly overrides it).
14+
platform_arg = ARGUMENTS.get("platform")
15+
if platform_arg == "web" and "threads" not in ARGUMENTS:
16+
ARGUMENTS["threads"] = "no"
17+
1218
env = SConscript("godot-cpp/SConstruct")
1319

1420
# Add those directory manually, so we can skip the godot_cpp directory when including headers in C++ files
@@ -123,12 +129,19 @@ elif env["platform"] == "android":
123129
env.Append(LIBS=[libfmod, libfmodstudio])
124130

125131
elif env["platform"] == "web":
126-
libfmodstudio = os.path.join(fmod_lib_dir, 'web/studio/lib/fastcomp/bitcode/', 'fmodstudio%s.bc' % lfix)
132+
html_lib = os.path.join(fmod_lib_dir, 'api/studio/lib/upstream/w32/')
133+
html_inc = os.path.join(fmod_lib_dir, 'api/studio/inc/')
134+
135+
html_core_lib = os.path.join(fmod_lib_dir, 'api/core/lib/upstream/w32/')
136+
html_core_inc = os.path.join(fmod_lib_dir, 'api/core/inc/')
137+
138+
libfmodstudio_path = os.path.join(html_lib, 'fmodstudio%s_wasm.a' % lfix)
127139

128-
env.Append(CPPPATH=[env['fmod_lib_dir'] + 'web/core/inc/', env['fmod_lib_dir'] + 'web/studio/inc/'])
129-
env.Append(LIBPATH=[env['fmod_lib_dir'] + 'web/core/lib/fastcomp/bitcode/', env['fmod_lib_dir'] + 'web/studio/lib/fastcomp/bitcode/'])
130-
# Instead of LIBS, directly add to LINKFLAGS for explicit paths
131-
env.Append(LINKFLAGS=[libfmodstudio])
140+
env.Append(CPPPATH=[html_inc, html_core_inc])
141+
env.Append(LIBPATH=[html_lib])
142+
# env.Append(LIBS=[libfmodstudio]) # ← REMOVE or comment this out
143+
env.Append(LINKFLAGS=[libfmodstudio_path])
144+
env.Append(LINKFLAGS=["-sEXPORTED_RUNTIME_METHODS=ccall,cwrap,setValue,getValue"])
132145

133146
#Output is placed in the addons directory of the demo project directly
134147
target = "{}{}/{}.{}.{}".format(

0 commit comments

Comments
 (0)