예제 #1
0
        public static List <string> GetShippingArchitectures(ConfigHierarchy Ini)
        {
            List <string> ProjectArches = new List <string>();
            bool          bBuild        = true;

            if (Ini.GetBool("/Script/IOSRuntimeSettings.IOSRuntimeSettings", "bShipForArmV7", out bBuild) && bBuild)
            {
                ProjectArches.Add("armv7");
            }
            if (Ini.GetBool("/Script/IOSRuntimeSettings.IOSRuntimeSettings", "bShipForArm64", out bBuild) && bBuild)
            {
                ProjectArches.Add("arm64");
            }
            if (Ini.GetBool("/Script/IOSRuntimeSettings.IOSRuntimeSettings", "bShipForArmV7S", out bBuild) && bBuild)
            {
                ProjectArches.Add("armv7s");
            }

            // force armv7 if something went wrong
            if (ProjectArches.Count == 0)
            {
                ProjectArches.Add("armv7");
                ProjectArches.Add("arm64");
            }
            return(ProjectArches);
        }
예제 #2
0
        public string GetMLSDKVersion(ConfigHierarchy EngineIni)
        {
            string MLSDKPath;
            string Major = "0";
            string Minor = "0";

            MLSDKPath = Environment.GetEnvironmentVariable("MLSDK");
            if (!string.IsNullOrEmpty(MLSDKPath))
            {
                if (Directory.Exists(MLSDKPath))
                {
                    String VersionFile = string.Format("{0}/include/ml_version.h", MLSDKPath).Replace('/', Path.DirectorySeparatorChar);
                    if (File.Exists(VersionFile))
                    {
                        string          FileText     = File.ReadAllText(VersionFile);
                        string          Pattern      = @"(MLSDK_VERSION_MAJOR) (?'MAJOR'\d+).*(MLSDK_VERSION_MINOR) (?'MINOR'\d+).*(MLSDK_VERSION_REVISION) (?'REV'\d+)";
                        Regex           VersionRegex = new Regex(Pattern, RegexOptions.Singleline);
                        MatchCollection Matches      = VersionRegex.Matches(FileText);
                        if (Matches.Count > 0 &&
                            !string.IsNullOrEmpty(Matches[0].Groups["MAJOR"].Value) &&
                            !string.IsNullOrEmpty(Matches[0].Groups["MINOR"].Value))
                        {
                            Major = Matches[0].Groups["MAJOR"].Value;
                            Minor = Matches[0].Groups["MINOR"].Value;
                        }
                    }
                }
            }
            return(string.Format("{0}.{1}", Major, Minor));
        }
예제 #3
0
        /// <summary>
        /// Reads a config hierarchy (or retrieve it from the cache)
        /// </summary>
        /// <param name="Type">The type of hierarchy to read</param>
        /// <param name="ProjectDir">The project directory to read the hierarchy for</param>
        /// <param name="Platform">Which platform to read platform-specific config files for</param>
        /// <returns>The requested config hierarchy</returns>
        public static ConfigHierarchy ReadHierarchy(ConfigHierarchyType Type, DirectoryReference ProjectDir, UnrealTargetPlatform Platform)
        {
            // Get the key to use for the cache. It cannot be null, so we use the engine directory if a project directory is not given.
            ConfigHierarchyKey Key = new ConfigHierarchyKey(Type, ProjectDir, Platform);

            // Try to get the cached hierarchy with this key
            ConfigHierarchy Hierarchy;

            if (!HierarchyKeyToHierarchy.TryGetValue(Key, out Hierarchy))
            {
                List <ConfigFile> Files = new List <ConfigFile>();
                foreach (FileReference IniFileName in ConfigHierarchy.EnumerateConfigFileLocations(Type, ProjectDir, Platform))
                {
                    ConfigFile File;
                    if (TryReadFile(IniFileName, out File))
                    {
                        Files.Add(File);
                    }
                }

                Hierarchy = new ConfigHierarchy(Files);
                HierarchyKeyToHierarchy.Add(Key, Hierarchy);
            }
            return(Hierarchy);
        }
