Fix compiling project with plugins for Web

This commit is contained in:
2026-08-04 05:35:07 +02:00
parent d7530ea846
commit b0ae51ad0d
@@ -319,10 +319,6 @@ namespace Flax.Build.Platforms
//args.Add("-sMALLOC=emmalloc-memvalidate");
//args.Add("-sMALLOC=emmalloc");
// Setup file access (Game Cooker packs files with file_packager tool)
args.Add("-sFORCE_FILESYSTEM");
args.Add("-sLZ4");
// https://emscripten.org/docs/compiling/Dynamic-Linking.html#dynamic-linking
if (!options.Target.UseSymbolsExports)
{
@@ -341,6 +337,12 @@ namespace Flax.Build.Platforms
{
args.Add("-sSIDE_MODULE");
}
}
if (options.LinkEnv.Output == LinkerOutput.Executable)
{
// Setup file access (Game Cooker packs files with file_packager tool)
args.Add("-sFORCE_FILESYSTEM");
args.Add("-sLZ4");
// Setup minimum browser versions
// https://webassembly.org/features/?categories=browsers#feature-note-3
@@ -411,8 +413,11 @@ namespace Flax.Build.Platforms
{
// Link against dynamic library
task.PrerequisiteFiles.Add(library);
libraryPaths.Add(dir);
args.Add(string.Format("\"-l{0}\"", GetLibName(library)));
//libraryPaths.Add(dir);
//args.Add(string.Format("\"-l{0}\"", GetLibName(library)));
// No need to link excplicitly when using MAIN_MODULE/SIDE_MODULE as linking is resolved at runtime
// https://emscripten.org/docs/compiling/Dynamic-Linking.html#runtime-dynamic-linking-with-dlopen
}
else
{
@@ -472,6 +477,7 @@ namespace Flax.Build.Platforms
break;
case LinkerOutput.StaticLibrary:
case LinkerOutput.ImportLibrary:
throw new NotImplementedException();
default:
throw new ArgumentOutOfRangeException();
}