Esempio n. 1
0
        /// <summary>
        /// Execute the task and run the cooker.
        /// </summary>
        /// <param name="BuildProducts">List of build products for the current node. Cooking build products will be appended to this list.</param>
        /// <returns>True if the node succeeded</returns>
        public override bool Execute(List <string> BuildProducts)
        {
            // Figure out the project that this target belongs to
            FileReference ProjectFile;

            if (UProjectInfo.TryGetProjectForTarget(Target, out ProjectFile))
            {
                ProjectFile = null;
            }

            // Execute the cooker
            using (TelemetryStopwatch CookStopwatch = new TelemetryStopwatch("Cook.{0}.{1}", ProjectFile.GetFileNameWithoutExtension(), CookPlatform))
            {
                CommandUtils.CookCommandlet(ProjectFile, "UE4Editor-Cmd.exe", Maps, null, null, null, CookPlatform, Arguments);
            }

            // Find all the cooked files
            DirectoryReference   CookedDirectory = DirectoryReference.Combine(ProjectFile.Directory, "Saved", "Cooked", CookPlatform);
            List <FileReference> CookedFiles     = CookedDirectory.EnumerateFileReferences().ToList();

            if (CookedFiles.Count == 0)
            {
                throw new AutomationException("Cooking did not produce any files in {0}", CookedDirectory.FullName);
            }
            BuildProducts.AddRange(CookedFiles.Select(x => x.FullName));
            return(true);
        }
Esempio n. 2
0
    public LibuvSupport(ReadOnlyTargetRules Target) : base(Target)
    {
        /*
         * PublicIncludePaths.AddRange(
         *  new string[] {
         *      "LibuvSupport/"
         *  }
         *  );
         *
         * PrivateIncludePaths.AddRange(
         *  new string[] {
         *      "LibuvSupport"
         *  }
         *  );
         */
        PublicDependencyModuleNames.AddRange(new string[] {
            "Core", "CoreUObject", "Engine"
        });

        RulesAssembly RA;
        FileReference CheckProjectFile;

        UProjectInfo.TryGetProjectForTarget("NeverSalvation", out CheckProjectFile);
        RA = RulesCompiler.CreateProjectRulesAssembly(CheckProjectFile);
        FileReference FR         = RA.GetModuleFileName(this.GetType().Name);
        string        ModulePath = Path.GetDirectoryName(FR.CanonicalName);

        string ThirdPartyPath                  = Path.GetFullPath(Path.Combine(ModulePath, "../../ThirdParty/")); // gets the ThirdParty folder directory path
        string LibuvConnectorPath              = ThirdPartyPath + "libuv/";                                       // gets the Libuv Connector.C 6.1 folder path
        string LibuvConnectorLibraryPath       = LibuvConnectorPath + "lib/";                                     // gets the path of the lib folder
        string LibuvConnectorIncludePath       = LibuvConnectorPath + "include/";                                 // gets the path of the include folder
        string LibuvConnectorImportLibraryName = Path.Combine(LibuvConnectorLibraryPath, "libuv.lib");            // gets the file path and name of the libmysql.lib static import library
        string LibuvConnectorDLLName           = Path.Combine(LibuvConnectorLibraryPath, "libuv.dll");

        if (!File.Exists(LibuvConnectorImportLibraryName))                                                       // check to ensure the static import lib can be located, or else we'll be in trouble
        {
            throw new BuildException(string.Format("{0} could not be found.", LibuvConnectorImportLibraryName)); // log an error message explaining what went wrong if not found
        }
        if (!File.Exists(LibuvConnectorDLLName))                                                                 // check to make sure the dll can be located or else we'll be in trouble
        {
            throw new BuildException(string.Format("{0} could not be found.", LibuvConnectorDLLName));           // log an error message explaining what went wrong if not found
        }
        PublicIncludePaths.Add(LibuvConnectorIncludePath);                                                       // add the "include" folder to our dependencies. I've chosen PrivateIncludePaths since I hide the mysql headers from external code
        PublicLibraryPaths.Add(LibuvConnectorLibraryPath);                                                       // add the "lib" folder to our dependencies
        PublicAdditionalLibraries.Add(LibuvConnectorImportLibraryName);                                          // add libmysql.lib static import library as a dependency
        PublicDelayLoadDLLs.Add(LibuvConnectorDLLName);                                                          // add libmysql.dll as a dll
        RuntimeDependencies.Add(new RuntimeDependency("$(ProjectDir)/Binaries/Win64/libuv.dll"));                // 自动添加libmysql.dll到指定的打包目录中
    }