예제 #4
0
        /// <summary>
        /// Checks whether the list of dependencies is still valid
        /// </summary>
        /// <returns></returns>
        public bool IsValid()
        {
            foreach (KeyValuePair <ConfigDependencyKey, IReadOnlyList <string> > Pair in Dependencies)
            {
                // Read the appropriate hierarchy
                ConfigHierarchy Hierarchy = ConfigCache.ReadHierarchy(Pair.Key.Type, Pair.Key.ProjectDir, Pair.Key.Platform);

                // Get the value(s) associated with this key
                IReadOnlyList <string> NewValues;
                Hierarchy.TryGetValues(Pair.Key.SectionName, Pair.Key.KeyName, out NewValues);

                // Check if they're different
                if (Pair.Value == null)
                {
                    if (NewValues != null)
                    {
                        return(false);
                    }
                }
                else
                {
                    if (NewValues == null || !Enumerable.SequenceEqual(Pair.Value, NewValues, StringComparer.Ordinal))
                    {
                        return(false);
                    }
                }
            }
            return(true);
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="InDirectory"></param>
        /// <param name="InTargetPlatform"></param>
        /// <param name="OutRSAKeys"></param>
        /// <param name="OutAESKey"></param>
        public static void ParseEncryptionIni(DirectoryReference InDirectory, UnrealTargetPlatform InTargetPlatform, out String[] OutRSAKeys, out String OutAESKey)
        {
            OutAESKey  = String.Empty;
            OutRSAKeys = null;

            ConfigHierarchy Ini = ConfigCache.ReadHierarchy(ConfigHierarchyType.Encryption, InDirectory, InTargetPlatform);

            bool bSigningEnabled;

            Ini.GetBool("Core.Encryption", "SignPak", out bSigningEnabled);

            if (bSigningEnabled)
            {
                OutRSAKeys = new string[3];
                Ini.GetString("Core.Encryption", "rsa.privateexp", out OutRSAKeys[0]);
                Ini.GetString("Core.Encryption", "rsa.modulus", out OutRSAKeys[1]);
                Ini.GetString("Core.Encryption", "rsa.publicexp", out OutRSAKeys[2]);

                if (String.IsNullOrEmpty(OutRSAKeys[0]) || String.IsNullOrEmpty(OutRSAKeys[1]) || String.IsNullOrEmpty(OutRSAKeys[2]))
                {
                    OutRSAKeys = null;
                }
            }

            bool bEncryptionEnabled;

            Ini.GetBool("Core.Encryption", "EncryptPak", out bEncryptionEnabled);

            if (bEncryptionEnabled)
            {
                Ini.GetString("Core.Encryption", "aes.key", out OutAESKey);
            }
        }
예제 #6
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", "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
        }
예제 #7
0
        public bool UseVulkan()
        {
            ConfigHierarchy Ini   = GetConfigCacheIni(ConfigHierarchyType.Engine);
            bool            Value = false;

            Ini.GetBool("/Script/LuminRuntimeSettings.LuminRuntimeSettings", "bUseVulkan", out Value);
            return(Value);
        }
예제 #8
0
        private string GetRuntimeSetting(string Key)
        {
            ConfigHierarchy Ini = GetConfigCacheIni(ConfigHierarchyType.Engine);
            string          Value;

            Ini.GetString("/Script/LuminRuntimeSettings.LuminRuntimeSettings", Key, out Value);
            return(Value);
        }
예제 #9
0
        private bool GetRemoveDebugInfo()
        {
            ConfigHierarchy Ini   = GetConfigCacheIni(ConfigHierarchyType.Engine);
            bool            Value = false;

            Ini.GetBool("/Script/LuminRuntimeSettings.LuminRuntimeSettings", "bRemoveDebugInfo", out Value);
            return(Value);
        }
