public override NativeProgramFormat CustomizeExecutableForSettings(FriendlyJObject settings) { return(GetExecutableFormatForConfig(DotsConfigs.DotsConfigForSettings(settings, out _), settings.GetBool("EnableManagedDebugger")) .WithLinkerSetting <EmscriptenDynamicLinker>(e => e.WithEmscriptenSettings(settings.GetDictionary("EmscriptenSettings")))); }
public override DotsRuntimeCSharpProgramConfiguration CustomizeConfigForSettings(DotsRuntimeCSharpProgramConfiguration config, FriendlyJObject settings) { var executableFormat = GetExecutableFormatForConfig(DotsConfigs.DotsConfigForSettings(settings, out _), SupportsManagedDebugging && config.EnableManagedDebugging) .WithLinkerSetting <EmscriptenDynamicLinker>(e => e .WithCustomFlags_workaround(new[] { "-s", "TOTAL_STACK=" + (settings.GetString("WasmStackSize") ?? "512KB") }) .WithCustomFlags_workaround(new[] { "-s", "TOTAL_MEMORY=" + (settings.GetString("WasmMemorySize") ?? "128MB") }) .WithCustomFlags_workaround(new[] { "-s", "ALLOW_MEMORY_GROWTH=" + (settings.GetBool("AllowWasmMemoryGrowth")?"1":"0") }) .WithCustomFlags_workaround(new[] { "-s", "MINIFY_HTML=" + (settings.GetBool("MinifyHTMLFile")?"1":"0") }) .WithCustomFlags_workaround(settings.GetBool("MinifyOutputWithClosure") ? new[] { "--closure-args", "\"--platform native --externs " + BuildProgram.BeeRoot.Combine("closure_externs.js").ToString() + "\"", "--closure", "1", "-s", "CLOSURE_WARNINGS=warn" } : new[] { "" }) .WithCustomFlags_workaround(new[] { settings.GetBool("EmbedCpuProfiler")?"--cpuprofiler":"" }) .WithCustomFlags_workaround(new[] { settings.GetBool("EmbedMemoryProfiler")?"--memoryprofiler":"" }) .WithCustomFlags_workaround(new[] { settings.GetBool("IncludeSymbolsForBrowserCallstacks")?"--profiling-funcs":"" }) .WithCustomFlags_workaround(new[] { "-s", "ASSERTIONS=" + (settings.GetBool("EmitRuntimeAllocationDebugChecks")?"2":(settings.GetBool("EmitRuntimeMemoryDebugChecks")?"1":"0")) }) .WithCustomFlags_workaround(new[] { "-s", "SAFE_HEAP=" + (settings.GetBool("EmitRuntimeMemoryDebugChecks")?"1":"0") }) .WithSingleFile(settings.GetBool("SingleFile")) // Specify extra EmscriptenCmdLine overrides last so they can override previous settings. .WithCustomFlags_workaround(new[] { settings.GetString("EmscriptenCmdLine") ?? "" }) ); config.NativeProgramConfiguration = new DotsRuntimeNativeProgramConfiguration( config.NativeProgramConfiguration.CodeGen, config.NativeProgramConfiguration.ToolChain, config.Identifier, config, executableFormat: executableFormat); config.PlatformBuildConfig = new WebBuildConfig { SingleFile = settings.GetBool("SingleFile"), WebTemplateFolder = settings.GetString("WebTemplateFolder"), }; return(config); }