Esempio n. 3
0
        /// <summary>
        /// Optionally compiles and loads target rules assembly.
        /// </summary>
        /// <param name="Properties"></param>
        /// <param name="TargetsDllFilename"></param>
        /// <param name="DoNotCompile"></param>
        /// <param name="TargetScripts"></param>
        private static void CompileAndLoadTargetsAssembly(ProjectProperties Properties, FileReference TargetsDllFilename, bool DoNotCompile, List <FileReference> TargetScripts)
        {
            CommandUtils.LogVerbose("Compiling targets DLL: {0}", TargetsDllFilename);

            var ReferencedAssemblies = new List <string>()
            {
                "System.dll",
                "System.Core.dll",
                "System.Xml.dll",
                typeof(UnrealBuildTool.PlatformExports).Assembly.Location
            };
            var TargetsDLL       = DynamicCompilation.CompileAndLoadAssembly(TargetsDllFilename, TargetScripts, ReferencedAssemblies, null, DoNotCompile);
            var AllCompiledTypes = TargetsDLL.GetTypes();

            foreach (Type TargetType in AllCompiledTypes)
            {
                // Find TargetRules but skip all "UE4Editor", "UE4Game" targets.
                if (typeof(TargetRules).IsAssignableFrom(TargetType))
                {
                    string TargetName = GetTargetName(TargetType);

                    FileReference ProjectFile;
                    UProjectInfo.TryGetProjectForTarget(TargetName, out ProjectFile);

                    var DummyTargetInfo = new TargetInfo(TargetName, BuildHostPlatform.Current.Platform, UnrealTargetConfiguration.Development, "", ProjectFile);

                    // Create an instance of this type
                    CommandUtils.LogVerbose("Creating target rules object: {0}", TargetType.Name);
                    var Rules = Activator.CreateInstance(TargetType, DummyTargetInfo) as TargetRules;
                    CommandUtils.LogVerbose("Adding target: {0} ({1})", TargetType.Name, Rules.Type);

                    SingleTargetProperties TargetData;
                    TargetData.TargetName = GetTargetName(TargetType);
                    TargetData.Rules      = Rules;
                    if (Rules.Type == global::UnrealBuildTool.TargetType.Program)
                    {
                        Properties.Programs.Add(TargetData);
                    }
                    else
                    {
                        Properties.Targets.Add(Rules.Type, TargetData);
                    }
                }
            }
        }
Esempio n. 4
0
    public MyProj(ReadOnlyTargetRules Target) : base(Target)
    {
        PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs;

        PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore" });

        FileReference CheckProjectFile;

        UProjectInfo.TryGetProjectForTarget("MyProj", out CheckProjectFile);
        r = RulesCompiler.CreateProjectRulesAssembly(CheckProjectFile);

        if ((Target.Platform == UnrealTargetPlatform.Win32) || (Target.Platform == UnrealTargetPlatform.Win64))
        {
            bEnableExceptions = true;
        }

        LoadProtobuf(Target);
    }
Esempio n. 5
0
    public MySQLConnectorUE4Plugin(TargetInfo Target)
    {
        //File.WriteAllText("c:/temp/qqq.txt", this.GetType().Name);
        //string ModulePath = Path.GetDirectoryName( RulesAssembly.GetModuleFilename( this.GetType().Name ) );

        UEBuildConfiguration.bForceEnableExceptions = true;

        RulesAssembly r;
        FileReference CheckProjectFile;

        UProjectInfo.TryGetProjectForTarget("MyGame", out CheckProjectFile);

        r = RulesCompiler.CreateProjectRulesAssembly(CheckProjectFile);
        FileReference f = r.GetModuleFileName(this.GetType().Name);
        //File.WriteAllText("c:/temp/qqq2.txt", f.CanonicalName );

        string ModulePath     = Path.GetDirectoryName(f.CanonicalName);
        string PlatformString = (Target.Platform == UnrealTargetPlatform.Win64) ? "x64" : "x86";
        string ThirdPartyPath = Path.GetFullPath(Path.Combine(ModulePath, "../../ThirdParty/"));

        string LibrariesPath = Path.Combine(ThirdPartyPath, "MySQLConnector", "Lib");

        string LibraryName = Path.Combine(LibrariesPath, "mariadbclient." + PlatformString + ".lib");

        PublicAdditionalLibraries.Add(LibraryName);

        PrivateIncludePaths.AddRange(new string[] { "MySQLConnectorUE4Plugin/Private" });
        PublicIncludePaths.AddRange(new string[] { "MySQLConnectorUE4Plugin/Public" });

        string IncludesPath = Path.Combine(ThirdPartyPath, "MySQLConnector", "Include");

        PublicIncludePaths.Add(IncludesPath);

        string IncludesPath2 = Path.Combine(ThirdPartyPath, "MySQLConnector", "Include", "cppconn");

        PublicIncludePaths.Add(IncludesPath2);

        PublicDependencyModuleNames.AddRange(new string[] { "Engine", "Core", "CoreUObject" });
    }