예제 #10
0
        /// <summary>
        /// Reads a config hierarchy (or retrieve it from the cache)
        /// </summary>
        /// <param name="Type">The type of hierarchy to read</param>
        /// <param name="ProjectDir">The project directory to read the hierarchy for</param>
        /// <param name="Platform">Which platform to read platform-specific config files for</param>
        /// <param name="GeneratedConfigDir">Base directory for generated configs</param>
        /// <returns>The requested config hierarchy</returns>
        public static ConfigHierarchy ReadHierarchy(ConfigHierarchyType Type, DirectoryReference ProjectDir, UnrealTargetPlatform Platform, DirectoryReference GeneratedConfigDir = null)
        {
            // Get the key to use for the cache. It cannot be null, so we use the engine directory if a project directory is not given.
            ConfigHierarchyKey Key = new ConfigHierarchyKey(Type, ProjectDir, Platform);

            // Try to get the cached hierarchy with this key
            ConfigHierarchy Hierarchy;

            if (!HierarchyKeyToHierarchy.TryGetValue(Key, out Hierarchy))
            {
                List <ConfigFile> Files = new List <ConfigFile>();
                foreach (FileReference IniFileName in ConfigHierarchy.EnumerateConfigFileLocations(Type, ProjectDir, Platform))
                {
                    ConfigFile File;
                    if (TryReadFile(IniFileName, out File))
                    {
                        Files.Add(File);
                    }
                }

                // If we haven't been given a generated project dir, but we do have a project then the generated configs
                // should go into ProjectDir/Saved
                if (GeneratedConfigDir == null && ProjectDir != null)
                {
                    GeneratedConfigDir = DirectoryReference.Combine(ProjectDir, "Saved");
                }

                if (GeneratedConfigDir != null)
                {
                    // We know where the generated version of this config file lives, so we can read it back in
                    // and include any user settings from there in our hierarchy
                    string        BaseIniName            = Enum.GetName(typeof(ConfigHierarchyType), Type);
                    string        PlatformName           = ConfigHierarchy.GetIniPlatformName(Platform);
                    FileReference DestinationIniFilename = FileReference.Combine(GeneratedConfigDir, "Config", PlatformName, BaseIniName + ".ini");
                    ConfigFile    File;
                    if (TryReadFile(DestinationIniFilename, out File))
                    {
                        Files.Add(File);
                    }
                }

                // Handle command line overrides
                string[] CmdLine            = Environment.GetCommandLineArgs();
                string   IniConfigArgPrefix = "-ini:" + Enum.GetName(typeof(ConfigHierarchyType), Type) + ":";
                foreach (string CmdLineArg in CmdLine)
                {
                    if (CmdLineArg.StartsWith(IniConfigArgPrefix))
                    {
                        ConfigFile OverrideFile = new ConfigFile(CmdLineArg.Substring(IniConfigArgPrefix.Length));
                        Files.Add(OverrideFile);
                    }
                }

                Hierarchy = new ConfigHierarchy(Files);
                HierarchyKeyToHierarchy.Add(Key, Hierarchy);
            }
            return(Hierarchy);
        }
예제 #11
0
        protected static bool DoProjectSettingsMatchDefault(UnrealTargetPlatform Platform, DirectoryReference ProjectDirectoryName, string Section, string[] BoolKeys, string[] IntKeys, string[] StringKeys)
        {
            ConfigHierarchy ProjIni    = ConfigCache.ReadHierarchy(ConfigHierarchyType.Engine, ProjectDirectoryName, Platform);
            ConfigHierarchy DefaultIni = ConfigCache.ReadHierarchy(ConfigHierarchyType.Engine, (DirectoryReference)null, Platform);

            // look at all bool values
            if (BoolKeys != null)
            {
                foreach (string Key in BoolKeys)
                {
                    bool Default = false, Project = false;
                    DefaultIni.GetBool(Section, Key, out Default);
                    ProjIni.GetBool(Section, Key, out Project);
                    if (Default != Project)
                    {
                        Log.TraceInformationOnce(Key + " is not set to default. (" + Default + " vs. " + Project + ")");
                        return(false);
                    }
                }
            }

            // look at all int values
            if (IntKeys != null)
            {
                foreach (string Key in IntKeys)
                {
                    int Default = 0, Project = 0;
                    DefaultIni.GetInt32(Section, Key, out Default);
                    ProjIni.GetInt32(Section, Key, out Project);
                    if (Default != Project)
                    {
                        Log.TraceInformationOnce(Key + " is not set to default. (" + Default + " vs. " + Project + ")");
                        return(false);
                    }
                }
            }

            // look for all string values
            if (StringKeys != null)
            {
                foreach (string Key in StringKeys)
                {
                    string Default = "", Project = "";
                    DefaultIni.GetString(Section, Key, out Default);
                    ProjIni.GetString(Section, Key, out Project);
                    if (Default != Project)
                    {
                        Log.TraceInformationOnce(Key + " is not set to default. (" + Default + " vs. " + Project + ")");
                        return(false);
                    }
                }
            }

            // if we get here, we match all important settings
            return(true);
        }
예제 #12
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"));
        }
예제 #13
0
        public bool UseVulkan()
        {
            // @todo Lumin: Switch to Lumin once we have sub-platform ini
            ConfigHierarchy Ini = ConfigCache.ReadHierarchy(ConfigHierarchyType.Engine, DirectoryReference.FromFile(ProjectFile), UnrealTargetPlatform.Android);
            // go by string
            bool bUseVulkan = true;

            Ini.GetBool("/Script/LuminRuntimeSettings.LuminRuntimeSettings", "bUseVulkan", out bUseVulkan);

            return(bUseVulkan);
        }
