public HTML5ToolChain(FileReference InProjectFile)
            : base(CppPlatform.HTML5)
        {
            if (!HTML5SDKInfo.IsSDKInstalled())
            {
                throw new BuildException("HTML5 SDK is not installed; cannot use toolchain.");
            }

            // ini configs
            // - normal ConfigCache w/ UnrealBuildTool.ProjectFile takes all game config ini files
            //   (including project config ini files)
            // - but, during packaging, if -remoteini is used -- need to use UnrealBuildTool.GetRemoteIniPath()
            //   (note: ConfigCache can take null ProjectFile)
            string             EngineIniPath = UnrealBuildTool.GetRemoteIniPath();
            DirectoryReference ProjectDir    = !String.IsNullOrEmpty(EngineIniPath) ? new DirectoryReference(EngineIniPath)
                                                                                                : DirectoryReference.FromFile(InProjectFile);
            ConfigHierarchy Ini = ConfigCache.ReadHierarchy(ConfigHierarchyType.Engine, ProjectDir, UnrealTargetPlatform.HTML5);

//			Ini.GetBool("/Script/HTML5PlatformEditor.HTML5TargetSettings", "EnableSIMD", out enableSIMD);
//			Ini.GetBool("/Script/HTML5PlatformEditor.HTML5TargetSettings", "EnableMultithreading", out enableMultithreading);
            Ini.GetBool("/Script/HTML5PlatformEditor.HTML5TargetSettings", "EnableTracing", out bEnableTracing);

            // TODO: remove this "fix" when emscripten supports (SIMD & pthreads) + WASM
            enableSIMD = false;
            // TODO: double check Engine/Source/Runtime/Core/Private/HTML5/HTML5PlatformProcess.cpp::SupportsMultithreading()
            enableMultithreading = false;

            Log.TraceInformation("HTML5ToolChain: EnableSIMD = " + enableSIMD);
            Log.TraceInformation("HTML5ToolChain: EnableMultithreading " + enableMultithreading);
            Log.TraceInformation("HTML5ToolChain: EnableTracing = " + bEnableTracing);

            PrintOnce = new VerbosePrint(PrintOnceOn);             // reset
        }
示例#2
0
        public HTML5ToolChain(FileReference InProjectFile)
            : base(CppPlatform.HTML5)
        {
            if (!HTML5SDKInfo.IsSDKInstalled())
            {
                throw new BuildException("HTML5 SDK is not installed; cannot use toolchain.");
            }

            // ini configs
            // - normal ConfigCache w/ UnrealBuildTool.ProjectFile takes all game config ini files
            //   (including project config ini files)
            // - but, during packaging, if -remoteini is used -- need to use UnrealBuildTool.GetRemoteIniPath()
            //   (note: ConfigCache can take null ProjectFile)
            string             EngineIniPath = UnrealBuildTool.GetRemoteIniPath();
            DirectoryReference ProjectDir    = !String.IsNullOrEmpty(EngineIniPath) ? new DirectoryReference(EngineIniPath)
                                                                                                : DirectoryReference.FromFile(InProjectFile);
            ConfigHierarchy Ini = ConfigCache.ReadHierarchy(ConfigHierarchyType.Engine, ProjectDir, UnrealTargetPlatform.HTML5);

//			Ini.GetBool("/Script/HTML5PlatformEditor.HTML5TargetSettings", "EnableSIMD", out enableSIMD);
            Ini.GetBool("/Script/HTML5PlatformEditor.HTML5TargetSettings", "EnableMultithreading", out enableMultithreading);
            Ini.GetBool("/Script/HTML5PlatformEditor.HTML5TargetSettings", "OffscreenCanvas", out bMultithreading_UseOffscreenCanvas);
            Ini.GetBool("/Script/HTML5PlatformEditor.HTML5TargetSettings", "LLVMWasmBackend", out useLLVMwasmBackend);
            Ini.GetBool("/Script/HTML5PlatformEditor.HTML5TargetSettings", "EnableTracing", out bEnableTracing);

            if (useLLVMwasmBackend)
            {
                libExt = ".a";                  // experimental - LLVMWasmBackend
            }

            // TODO: remove this "fix" when emscripten supports WASM with SIMD
            enableSIMD = false;

            Log.TraceInformation("HTML5ToolChain: EnableSIMD = " + enableSIMD);
            Log.TraceInformation("HTML5ToolChain: EnableMultithreading " + enableMultithreading);
            Log.TraceInformation("HTML5ToolChain: OffscreenCanvas " + bMultithreading_UseOffscreenCanvas);
            Log.TraceInformation("HTML5ToolChain: LLVMWasmBackend " + useLLVMwasmBackend);
            Log.TraceInformation("HTML5ToolChain: EnableTracing = " + bEnableTracing);

            PrintOnce = new VerbosePrint(PrintOnceOn);             // reset

            Log.TraceInformation("Setting Emscripten SDK: located in " + HTML5SDKInfo.EMSCRIPTEN_ROOT);
            string TempDir = HTML5SDKInfo.SetupEmscriptenTemp();

            HTML5SDKInfo.SetUpEmscriptenConfigFile();

            if (Environment.GetEnvironmentVariable("EMSDK") == null)             // If EMSDK is present, Emscripten is already configured by the developer
            {
                // If not using preset emsdk, configure our generated .emscripten config, instead of autogenerating one in the user's home directory.
                Environment.SetEnvironmentVariable("EM_CONFIG", HTML5SDKInfo.DOT_EMSCRIPTEN);
                Environment.SetEnvironmentVariable("EM_CACHE", HTML5SDKInfo.EMSCRIPTEN_CACHE);
                Environment.SetEnvironmentVariable("EMCC_TEMP_DIR", TempDir);
            }

            Log.TraceInformation("*** Emscripten Config File: " + Environment.GetEnvironmentVariable("EM_CONFIG"));
        }
        }                                                                                               // noop

        static void PrintOnceOn(CppConfiguration Configuration, bool bOptimizeForSize)
        {
            if (Configuration == CppConfiguration.Debug)
            {
                Log.TraceInformation("HTML5ToolChain: " + Configuration + " -O0 faster compile time");
            }
            else if (bOptimizeForSize)
            {
                Log.TraceInformation("HTML5ToolChain: " + Configuration + " -Oz favor size over speed");
            }
            else if (Configuration == CppConfiguration.Development)
            {
                Log.TraceInformation("HTML5ToolChain: " + Configuration + " -O2 aggressive size and speed optimization");
            }
            else if (Configuration == CppConfiguration.Shipping)
            {
                Log.TraceInformation("HTML5ToolChain: " + Configuration + " -O3 favor speed over size");
            }
            PrintOnce = new VerbosePrint(PrintOnceOff);             // clear
        }