예제 #14
0
        public bool UseVulkan()
        {
            DirectoryReference DirRef = (!string.IsNullOrEmpty(UnrealBuildTool.GetRemoteIniPath()) ? new DirectoryReference(UnrealBuildTool.GetRemoteIniPath()) : (ProjectFile != null ? ProjectFile.Directory : null));
            ConfigHierarchy    Ini    = ConfigCache.ReadHierarchy(ConfigHierarchyType.Engine, DirRef, UnrealTargetPlatform.Lumin);
            // go by string
            bool bUseVulkan = true;

            Ini.GetBool("/Script/LuminRuntimeSettings.LuminRuntimeSettings", "bUseVulkan", out bUseVulkan);

            return(bUseVulkan);
        }
예제 #15
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public static int HeapSize(ConfigHierarchy ConfigCache, string BuildType)
        {
            // defaults for this script
            int ConfigHeapSize = BuildType == "Development" ? 1024 : 512;

            // values set by editor
            bool bGotHeapSize = ConfigCache.GetInt32("/Script/HTML5PlatformEditor.HTML5TargetSettings", "HeapSize" + BuildType, out ConfigHeapSize);

            Log.TraceInformation("Setting Heap size to {0} Mb ", ConfigHeapSize);
            return(ConfigHeapSize);
        }
예제 #16
0
        private manifestApplicationComponentType GetApplicationType()
        {
            ConfigHierarchy Ini   = GetConfigCacheIni(ConfigHierarchyType.Engine);
            bool            Value = false;

            Ini.GetBool("/Script/LuminRuntimeSettings.LuminRuntimeSettings", "bIsScreensApp", out Value);
            if (Value)
            {
                return(manifestApplicationComponentType.ScreensImmersive);
            }
            return(manifestApplicationComponentType.Fullscreen);
        }
예제 #17
0
        private string GetApplicationType()
        {
            ConfigHierarchy Ini   = GetConfigCacheIni(ConfigHierarchyType.Engine);
            bool            Value = false;

            Ini.GetBool("/Script/LuminRuntimeSettings.LuminRuntimeSettings", "bIsScreensApp", out Value);
            if (Value)
            {
                return("ScreensImmersive");
            }
            return("Fullscreen");
        }
        private InstalledPlatformInfo()
        {
            List <string>   InstalledPlatforms;
            ConfigHierarchy Ini = ConfigCache.ReadHierarchy(ConfigHierarchyType.Engine, (DirectoryReference)null, UnrealTargetPlatform.Unknown);

            if (Ini.GetArray("InstalledPlatforms", "InstalledPlatformConfigurations", out InstalledPlatforms))
            {
                foreach (string InstalledPlatform in InstalledPlatforms)
                {
                    ParsePlatformConfiguration(InstalledPlatform);
                }
            }
        }
        /// <summary>
        /// Find the default architecture for the given project
        /// </summary>
        public override string GetDefaultArchitecture(FileReference ProjectFile)
        {
            string ActiveArchitecture = DefaultArchitecture;

            // read settings from the config
            string EngineIniPath = ProjectFile != null ? ProjectFile.Directory.FullName : null;

            if (String.IsNullOrEmpty(EngineIniPath))
            {
                // If the project file hasn't been specified, try to get the path from -remoteini command line param
                EngineIniPath = UnrealBuildTool.GetRemoteIniPath();
            }
            DirectoryReference EngineIniDir = !String.IsNullOrEmpty(EngineIniPath) ? new DirectoryReference(EngineIniPath) : null;

            ConfigHierarchy Ini = ConfigCache.ReadHierarchy(ConfigHierarchyType.Engine, EngineIniDir, UnrealTargetPlatform.Linux);

            string LinuxArchitectureString;

            if (Ini.GetString("/Script/LinuxTargetPlatform.LinuxTargetSettings", "TargetArchitecture", out LinuxArchitectureString))
            {
                LinuxArchitecture Architecture;
                if (Enum.TryParse(LinuxArchitectureString, out Architecture))
                {
                    switch (Architecture)
                    {
                    default:
                        System.Console.WriteLine("Architecture enum value {0} does not map to a valid triplet.", Architecture);
                        break;

                    case LinuxArchitecture.X86_64UnknownLinuxGnu:
                        ActiveArchitecture = "x86_64-unknown-linux-gnu";
                        break;

                    case LinuxArchitecture.ArmUnknownLinuxGnueabihf:
                        ActiveArchitecture = "arm-unknown-linux-gnueabihf";
                        break;

                    case LinuxArchitecture.AArch64UnknownLinuxGnueabi:
                        ActiveArchitecture = "aarch64-unknown-linux-gnueabi";
                        break;

                    case LinuxArchitecture.I686UnknownLinuxGnu:
                        ActiveArchitecture = "i686-unknown-linux-gnu";
                        break;
                    }
                }
            }

            return(ActiveArchitecture);
        }
예제 #20
0
        /// <summary>
        /// Read config settings for the given object
        /// </summary>
        /// <param name="ProjectDir">Path to the project directory</param>
        /// <param name="Platform">The platform being built</param>
        /// <param name="TargetObject">Object to receive the settings</param>
        /// <param name="Tracker">Tracks the set of config values that were retrieved. May be null.</param>
        internal static void ReadSettings(DirectoryReference ProjectDir, UnrealTargetPlatform Platform, object TargetObject, ConfigValueTracker Tracker)
        {
            List <ConfigField> Fields = FindConfigFieldsForType(TargetObject.GetType());

            foreach (ConfigField Field in Fields)
            {
                // Read the hierarchy listed
                ConfigHierarchy Hierarchy = ReadHierarchy(Field.Attribute.ConfigType, ProjectDir, Platform);

                // Get the key name
                string KeyName = Field.Attribute.KeyName ?? Field.FieldInfo.Name;

                // Get the value(s) associated with this key
                IReadOnlyList <string> Values;
                Hierarchy.TryGetValues(Field.Attribute.SectionName, KeyName, out Values);

                // Parse the values from the config files and update the target object
                if (Field.AddElement == null)
                {
                    if (Values != null && Values.Count == 1)
                    {
                        object Value;
                        if (TryParseValue(Values[0], Field.FieldInfo.FieldType, out Value))
                        {
                            Field.FieldInfo.SetValue(TargetObject, Value);
                        }
                    }
                }
                else
                {
                    if (Values != null)
                    {
                        foreach (string Item in Values)
                        {
                            object Value;
                            if (TryParseValue(Item, Field.ElementType, out Value))
                            {
                                Field.AddElement(TargetObject, Value);
                            }
                        }
                    }
                }

                // Save the dependency
                if (Tracker != null)
                {
                    Tracker.Add(Field.Attribute.ConfigType, ProjectDir, Platform, Field.Attribute.SectionName, KeyName, Values);
                }
            }
        }
예제 #21
0
        private string GetElfName(FileReference InNMakeOutputPath)
        {
            ConfigHierarchy Ini = ConfigCache.ReadHierarchy(ConfigHierarchyType.Engine, InNMakeOutputPath.Directory.ParentDirectory.ParentDirectory, UnrealTargetPlatform.Lumin);
            bool            bUseMobileRendering = false;

            Ini.GetBool("/Script/LuminRuntimeSettings.LuminRuntimeSettings", "bUseMobileRendering", out bUseMobileRendering);
            bool bUseVulkan = false;

            Ini.GetBool("/Script/LuminRuntimeSettings.LuminRuntimeSettings", "bUseVulkan", out bUseVulkan);

            string OutputFileName = string.Format("{0}-arm64-{1}{2}", InNMakeOutputPath.GetFileNameWithoutExtension(), !(bUseMobileRendering || bUseVulkan) ? "lumingl4" : "lumin", InNMakeOutputPath.GetExtension());

            return(OutputFileName);
        }
        public static bool GetPath(ConfigHierarchy Ini, string SectionName, string Key, out string Value)
        {
            string temp;

            if (Ini.TryGetValue(SectionName, Key, out temp))
            {
                return(ExtractPath(temp, out Value));
            }
            else
            {
                Value = "";
            }

            return(false);
        }
예제 #23
0
        static bool bEnableTracing       = false;   // Debug option

        public HTML5ToolChain(FileReference InProjectFile)
            : base(CppPlatform.HTML5, WindowsCompiler.VisualStudio2015)
        {
            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);

            // these will be going away...
            bool targetingAsmjs = false;           // inverted check
            bool targetWebGL1   = false;           // inverted check

            if (Ini.GetBool("/Script/HTML5PlatformEditor.HTML5TargetSettings", "TargetAsmjs", out targetingAsmjs))
            {
                targetingWasm = !targetingAsmjs;
            }
            if (Ini.GetBool("/Script/HTML5PlatformEditor.HTML5TargetSettings", "TargetWebGL1", out targetWebGL1))
            {
                targetWebGL2 = !targetWebGL1;
            }
            Ini.GetBool("/Script/HTML5PlatformEditor.HTML5TargetSettings", "EnableSIMD", out enableSIMD);
            Ini.GetBool("/Script/HTML5PlatformEditor.HTML5TargetSettings", "EnableMultithreading", out enableMultithreading);
            Ini.GetBool("/Script/HTML5PlatformEditor.HTML5TargetSettings", "EnableTracing", out bEnableTracing);
            Log.TraceInformation("HTML5ToolChain: TargetWasm = " + targetingWasm);
            Log.TraceInformation("HTML5ToolChain: TargetWebGL2 = " + targetWebGL2);
            Log.TraceInformation("HTML5ToolChain: EnableSIMD = " + enableSIMD);
            Log.TraceInformation("HTML5ToolChain: EnableMultithreading " + enableMultithreading);
            Log.TraceInformation("HTML5ToolChain: EnableTracing = " + bEnableTracing);

            // TODO: remove this "fix" when emscripten supports (SIMD & pthreads) + WASM
            if (targetingWasm)
            {
                enableSIMD = false;

                // TODO: double check Engine/Source/Runtime/Core/Private/HTML5/HTML5PlatformProcess.cpp::SupportsMultithreading()
                enableMultithreading = false;
            }
        }
예제 #24
0
        /// <summary>
        /// Setup the target environment for building
        /// </summary>
        /// <param name="InBuildTarget"> The target being built</param>
        public override void SetUpEnvironment(UEBuildTarget InBuildTarget)
        {
            InBuildTarget.GlobalCompileEnvironment.Config.Definitions.Add("PLATFORM_IOS=1");
            InBuildTarget.GlobalCompileEnvironment.Config.Definitions.Add("PLATFORM_APPLE=1");

            InBuildTarget.GlobalCompileEnvironment.Config.Definitions.Add("WITH_TTS=0");
            InBuildTarget.GlobalCompileEnvironment.Config.Definitions.Add("WITH_SPEECH_RECOGNITION=0");
            InBuildTarget.GlobalCompileEnvironment.Config.Definitions.Add("WITH_DATABASE_SUPPORT=0");
            InBuildTarget.GlobalCompileEnvironment.Config.Definitions.Add("WITH_EDITOR=0");
            InBuildTarget.GlobalCompileEnvironment.Config.Definitions.Add("USE_NULL_RHI=0");
            InBuildTarget.GlobalCompileEnvironment.Config.Definitions.Add("REQUIRES_ALIGNED_INT_ACCESS");

            ConfigHierarchy Ini = ConfigCache.ReadHierarchy(ConfigHierarchyType.Engine, DirectoryReference.FromFile(ProjectFile), UnrealTargetPlatform.IOS);

            Ini.GetBool("/Script/IOSRuntimeSettings.IOSRuntimeSettings", "bEnableRemoteNotificationsSupport", out bNotificationsEnabled);
            if (bNotificationsEnabled)
            {
                InBuildTarget.GlobalCompileEnvironment.Config.Definitions.Add("NOTIFICATIONS_ENABLED=1");
            }
            else
            {
                InBuildTarget.GlobalCompileEnvironment.Config.Definitions.Add("NOTIFICATIONS_ENABLED=0");
            }

            if (GetActiveArchitecture() == "-simulator")
            {
                InBuildTarget.GlobalCompileEnvironment.Config.Definitions.Add("WITH_SIMULATOR=1");
            }
            else
            {
                InBuildTarget.GlobalCompileEnvironment.Config.Definitions.Add("WITH_SIMULATOR=0");
            }

            // we assume now we are building with IOS8 or later
            if (UEBuildConfiguration.bCompileAgainstEngine)
            {
                InBuildTarget.GlobalCompileEnvironment.Config.Definitions.Add("HAS_METAL=1");
                InBuildTarget.ExtraModuleNames.Add("MetalRHI");
            }
            else
            {
                InBuildTarget.GlobalCompileEnvironment.Config.Definitions.Add("HAS_METAL=0");
            }

            InBuildTarget.GlobalLinkEnvironment.Config.AdditionalFrameworks.Add(new UEBuildFramework("GameKit"));
            InBuildTarget.GlobalLinkEnvironment.Config.AdditionalFrameworks.Add(new UEBuildFramework("StoreKit"));
        }
예제 #25
0
        public static bool GeneratePList(string ProjectDirectory, bool bIsUE4Game, string GameName, string ProjectName, string InEngineDir, string ExeName)
        {
            string IntermediateDirectory = (bIsUE4Game ? InEngineDir : ProjectDirectory) + "/Intermediate/Mac";
            string DestPListFile         = IntermediateDirectory + "/" + ExeName + "-Info.plist";
            string SrcPListFile          = (bIsUE4Game ? (InEngineDir + "Source/Programs/") : (ProjectDirectory + "/Source/")) + GameName + "/Resources/Mac/Info.plist";

            if (!File.Exists(SrcPListFile))
            {
                SrcPListFile = InEngineDir + "/Source/Runtime/Launch/Resources/Mac/Info.plist";
            }

            string PListData = null;

            if (File.Exists(SrcPListFile))
            {
                PListData = File.ReadAllText(SrcPListFile);
            }
            else
            {
                return(false);
            }

            // bundle identifier
            // plist replacements
            DirectoryReference DirRef = bIsUE4Game ? (!string.IsNullOrEmpty(UnrealBuildTool.GetRemoteIniPath()) ? new DirectoryReference(UnrealBuildTool.GetRemoteIniPath()) : null) : new DirectoryReference(ProjectDirectory);
            ConfigHierarchy    Ini    = ConfigCache.ReadHierarchy(ConfigHierarchyType.Engine, DirRef, UnrealTargetPlatform.IOS);

            string BundleIdentifier;

            Ini.GetString("/Script/IOSRuntimeSettings.IOSRuntimeSettings", "BundleIdentifier", out BundleIdentifier);

            string BundleVersion = MacToolChain.LoadEngineDisplayVersion();

            PListData = PListData.Replace("${EXECUTABLE_NAME}", ExeName).Replace("${APP_NAME}", BundleIdentifier.Replace("[PROJECT_NAME]", ProjectName).Replace("_", "")).Replace("${ICON_NAME}", GameName).Replace("${MACOSX_DEPLOYMENT_TARGET}", MacToolChain.Settings.MinMacOSVersion).Replace("${BUNDLE_VERSION}", BundleVersion);

            if (!Directory.Exists(IntermediateDirectory))
            {
                Directory.CreateDirectory(IntermediateDirectory);
            }
            File.WriteAllText(DestPListFile, PListData);

            return(true);
        }
예제 #26
0
        static InstalledPlatformInfo()
        {
            List <string>   InstalledPlatforms;
            ConfigHierarchy Ini = ConfigCache.ReadHierarchy(ConfigHierarchyType.Engine, (DirectoryReference)null, UnrealTargetPlatform.Unknown);

            bool bHasInstalledPlatformInfo;

            if (Ini.TryGetValue("InstalledPlatforms", "HasInstalledPlatformInfo", out bHasInstalledPlatformInfo) && bHasInstalledPlatformInfo)
            {
                InstalledPlatformConfigurations = new List <InstalledPlatformConfiguration>();
                if (Ini.GetArray("InstalledPlatforms", "InstalledPlatformConfigurations", out InstalledPlatforms))
                {
                    foreach (string InstalledPlatform in InstalledPlatforms)
                    {
                        ParsePlatformConfiguration(InstalledPlatform);
                    }
                }
            }
        }
예제 #27
0
        /// <summary>
        /// Reads a config hierarchy (or retrieve it from the cache)
        /// </summary>
        /// <param name="Type">The type of hierarchy to read</param>
        /// <param name="ProjectDir">The project directory to read the hierarchy for</param>
        /// <param name="Platform">Which platform to read platform-specific config files for</param>
        /// <returns>The requested config hierarchy</returns>
        public static ConfigHierarchy ReadHierarchy(ConfigHierarchyType Type, DirectoryReference ProjectDir, UnrealTargetPlatform Platform)
        {
            // Get the key to use for the cache. It cannot be null, so we use the engine directory if a project directory is not given.
            ConfigHierarchyKey Key = new ConfigHierarchyKey(Type, ProjectDir, Platform);

            // Try to get the cached hierarchy with this key
            ConfigHierarchy Hierarchy;

            lock (HierarchyKeyToHierarchy)
            {
                if (!HierarchyKeyToHierarchy.TryGetValue(Key, out Hierarchy))
                {
                    // Find all the input files
                    List <ConfigFile> Files = new List <ConfigFile>();
                    foreach (FileReference IniFileName in ConfigHierarchy.EnumerateConfigFileLocations(Type, ProjectDir, Platform))
                    {
                        ConfigFile File;
                        if (TryReadFile(IniFileName, out File))
                        {
                            Files.Add(File);
                        }
                    }

                    // Handle command line overrides
                    string[] CmdLine            = Environment.GetCommandLineArgs();
                    string   IniConfigArgPrefix = "-ini:" + Enum.GetName(typeof(ConfigHierarchyType), Type) + ":";
                    foreach (string CmdLineArg in CmdLine)
                    {
                        if (CmdLineArg.StartsWith(IniConfigArgPrefix))
                        {
                            ConfigFile OverrideFile = new ConfigFile(CmdLineArg.Substring(IniConfigArgPrefix.Length));
                            Files.Add(OverrideFile);
                        }
                    }

                    // Create the hierarchy
                    Hierarchy = new ConfigHierarchy(Files);
                    HierarchyKeyToHierarchy.Add(Key, Hierarchy);
                }
            }
            return(Hierarchy);
        }
예제 #28
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public static int HeapSize(ConfigHierarchy ConfigCache, string BuildType)
        {
            int ConfigHeapSize = 0;

            // Valuer set by Editor UI
            var bGotHeapSize = ConfigCache.GetInt32("/Script/HTML5PlatformEditor.HTML5TargetSettings", "HeapSize" + BuildType, out ConfigHeapSize);

            // Fallback if the previous method failed
            if (!bGotHeapSize && !ConfigCache.GetInt32("/Script/BuildSettings.BuildSettings", "HeapSize" + BuildType, out ConfigHeapSize))
            {
                // we couldn't find a per config heap size, look for a common one.
                if (!ConfigCache.GetInt32("/Script/BuildSettings.BuildSettings", "HeapSize", out ConfigHeapSize))
                {
                    ConfigHeapSize = BuildType == "Development" ? 1024 : 512;
                    Log.TraceInformation("Could not find Heap Size setting in .ini for Client config {0}", BuildType);
                }
            }

            Log.TraceInformation("Setting Heap size to {0} Mb ", ConfigHeapSize);
            return(ConfigHeapSize);
        }
예제 #29
0
        private void GetAppPrivileges(ConfigHierarchy EngineIni, StringBuilder Text)
        {
            List <string> AppPrivileges;

            EngineIni.GetArray("/Script/LuminRuntimeSettings.LuminRuntimeSettings", "AppPrivileges", out AppPrivileges);
            if (AppPrivileges != null)
            {
                foreach (string Privilege in AppPrivileges)
                {
                    string TrimmedPrivilege = Privilege.Trim(' ');
                    if (TrimmedPrivilege != "")
                    {
                        string PrivilegeString = string.Format("\t\t\t<uses-privilege ml:name=\"{0}\"/>", TrimmedPrivilege);
                        if (!Text.ToString().Contains(PrivilegeString))
                        {
                            Text.AppendLine(PrivilegeString);
                        }
                    }
                }
            }
        }
        private bool SetupGraphicsDebugger(ReadOnlyTargetRules Target, CppCompileEnvironment CompileEnvironment, LinkEnvironment LinkEnvironment)
        {
            string          AndroidGraphicsDebugger;
            ConfigHierarchy Ini = ConfigCache.ReadHierarchy(ConfigHierarchyType.Engine, DirectoryReference.FromFile(Target.ProjectFile), UnrealTargetPlatform.Android);

            Ini.GetString("/Script/AndroidRuntimeSettings.AndroidRuntimeSettings", "AndroidGraphicsDebugger", out AndroidGraphicsDebugger);

            if (AndroidGraphicsDebugger.ToLower() == "renderdoc")
            {
                string RenderDocPath;
                AndroidPlatformSDK.GetPath(Ini, "/Script/AndroidRuntimeSettings.AndroidRuntimeSettings", "RenderDocPath", out RenderDocPath);
                string RenderDocLibPath = Path.Combine(RenderDocPath, @"android\lib\armeabi-v7a");
                if (Directory.Exists(RenderDocLibPath))
                {
                    LinkEnvironment.LibraryPaths.Add(new DirectoryReference(RenderDocLibPath));
                    LinkEnvironment.AdditionalLibraries.Add("VkLayer_GLES_RenderDoc");
                    return(true);
                }
            }

            return(false);
        }