예제 #1
0
        public UE4Cardboard(TargetInfo Target)
        {
            PrivateIncludePaths.AddRange(
                new string[] {
                "SimpleHMD/Private",
                Path.GetDirectoryName(RulesCompiler.GetModuleFilename("Renderer")) + "/Private",
                // ... add other private include paths required here ...
            }
                );

            PrivateDependencyModuleNames.AddRange(
                new string[]
            {
                "Core",
                "CoreUObject",
                "Engine",
                "InputCore",
                "RHI",
                "RenderCore",
                "Renderer",
                "ShaderCore",
                "HeadMountedDisplay"
            }
                );
        }
    public WeatherApp(ReadOnlyTargetRules Target) : base(Target)
    {
        PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs;

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

        PrivateDependencyModuleNames.AddRange(new string[] {  });

        // Uncomment if you are using Slate UI
        // PrivateDependencyModuleNames.AddRange(new string[] { "Slate", "SlateCore" });

        // Uncomment if you are using online features
        // PrivateDependencyModuleNames.Add("OnlineSubsystem");


        /////////////////////////////
        var path = Path.GetDirectoryName(RulesCompiler.GetFileNameFromType(this.GetType()));

        PublicIncludePaths.Add(Path.Combine(path, "sqlite", "bin"));

        //PublicDelayLoadDLLs.Add("mylib.dll");
        PublicAdditionalLibraries.Add(Path.Combine(path, "sqlite", "bin", "sqlite3.lib"));

        // To include OnlineSubsystemSteam, add it to the plugins section in your uproject file with the Enabled attribute set to true
    }
예제 #3
0
    private void AddMyInclude(string path)
    {
        string ModulePath = Path.GetDirectoryName(RulesCompiler.GetModuleFilename(this.GetType().Name));
        string IncDir     = Path.GetFullPath(Path.Combine(ModulePath, "../../", path));

        PrivateIncludePaths.Add(IncDir);
    }
        public bool LoadFMRTTSLib(TargetInfo Target)
        {
            bool   isLibrarySupported = false;
            string filename           = "";

            if ((Target.Platform == UnrealTargetPlatform.Win64) || (Target.Platform == UnrealTargetPlatform.Win32))
            {
                isLibrarySupported = true;
                if (Target.Platform == UnrealTargetPlatform.Win64)
                {
                    filename = "FMRTTSLib.x64.lib";
                }
                else if (Target.Platform == UnrealTargetPlatform.Win32)
                {
                    filename = "FMRTTSLib.x86.lib";
                }

                if (filename != "")
                {
                    // path to directory where this .Build.cs is located
                    string BaseDir = Path.GetDirectoryName(RulesCompiler.GetModuleFilename(this.GetType().Name));
                    PublicLibraryPaths.Add(Path.Combine(BaseDir, "../FMRTTSLib"));
                    PublicAdditionalLibraries.Add(filename);
                    PrivateIncludePaths.Add("FMRTTSLib/FMRTTSLib.h");
                    Definitions.Add(string.Format("WITH_FMRTTSLIB={0}", isLibrarySupported ? 1 : 0));
                }
            }
            return(isLibrarySupported);
        }
예제 #5
0
        /** Setup an external C++ module */
        private void SetupLibNpp2(TargetInfo target)
        {
            // Resolve import path
            var    base_path = Path.GetFullPath(Path.Combine(Path.GetDirectoryName(RulesCompiler.GetModuleFilename(this.GetType().Name)), "../../libnpp"));
            var    includes  = Path.Combine(base_path, "src/npp");
            string library   = "undefined";

            if ((target.Platform == UnrealTargetPlatform.Win64) || (target.Platform == UnrealTargetPlatform.Win32))
            {
                library = Path.Combine(base_path, "build/libnpp.lib");
            }
            else
            {
                library = Path.Combine(base_path, "build/libnpp.a");
            }

            // Log messages to report folder correctness
            Log.TraceError(includes);
            Log.TraceError(library);

            // Verify build correctness
            if (!File.Exists(library))
            {
                throw new Exception("Please run cmake first to build the project");
            }
            if (!Directory.Exists(includes))
            {
                throw new Exception("Invalid build path.");
            }

            // Add reference to external library
            PublicIncludePaths.Add(includes);
            PublicAdditionalLibraries.Add(library);
        }
예제 #6
0
    private void AddMyLibrary(string path)
    {
        string ModulePath = Path.GetDirectoryName(RulesCompiler.GetModuleFilename(this.GetType().Name));
        string LibPath    = Path.GetFullPath(Path.Combine(ModulePath, "../../", path));

        PublicAdditionalLibraries.Add(LibPath);
    }
예제 #7
0
    public void LoadLib(TargetInfo Target)
    {
        string ModulePath = Path.GetDirectoryName(RulesCompiler.GetModuleFilename(this.GetType().Name));
        string extension  = UEBuildPlatform.GetBuildPlatform(Target.Platform).GetBinaryExtension(UEBuildBinaryType.StaticLibrary);

        // CZMQ
        string czmqPath = Path.GetFullPath(Path.Combine(ModulePath, "../../../../ThirdParty/", Target.Platform.ToString(), "czmq"));

        PublicAdditionalLibraries.Add(Path.Combine(czmqPath, "Libraries", "czmq" + extension));
        PrivateIncludePaths.Add(Path.Combine(czmqPath, "Includes"));

        // LIBZMQ
        string libzmqPath = Path.GetFullPath(Path.Combine(ModulePath, "../../../../ThirdParty/", Target.Platform.ToString(), "libzmq"));

        if (Directory.Exists(Path.Combine(libzmqPath, "Libraries")))
        {
            PublicAdditionalLibraries.Add(Path.Combine(libzmqPath, "Libraries", "libzmq" + extension));
        }
        PrivateIncludePaths.Add(Path.Combine(libzmqPath, "Includes"));

        // Libsodium
        string libsodiumPath = Path.GetFullPath(Path.Combine(ModulePath, "../../../../ThirdParty/", Target.Platform.ToString(), "libsodium"));

        if (Directory.Exists(Path.Combine(libsodiumPath, "Libraries")))
        {
            PublicAdditionalLibraries.Add(Path.Combine(libsodiumPath, "Libraries", "libsodium" + extension));
        }
    }
예제 #8
0
    public Frames(TargetInfo Target)
    {
        PublicDependencyModuleNames.AddRange(new string[] {
            "Core",        // needed for many many things
            "CoreUObject", // for UObject
            //"InputCore",  // almost certain to be re-added
            "Engine",      // for AHUD
            "RenderCore",  // render queueing
            "ShaderCore",  // shader machinery
            "RHI",         // for actual rendering
        });

        // We need to figure out the engine version so we know which directory to look in.
        // Unfortunately there is apparently no good way to do this, so we try pulling it from version.h.
        string vMajor = "4";
        string vMinor = "1";
        {
            string vHeader = Utils.ReadAllText("../Source/Runtime/Launch/Resources/Version.h");
            Match  mMajor  = new Regex(@"#define ENGINE_MAJOR_VERSION\t([^\r\n]+)").Match(vHeader);
            Match  mMinor  = new Regex(@"#define ENGINE_MINOR_VERSION\t([^\r\n]+)").Match(vHeader);
            if (mMajor.Success && mMinor.Success)
            {
                vMajor = mMajor.Groups[1].Value;
                vMinor = mMinor.Groups[1].Value;
            }
        }

        string UESlug = "ue" + vMajor + "_" + vMinor;

        string PlatformString       = (Target.Platform == UnrealTargetPlatform.Win64) ? "x64" : "x32";
        string PlatformStringFrames = (Target.Platform == UnrealTargetPlatform.Win64) ? "win64" : "win32";
        string DirectoryName        = Path.GetDirectoryName(RulesCompiler.GetModuleFilename(this.GetType().Name));
        string FramesBase;

        if (File.Exists(Path.Combine(DirectoryName, "..", "ThirdParty", "FramesDeps", "lib", UESlug, "x32", "frames.lib")))
        {
            FramesBase = Path.Combine(DirectoryName, "..", "ThirdParty", "FramesDeps");
        }
        else
        {
            FramesBase = Path.Combine(DirectoryName, "..", "..", "..", "..", "..");
        }

        // choose appropriate libraries
        if (Target.Configuration == UnrealTargetConfiguration.Debug || Target.Configuration == UnrealTargetConfiguration.DebugGame)
        {
            PublicAdditionalLibraries.Add(Path.Combine(FramesBase, "lib", UESlug, PlatformString, "framesd.lib"));
        }
        else
        {
            PublicAdditionalLibraries.Add(Path.Combine(FramesBase, "lib", UESlug, PlatformString, "frames.lib"));
        }

        PublicAdditionalLibraries.Add(Path.Combine(FramesBase, "deps", "jpeg-9", PlatformStringFrames, "lib", "jpeg.lib"));
        PublicDependencyModuleNames.AddRange(new string[] { "FreeType2", "UElibPNG", "zlib" });

        PublicIncludePaths.Add(Path.Combine(FramesBase, "include"));
        PublicIncludePaths.Add(Path.Combine(FramesBase, "deps", "boost_1_55_0"));
    }
예제 #9
0
    public COMDLLAPI(ReadOnlyTargetRules Target) : base(Target)
    {
        PCHUsage = ModuleRules.PCHUsageMode.UseExplicitOrSharedPCHs;

        PublicIncludePaths.AddRange(
            new string[] {
            "COMDLLAPI/Public"
            // ... add public include paths required here ...
        }
            );


        PrivateIncludePaths.AddRange(
            new string[] {
            "COMDLLAPI/Private",
            // ... add other private include paths required here ...
        }
            );


        PublicDependencyModuleNames.AddRange(
            new string[]
        {
            "Core",
            // ... add other public dependencies that you statically link with here ...
        }
            );


        PrivateDependencyModuleNames.AddRange(
            new string[]
        {
            "CoreUObject",
            "Engine",
            "Slate",
            "SlateCore",
            // ... add private dependencies that you statically link with here ...
        }
            );


        DynamicallyLoadedModuleNames.AddRange(
            new string[]
        {
            // ... add any modules that your module loads dynamically here ...
        }
            );
        var basePath = Path.GetDirectoryName(RulesCompiler.GetFileNameFromType(GetType()));

        PublicAdditionalLibraries.Add(basePath + @"/../../Binaries/Win64/MedicalHardware.lib");
        PublicAdditionalLibraries.Add("atls.lib");
    }
예제 #10
0
    public BeatBeat(ReadOnlyTargetRules Target) : base(Target)
    {
        PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs;

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

        PrivateDependencyModuleNames.AddRange(new string[] { });

        //Include ThirdParty Plugins
        //**FMOD**//
        var    basePath       = Path.GetDirectoryName(RulesCompiler.GetFileNameFromType(GetType()));
        string thirdPartyPath = Path.Combine(basePath, "..", "..", "ThirdParty");

        PublicIncludePaths.Add(Path.Combine(thirdPartyPath, "FMOD", "inc"));

        switch (Target.Platform)
        {
        case UnrealTargetPlatform.Win64:
            PublicLibraryPaths.Add(Path.Combine(thirdPartyPath, "FMOD", "lib", "Win64"));
            PublicAdditionalLibraries.Add("fmod64_vc.lib");
            string fmodDllPath = Path.Combine(thirdPartyPath, "FMOD", "lib", "Win64", "fmod64.dll");
            RuntimeDependencies.Add(new RuntimeDependency(fmodDllPath));

            string binariesDir = Path.Combine(basePath, "..", "..", "Binaries", "Win64");
            if (!Directory.Exists(binariesDir))
            {
                System.IO.Directory.CreateDirectory(binariesDir);
            }

            string fmodDllDest = System.IO.Path.Combine(binariesDir, "fmod64.dll");
            CopyFile(fmodDllPath, fmodDllDest);
            PublicDelayLoadDLLs.AddRange(new string[] { "fmod64.dll" });

            break;

        case UnrealTargetPlatform.Android:

            break;

        default:
            throw new System.Exception(System.String.Format("Unsupported platform {0}", Target.Platform.ToString()));
        }

        // Uncomment if you are using Slate UI
        // PrivateDependencyModuleNames.AddRange(new string[] { "Slate", "SlateCore" });

        // Uncomment if you are using online features
        // PrivateDependencyModuleNames.Add("OnlineSubsystem");

        // To include OnlineSubsystemSteam, add it to the plugins section in your uproject file with the Enabled attribute set to true
    }
예제 #11
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到指定的打包目录中
    }
예제 #12
0
    public SQLite3UE4Plugin(TargetInfo Target)
    {
        string ModulePath     = Path.GetDirectoryName(RulesCompiler.GetModuleFilename(this.GetType().Name));
        string PlatformString = (Target.Platform == UnrealTargetPlatform.Win64) ? "x64" : "x86";
        string ThirdPartyPath = Path.GetFullPath(Path.Combine(ModulePath, "../../ThirdParty/"));
        string LibrariesPath  = Path.Combine(ThirdPartyPath, "SQLite3", "Lib");
        string IncludesPath   = Path.Combine(ThirdPartyPath, "SQLite3", "Include");
        string LibraryName    = Path.Combine(LibrariesPath, "SQLite3." + PlatformString + ".lib");

        PrivateIncludePaths.AddRange(new string[] { "SQLite3UE4Plugin/Private" });
        PublicIncludePaths.AddRange(new string[] { "SQLite3UE4Plugin/Public" });
        PublicAdditionalLibraries.Add(LibraryName);
        PublicIncludePaths.Add(IncludesPath);

        PublicDependencyModuleNames.AddRange(new string[] { "Engine", "Core", "CoreUObject" });
    }
    public Tutorial_spectrum(ReadOnlyTargetRules Target) : base(Target)
    {
        PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs;

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

        var    basePath       = Path.GetDirectoryName(RulesCompiler.GetFileNameFromType(GetType()));
        string thirdPartyPath = Path.Combine(basePath, "..", "..", "Thirdparty");


        //FMOD
        PublicIncludePaths.Add(Path.Combine(thirdPartyPath, "FMOD", "Includes"));

        switch (Target.Platform)
        {
        case UnrealTargetPlatform.Win64:
            PublicLibraryPaths.Add(Path.Combine(thirdPartyPath, "FMOD", "Libraries", "Win64"));
            PublicAdditionalLibraries.Add("fmod64_vc.lib");
            string fmodDllPath = Path.Combine(thirdPartyPath, "FMOD", "Libraries", "Win64", "fmod64.dll");
            RuntimeDependencies.Add(new RuntimeDependency(fmodDllPath));

            string binariesDir = Path.Combine(basePath, "..", "..", "Binaries", "Win64");
            if (!Directory.Exists(binariesDir))
            {
                System.IO.Directory.CreateDirectory(binariesDir);
            }

            string fmodDllDest = System.IO.Path.Combine(binariesDir, "fmod64.dll");
            CopyFile(fmodDllPath, fmodDllDest);
            PublicDelayLoadDLLs.AddRange(new string[] { "fmod64.dll" });

            break;

        case UnrealTargetPlatform.Android:
            PublicLibraryPaths.Add(Path.Combine(thirdPartyPath, "FMOD", "Libraries", "Android", "armeabi-v7a"));
            PublicLibraryPaths.Add(Path.Combine(thirdPartyPath, "FMOD", "Libraries", "Android", "arm64-v8a"));
            PublicAdditionalLibraries.Add("fmod");
            string RelAPLPath = Utils.MakePathRelativeTo(System.IO.Path.Combine(thirdPartyPath, "FMOD", "FMOD_APL.xml"), Target.RelativeEnginePath);
            AdditionalPropertiesForReceipt.Add(new ReceiptProperty("AndroidPlugin", RelAPLPath));
            break;

        default:
            throw new System.Exception(System.String.Format("Unsupported platform {0}", Target.Platform.ToString()));
        }
    }
예제 #14
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);
    }
예제 #15
0
    public VRPN(TargetInfo Target)
    {
        Type = ModuleType.External;

        string basePath = Path.GetDirectoryName(RulesCompiler.GetModuleFilename(this.GetType().Name));

        PublicSystemIncludePaths.Add(Path.Combine(basePath, "include"));

        if (Target.Platform == UnrealTargetPlatform.Win64)
        {
            PublicLibraryPaths.Add(Path.Combine(basePath, "lib", "win64"));
            PublicAdditionalLibraries.Add("vrpn.lib");
        }
        else if (Target.Platform == UnrealTargetPlatform.Linux)
        {
            PublicLibraryPaths.Add(Path.Combine(basePath, "lib", "linux"));
            PublicAdditionalLibraries.Add(Path.Combine(basePath, "lib", "linux", "vrpn.a"));
            PublicAdditionalLibraries.Add(Path.Combine(basePath, "lib", "linux", "quat.a"));
        }
    }
예제 #16
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" });
    }
        /// <summary>
        /// Finds all targets for the project.
        /// </summary>
        /// <param name="Properties">Project properties.</param>
        /// <param name="ExtraSearchPaths">Additional search paths.</param>
        private static void DetectTargetsForProject(ProjectProperties Properties, List <string> ExtraSearchPaths = null)
        {
            Properties.Targets = new Dictionary <TargetType, SingleTargetProperties>();
            FileReference TargetsDllFilename;
            string        FullProjectPath = null;

            var GameFolders = new List <DirectoryReference>();
            var RulesFolder = new DirectoryReference(GetRulesAssemblyFolder());

            if (Properties.RawProjectPath != null)
            {
                CommandUtils.LogVerbose("Looking for targets for project {0}", Properties.RawProjectPath);

                TargetsDllFilename = FileReference.Combine(RulesFolder, String.Format("UATRules{0}.dll", Properties.RawProjectPath.GetHashCode()));

                FullProjectPath = CommandUtils.GetDirectoryName(Properties.RawProjectPath.FullName);
                GameFolders.Add(new DirectoryReference(FullProjectPath));
                CommandUtils.LogVerbose("Searching for target rule files in {0}", FullProjectPath);
            }
            else
            {
                TargetsDllFilename = FileReference.Combine(RulesFolder, String.Format("UATRules{0}.dll", "_BaseEngine_"));
            }

            // the UBT code assumes a certain CWD, but artists don't have this CWD.
            var  SourceDir = CommandUtils.CombinePaths(CommandUtils.CmdEnv.LocalRoot, "Engine", "Source");
            bool DirPushed = false;

            if (CommandUtils.DirectoryExists_NoExceptions(SourceDir))
            {
                CommandUtils.PushDir(SourceDir);
                DirPushed = true;
            }
            var ExtraSearchDirectories = (ExtraSearchPaths == null)? null : ExtraSearchPaths.Select(x => new DirectoryReference(x)).ToList();
            var TargetScripts          = RulesCompiler.FindAllRulesSourceFiles(RulesCompiler.RulesFileType.Target, GameFolders: GameFolders, ForeignPlugins: null, AdditionalSearchPaths: ExtraSearchDirectories, bIncludeEnterprise: false);

            if (DirPushed)
            {
                CommandUtils.PopDir();
            }

            if (!CommandUtils.IsNullOrEmpty(TargetScripts))
            {
                // We only care about project target script so filter out any scripts not in the project folder, or take them all if we are just doing engine stuff
                var ProjectTargetScripts = new List <FileReference>();
                foreach (var TargetScript in TargetScripts)
                {
                    if (FullProjectPath == null || TargetScript.IsUnderDirectory(new DirectoryReference(FullProjectPath)))
                    {
                        ProjectTargetScripts.Add(TargetScript);
                    }
                }
                TargetScripts = ProjectTargetScripts;
            }

            if (!CommandUtils.IsNullOrEmpty(TargetScripts))
            {
                CommandUtils.LogVerbose("Found {0} target rule files:", TargetScripts.Count);
                foreach (var Filename in TargetScripts)
                {
                    CommandUtils.LogVerbose("  {0}", Filename);
                }

                // Check if the scripts require compilation
                bool DoNotCompile = false;
                if (!CommandUtils.IsBuildMachine && !CheckIfScriptAssemblyIsOutOfDate(TargetsDllFilename, TargetScripts))
                {
                    Log.TraceVerbose("Targets DLL {0} is up to date.", TargetsDllFilename);
                    DoNotCompile = true;
                }
                if (!DoNotCompile && CommandUtils.FileExists_NoExceptions(TargetsDllFilename.FullName))
                {
                    if (!CommandUtils.DeleteFile_NoExceptions(TargetsDllFilename.FullName, true))
                    {
                        DoNotCompile = true;
                        CommandUtils.LogVerbose("Could not delete {0} assuming it is up to date and reusable for a recursive UAT call.", TargetsDllFilename);
                    }
                }

                CompileAndLoadTargetsAssembly(Properties, TargetsDllFilename, DoNotCompile, TargetScripts);
            }
        }
        /// <summary>
        /// Attempts to autodetect project properties.
        /// </summary>
        /// <param name="RawProjectPath">Full project path.</param>
        /// <returns>Project properties.</returns>
        private static ProjectProperties DetectProjectProperties(FileReference RawProjectPath, List <UnrealTargetPlatform> ClientTargetPlatforms, bool AssetNativizationRequested)
        {
            var Properties = new ProjectProperties();

            Properties.RawProjectPath = RawProjectPath;

            // detect if the project is content only, but has non-default build settings
            List <string> ExtraSearchPaths = null;

            if (RawProjectPath != null)
            {
                string TempTargetDir = CommandUtils.CombinePaths(Path.GetDirectoryName(RawProjectPath.FullName), "Intermediate", "Source");
                if (RequiresTempTarget(RawProjectPath, ClientTargetPlatforms, AssetNativizationRequested))
                {
                    GenerateTempTarget(RawProjectPath);
                    Properties.bWasGenerated = true;
                    ExtraSearchPaths         = new List <string>();
                    ExtraSearchPaths.Add(TempTargetDir);
                }
                else if (File.Exists(Path.Combine(Path.GetDirectoryName(RawProjectPath.FullName), "Intermediate", "Source", Path.GetFileNameWithoutExtension(RawProjectPath.FullName) + ".Target.cs")))
                {
                    File.Delete(Path.Combine(Path.GetDirectoryName(RawProjectPath.FullName), "Intermediate", "Source", Path.GetFileNameWithoutExtension(RawProjectPath.FullName) + ".Target.cs"));
                }

                // in case the RulesCompiler (what we use to find all the
                // Target.cs files) has already cached the contents of this
                // directory, then we need to invalidate that cache (so
                // it'll find/use the new Target.cs file)
                RulesCompiler.InvalidateRulesFileCache(TempTargetDir);
            }

            if (CommandUtils.CmdEnv.HasCapabilityToCompile)
            {
                DetectTargetsForProject(Properties, ExtraSearchPaths);
                Properties.bIsCodeBasedProject = !CommandUtils.IsNullOrEmpty(Properties.Targets) || !CommandUtils.IsNullOrEmpty(Properties.Programs);
            }
            else
            {
                // should never ask for engine targets if we can't compile
                if (RawProjectPath == null)
                {
                    throw new AutomationException("Cannot determine engine targets if we can't compile.");
                }

                Properties.bIsCodeBasedProject = Properties.bWasGenerated;
                // if there's a Source directory with source code in it, then mark us as having source code
                string SourceDir = CommandUtils.CombinePaths(Path.GetDirectoryName(RawProjectPath.FullName), "Source");
                if (Directory.Exists(SourceDir))
                {
                    string[] CppFiles = Directory.GetFiles(SourceDir, "*.cpp", SearchOption.AllDirectories);
                    string[] HFiles   = Directory.GetFiles(SourceDir, "*.h", SearchOption.AllDirectories);
                    Properties.bIsCodeBasedProject |= (CppFiles.Length > 0 || HFiles.Length > 0);
                }
            }

            // check to see if the uproject loads modules, only if we haven't already determined it is a code based project
            if (!Properties.bIsCodeBasedProject && RawProjectPath != null)
            {
                string uprojectStr = File.ReadAllText(RawProjectPath.FullName);
                Properties.bIsCodeBasedProject = uprojectStr.Contains("\"Modules\"");
            }

            // Get all ini files
            if (RawProjectPath != null)
            {
                CommandUtils.LogVerbose("Loading ini files for {0}", RawProjectPath);

                foreach (UnrealTargetPlatform TargetPlatformType in Enum.GetValues(typeof(UnrealTargetPlatform)))
                {
                    if (TargetPlatformType != UnrealTargetPlatform.Unknown)
                    {
                        var Config = ConfigCache.ReadHierarchy(ConfigHierarchyType.Engine, RawProjectPath.Directory, TargetPlatformType);
                        Properties.EngineConfigs.Add(TargetPlatformType, Config);
                    }
                }

                foreach (UnrealTargetPlatform TargetPlatformType in Enum.GetValues(typeof(UnrealTargetPlatform)))
                {
                    if (TargetPlatformType != UnrealTargetPlatform.Unknown)
                    {
                        var Config = ConfigCache.ReadHierarchy(ConfigHierarchyType.Game, RawProjectPath.Directory, TargetPlatformType);
                        Properties.GameConfigs.Add(TargetPlatformType, Config);
                    }
                }
            }

            return(Properties);
        }
    public funapi_plugin_ue4(TargetInfo Target)
    {
        PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore" });
        PublicDependencyModuleNames.AddRange(new string[] { "Json", "HTTP" });

        // Third party library
        var ModulePath     = Path.GetDirectoryName(RulesCompiler.GetModuleFilename(this.GetType().Name));
        var ThirdPartyPath = Path.GetFullPath(Path.Combine(ModulePath, "..", "..", "ThirdParty/"));

        // include path
        PublicIncludePaths.Add(Path.Combine(ThirdPartyPath, "include"));
        PublicIncludePaths.Add(Path.GetFullPath(Path.Combine(ModulePath, "funapi")));

        // definitions
        Definitions.Add("GOOGLE_PROTOBUF_NO_RTTI=1");

        // library
        var LibPath = ThirdPartyPath;

        if (Target.Platform == UnrealTargetPlatform.Mac)
        {
            PublicIncludePaths.Add(Path.Combine(ThirdPartyPath, "include", "Mac"));

            LibPath += "lib/Mac";
            PublicAdditionalLibraries.Add(Path.Combine(LibPath, "libcurl.a"));
            PublicAdditionalLibraries.Add(Path.Combine(LibPath, "libcrypto.a"));
            PublicAdditionalLibraries.Add(Path.Combine(LibPath, "libprotobuf.a"));
        }
        else if (Target.Platform == UnrealTargetPlatform.Win32)
        {
            PublicIncludePaths.Add(Path.Combine(ThirdPartyPath, "include", "Windows", "x86"));

            LibPath += "lib/Windows/x86";
            PublicLibraryPaths.Add(LibPath);

            PublicAdditionalLibraries.Add(Path.Combine(LibPath, "libcurl_a.lib"));
            PublicAdditionalLibraries.Add(Path.Combine(LibPath, "libeay32.lib"));
            PublicAdditionalLibraries.Add(Path.Combine(LibPath, "libprotobuf.lib"));
            Definitions.Add("CURL_STATICLIB=1");
        }
        else if (Target.Platform == UnrealTargetPlatform.Win64)
        {
            PublicIncludePaths.Add(Path.Combine(ThirdPartyPath, "include", "Windows", "x64"));

            LibPath += "lib/Windows/x64";
            PublicLibraryPaths.Add(LibPath);

            PublicAdditionalLibraries.Add(Path.Combine(LibPath, "libcurl_a.lib"));
            PublicAdditionalLibraries.Add(Path.Combine(LibPath, "libeay32.lib"));
            PublicAdditionalLibraries.Add(Path.Combine(LibPath, "libprotobuf.lib"));
            Definitions.Add("CURL_STATICLIB=1");
        }
        else if (Target.Platform == UnrealTargetPlatform.Android)
        {
            // toolchain will filter properly
            PublicIncludePaths.Add(LibPath + "include/Android/ARMv7");
            PublicLibraryPaths.Add(LibPath + "lib/Android/ARMv7");
            //PublicIncludePaths.Add(LibPath + "include/Android/ARM64");
            //PublicLibraryPaths.Add(LibPath + "lib/Android/ARM64");
            //PublicIncludePaths.Add(LibPath + "include/Android/x86");
            //PublicLibraryPaths.Add(LibPath + "lib/Android/x86");
            //PublicIncludePaths.Add(LibPath + "include/Android/x64");
            //PublicLibraryPaths.Add(LibPath + "lib/Android/x64");

            LibPath += "lib/Android/ARMv7";
            //PublicAdditionalLibraries.Add("curl");
            //PublicAdditionalLibraries.Add("crypto");
            //PublicAdditionalLibraries.Add("protobuf");

            PublicAdditionalLibraries.Add(Path.Combine(LibPath, "libcurl.a"));
            PublicAdditionalLibraries.Add(Path.Combine(LibPath, "libcrypto.a"));
            PublicAdditionalLibraries.Add(Path.Combine(LibPath, "libprotobuf.a"));
        }
        else if (Target.Platform == UnrealTargetPlatform.IOS)
        {
            PublicIncludePaths.Add(Path.Combine(ThirdPartyPath, "include", "iOS"));

            LibPath += "lib/iOS";
            PublicAdditionalLibraries.Add(Path.Combine(LibPath, "libcurl.a"));
            PublicAdditionalLibraries.Add(Path.Combine(LibPath, "libcrypto.a"));
            PublicAdditionalLibraries.Add(Path.Combine(LibPath, "libssl.a"));
            PublicAdditionalLibraries.Add(Path.Combine(LibPath, "libprotobuf.a"));
        }
    }
예제 #20
0
        /// <summary>
        /// Finds all targets for the project.
        /// </summary>
        /// <param name="Properties">Project properties.</param>
        /// <param name="ExtraSearchPaths">Additional search paths.</param>
        private static void DetectTargetsForProject(ProjectProperties Properties, List <string> ExtraSearchPaths = null)
        {
            Properties.Targets = new Dictionary <TargetRules.TargetType, SingleTargetProperties>();
            string TargetsDllFilename;
            string FullProjectPath = null;

            var GameFolders = new List <string>();
            var RulesFolder = GetRulesAssemblyFolder();

            if (!String.IsNullOrEmpty(Properties.RawProjectPath))
            {
                CommandUtils.Log("Looking for targets for project {0}", Properties.RawProjectPath);

                TargetsDllFilename = CommandUtils.CombinePaths(RulesFolder, String.Format("UATRules{0}.dll", Properties.RawProjectPath.GetHashCode()));

                FullProjectPath = CommandUtils.GetDirectoryName(Properties.RawProjectPath);
                GameFolders.Add(FullProjectPath);
                CommandUtils.Log("Searching for target rule files in {0}", FullProjectPath);
            }
            else
            {
                TargetsDllFilename = CommandUtils.CombinePaths(RulesFolder, String.Format("UATRules{0}.dll", "_BaseEngine_"));
            }
            RulesCompiler.SetAssemblyNameAndGameFolders(TargetsDllFilename, GameFolders);

            // the UBT code assumes a certain CWD, but artists don't have this CWD.
            var  SourceDir = CommandUtils.CombinePaths(CommandUtils.CmdEnv.LocalRoot, "Engine", "Source");
            bool DirPushed = false;

            if (CommandUtils.DirectoryExists_NoExceptions(SourceDir))
            {
                CommandUtils.PushDir(SourceDir);
                DirPushed = true;
            }
            var TargetScripts = RulesCompiler.FindAllRulesSourceFiles(RulesCompiler.RulesFileType.Target, ExtraSearchPaths);

            if (DirPushed)
            {
                CommandUtils.PopDir();
            }

            if (!CommandUtils.IsNullOrEmpty(TargetScripts))
            {
                // We only care about project target script so filter out any scripts not in the project folder, or take them all if we are just doing engine stuff
                var ProjectTargetScripts = new List <string>();
                foreach (var Filename in TargetScripts)
                {
                    var FullScriptPath = CommandUtils.CombinePaths(Path.GetFullPath(Filename));
                    if (FullProjectPath == null || FullScriptPath.StartsWith(FullProjectPath, StringComparison.InvariantCultureIgnoreCase))
                    {
                        ProjectTargetScripts.Add(FullScriptPath);
                    }
                }
                TargetScripts = ProjectTargetScripts;
            }

            if (!CommandUtils.IsNullOrEmpty(TargetScripts))
            {
                CommandUtils.LogVerbose("Found {0} target rule files:", TargetScripts.Count);
                foreach (var Filename in TargetScripts)
                {
                    CommandUtils.LogVerbose("  {0}", Filename);
                }

                // Check if the scripts require compilation
                bool DoNotCompile = false;
                if (!CommandUtils.IsBuildMachine && !CheckIfScriptAssemblyIsOutOfDate(TargetsDllFilename, TargetScripts))
                {
                    Log.TraceInformation("Targets DLL {0} is up to date.", TargetsDllFilename);
                    DoNotCompile = true;
                }
                if (!DoNotCompile && CommandUtils.FileExists_NoExceptions(TargetsDllFilename))
                {
                    if (!CommandUtils.DeleteFile_NoExceptions(TargetsDllFilename, true))
                    {
                        DoNotCompile = true;
                        CommandUtils.Log("Could not delete {0} assuming it is up to date and reusable for a recursive UAT call.", TargetsDllFilename);
                    }
                }

                CompileAndLoadTargetsAssembly(Properties, TargetsDllFilename, DoNotCompile, TargetScripts);
            }
        }
예제 #21
0
    public ARToolkit(TargetInfo Target)
    {
        Type = ModuleType.External;

        string SDKDIR = Path.GetDirectoryName(RulesCompiler.GetModuleFilename(this.GetType().Name));

        SDKDIR = SDKDIR.Replace("\\", "/");
        if (Target.Platform == UnrealTargetPlatform.Mac)
        {
            PublicIncludePaths.Add(SDKDIR + "/include/OSX/");
            string LibPath = SDKDIR + "/lib/OSX/";

            PublicAdditionalLibraries.Add(LibPath + "macosx-universal/libjpeg.a");
            PublicAdditionalLibraries.Add(LibPath + "libAR.a");
            PublicAdditionalLibraries.Add(LibPath + "libAR2.a");
            PublicAdditionalLibraries.Add(LibPath + "libARICP.a");
            PublicAdditionalLibraries.Add(LibPath + "libKPM.a");
            PublicAdditionalLibraries.Add(LibPath + "libARUtil.a");
            PublicAdditionalLibraries.Add(LibPath + "libARMulti.a");
            PublicAdditionalLibraries.Add(LibPath + "libARvideo.a");
            PublicAdditionalLibraries.Add(LibPath + "libEden.a");
            PublicAdditionalLibraries.Add(LibPath + "libARgsub.a");
            PublicAdditionalLibraries.Add(LibPath + "libARgsub_lite.a");

            PublicFrameworks.AddRange(
                new string[] {
                "QTKit",
                "CoreVideo",
                "Accelerate"
            }
                );
        }
        else if (Target.Platform == UnrealTargetPlatform.IOS)
        {
            PublicIncludePaths.Add(SDKDIR + "/include/iOS/");
            string LibPath = SDKDIR + "/lib/iOS/";

            PublicAdditionalLibraries.Add(LibPath + "libKPM.a");
            PublicAdditionalLibraries.Add(LibPath + "ios511/libjpeg.a");
            PublicAdditionalLibraries.Add(LibPath + "libAR.a");
            PublicAdditionalLibraries.Add(LibPath + "libARVideo.a");
            PublicAdditionalLibraries.Add(LibPath + "libAR2.a");
            PublicAdditionalLibraries.Add(LibPath + "libARICP.a");
            PublicAdditionalLibraries.Add(LibPath + "libARUtil.a");
            PublicAdditionalLibraries.Add(LibPath + "libARMulti.a");
            PublicAdditionalLibraries.Add(LibPath + "libARvideo.a");
            PublicAdditionalLibraries.Add(LibPath + "libEden.a");
            PublicAdditionalLibraries.Add(LibPath + "libARgsub_es.a");
            PublicAdditionalLibraries.Add(LibPath + "libARgsub_es2.a");
            PublicAdditionalLibraries.Add(LibPath + "libc++.dylib"); //Need this from IOS SDK

            PublicFrameworks.AddRange(
                new string[] {
                "CoreVideo",
                "Accelerate",
                "AVFoundation"
            }
                );
        }
        else if ((Target.Platform == UnrealTargetPlatform.Win64) || (Target.Platform == UnrealTargetPlatform.Win32))
        {
            PublicIncludePaths.Add(SDKDIR + "/include/Windows/");

            string LibPath;

            switch (WindowsPlatform.Compiler)
            {
            case WindowsCompiler.VisualStudio2015:
                LibPath = SDKDIR + "/lib/Win64/vs2015";
                break;

            case WindowsCompiler.VisualStudio2013:
                LibPath = SDKDIR + "/lib/Win64/vs2013";
                break;

            default:
                throw new BuildException("Unexpected compiler version on Visual Studio 2013 / 2015 is supported!");
            }


            PublicLibraryPaths.Add(LibPath);
            PublicAdditionalLibraries.AddRange(
                new string[] {
                "libjpeg.lib",
                "pthreadVC2.lib",
                "ARUtil.lib",
                "AR.lib",
                "ARMulti.lib",
                "AR2.lib",
                "KPM.lib",
                "ARvideo.lib",
                "ARICP.lib"
            }
                );

            PublicDelayLoadDLLs.AddRange(new string[] { "DSVL.dll", "ARvideo.dll", "pthreadVC2.dll" });
            RuntimeDependencies.Add(new RuntimeDependency(SDKDIR + "/../../../Binaries/Win64/DSVL.dll"));
            RuntimeDependencies.Add(new RuntimeDependency(SDKDIR + "/../../../Binaries/Win64/ARvideo.dll"));
            RuntimeDependencies.Add(new RuntimeDependency(SDKDIR + "/../../../Binaries/Win64/pthreadVC2.dll"));
        }
        else if (Target.Platform == UnrealTargetPlatform.Android)
        {
            PublicIncludePaths.Add(SDKDIR + "/include/Android/");
            string LibPathAndroid = SDKDIR + "/lib/Android/armeabi-v7a/";
            PublicLibraryPaths.Add(LibPathAndroid);

            PublicAdditionalLibraries.Add(LibPathAndroid + "libar.a");
            PublicAdditionalLibraries.Add(LibPathAndroid + "libar2.a");
            PublicAdditionalLibraries.Add(LibPathAndroid + "libaricp.a");
            PublicAdditionalLibraries.Add(LibPathAndroid + "libkpm.a");
            PublicAdditionalLibraries.Add(LibPathAndroid + "libutil.a");
            PublicAdditionalLibraries.Add(LibPathAndroid + "libarmulti.a");
            PublicAdditionalLibraries.Add(LibPathAndroid + "libjpeg.a");

            PublicAdditionalLibraries.Add(LibPathAndroid + "libc++_shared.so");
        }
    }
    public override ExitCode Execute()
    {
        LogInformation("************************* SyncProject");

        // These are files that should always be synced because tools update them
        string[] ForceSyncFiles = new string[]
        {
            "Engine/Build/Build.version",
            "Engine/Source/Programs/DotNETCommon/MetaData.cs"
        };

        // Parse the project filename (as a local path)
        string ProjectArg = ParseParamValue("Project", null);

        // Parse the changelist to sync to. -1 will sync to head.
        int  CL          = ParseParamInt("CL", -1);
        int  Threads     = ParseParamInt("threads", 2);
        bool ForceSync   = ParseParam("force");
        bool PreviewOnly = ParseParam("preview");

        bool ProjectOnly = ParseParam("projectonly");

        int  Retries     = ParseParamInt("retries", 3);
        bool Unversioned = ParseParam("unversioned");

        bool BuildProject    = ParseParam("build");
        bool OpenProject     = ParseParam("open");
        bool GenerateProject = ParseParam("generate");

        string PathArg = ParseParamValue("paths", "");

        IEnumerable <string> ExplicitPaths = PathArg.Split(new char[] { ',', ';' }, StringSplitOptions.RemoveEmptyEntries).Select(S => S.Trim());

        if (CL == 0)
        {
            if (!ForceSync)
            {
                throw new AutomationException("If using 0 CL to remove files -force must also be specified");
            }

            // Cannot unsync the engine folder
            ProjectOnly = true;
        }
        else if (CL == -1)
        {
            // find most recent change
            List <P4Connection.ChangeRecord> Records;

            string Cmd = string.Format("-s submitted -m1 //{0}/...", P4Env.Client);
            if (!P4.Changes(out Records, Cmd, false))
            {
                throw new AutomationException("p4 changes failed. Cannot find most recent CL");
            }

            CL = Records.First().CL;
        }

        bool EngineOnly = string.IsNullOrEmpty(ProjectArg);

        // Will be the full local path to the project file once resolved
        FileReference ProjectFile = null;

        // Will be the full workspace path to the project in P4 (if a project was specified)
        string P4ProjectPath = null;

        // Will be the full workspace path to the engine in P4 (If projectonly wasn't specified);
        string P4EnginePath = null;

        // If we're syncing a project find where it is in P4
        if (!EngineOnly)
        {
            ProjectFile = ProjectUtils.FindProjectFileFromName(ProjectArg);

            if (ProjectFile != null)
            {
                // get the path in P4
                P4WhereRecord Record = P4.Where(ProjectFile.FullName, AllowSpew: false).FirstOrDefault(x => x.DepotFile != null && !x.bUnmap);
                P4ProjectPath = Record.ClientFile;
            }
            else
            {
                // if they provided a name and not a path then find the file (requires that it's synced).
                string RelativePath = ProjectArg;

                if (Path.GetExtension(RelativePath).Length == 0)
                {
                    RelativePath = Path.ChangeExtension(RelativePath, "uproject");
                }

                if (!RelativePath.Contains(Path.DirectorySeparatorChar) && !RelativePath.Contains(Path.AltDirectorySeparatorChar))
                {
                    RelativePath = CommandUtils.CombinePaths(PathSeparator.Slash, Path.GetFileNameWithoutExtension(RelativePath), RelativePath);
                }

                Log.TraceInformation("{0} not on disk. Searching P4 for {1}", ProjectArg, RelativePath);

                List <string> SearchPaths = new List <string>();
                SearchPaths.Add("");
                string ProjectDirsFile = Directory.EnumerateFiles(CommandUtils.CombinePaths(CmdEnv.LocalRoot), "*.uprojectdirs").FirstOrDefault();
                if (ProjectDirsFile != null)
                {
                    foreach (string FilePath in File.ReadAllLines(ProjectDirsFile))
                    {
                        string Trimmed = FilePath.Trim();
                        if (!Trimmed.StartsWith("./", StringComparison.OrdinalIgnoreCase) &&
                            !Trimmed.StartsWith(";", StringComparison.OrdinalIgnoreCase) &&
                            Trimmed.IndexOfAny(Path.GetInvalidPathChars()) < 0)
                        {
                            SearchPaths.Add(Trimmed);
                        }
                    }
                }

                // Get the root of the branch containing the selected file
                foreach (string SearchPath in SearchPaths)
                {
                    string P4Path = CommandUtils.CombinePaths(PathSeparator.Slash, P4Env.ClientRoot, SearchPath, RelativePath);

                    if (P4.FileExistsInDepot(P4Path))
                    {
                        P4WhereRecord Record = P4.Where(P4Path, AllowSpew: false).FirstOrDefault(x => x.DepotFile != null && !x.bUnmap);
                        // make sure to sync with //workspace/path as it cleans up files if the user has stream switched
                        P4ProjectPath = Record.ClientFile;
                        Log.TraceInformation("Found project at {0}", P4ProjectPath);
                        break;
                    }
                }
            }

            if (string.IsNullOrEmpty(P4ProjectPath))
            {
                throw new AutomationException("Could not find project file for {0} locally or in P4. Provide a full path or check the subdirectory is listed in UE4Games.uprojectdirs", ProjectArg);
            }

            Log.TraceVerbose("Resolved {0} to P4 Path {1}", ProjectArg, P4ProjectPath);
        }

        // Build the list of paths that need syncing
        List <string> SyncPaths = new List <string>();


        //
        if (ExplicitPaths.Any())
        {
            // Add all explicit paths as <root>/Path/...
            ExplicitPaths.ToList().ForEach(P => SyncPaths.Add(CommandUtils.CombinePaths(PathSeparator.Slash, P4Env.ClientRoot, P, "...")));
        }
        else
        {
            // See if the engine is in P4 too by checking the p4 location of a local file
            string        LocalEngineFile = CommandUtils.CombinePaths(CmdEnv.LocalRoot, "Engine", "Source", "UE4Editor.target.cs");
            P4WhereRecord EngineRecord    = P4.Where(LocalEngineFile, AllowSpew: false).FirstOrDefault(x => x.DepotFile != null && !x.bUnmap);

            if (!ProjectOnly && P4.FileExistsInDepot(EngineRecord.DepotFile))
            {
                // make sure to sync with //workspace/path as it cleans up files if the user has stream switched
                P4EnginePath = EngineRecord.ClientFile.Replace("Engine/Source/UE4Editor.target.cs", "");
                SyncPaths.Add(CommandUtils.CombinePaths(PathSeparator.Slash, P4EnginePath + "*"));
                SyncPaths.Add(CommandUtils.CombinePaths(PathSeparator.Slash, P4EnginePath, "Engine", "..."));
            }

            if (!string.IsNullOrEmpty(P4ProjectPath))
            {
                string P4ProjectDir = Regex.Replace(P4ProjectPath, @"[^/]+\.uproject", "...", RegexOptions.IgnoreCase);
                SyncPaths.Add(P4ProjectDir);
            }
        }

        // Force these files as they can be overwritten by tools
        if (!PreviewOnly && !string.IsNullOrEmpty(P4EnginePath) && !ProjectOnly)
        {
            IEnumerable <string> ForceSyncList = ForceSyncFiles.Select(F => CommandUtils.CombinePaths(PathSeparator.Slash, P4EnginePath, F));

            foreach (var F in ForceSyncList)
            {
                LogInformation("Force-updating {0}", F);

                string SyncCommand = string.Format("-f {0}@{1}", F, CL);

                // sync with retries
                P4.Sync(SyncCommand, true, false, Retries);
            }
        }

        // Sync all the things
        foreach (string SyncPath in SyncPaths)
        {
            string SyncCommand = "";

            if (Threads > 1)
            {
                SyncCommand = string.Format(" --parallel \"threads={0}\" {1}", Threads, SyncCommand);
            }

            if (ForceSync)
            {
                SyncCommand = SyncCommand + " -f";
            }

            SyncCommand += string.Format(" {0}@{1}", SyncPath, CL);

            if (!PreviewOnly)
            {
                // sync with retries
                P4.Sync(SyncCommand, true, false, Retries);
            }
            else
            {
                LogInformation("sync {0}", SyncCommand);
            }
        }

        // P4 utils don't return errors :(
        ExitCode ExitStatus = ExitCode.Success;

        // Sync is complete so do the actions
        if (!PreviewOnly && CL > 0)
        {
            // Argument to pass to the editor (could be null with no project).
            string ProjectArgForEditor = "";

            if (!string.IsNullOrEmpty(ProjectArg))
            {
                // If we synced the project from P4 we couldn't resolve this earlier
                if (ProjectFile == null)
                {
                    NativeProjects.ClearCache();
                    ProjectFile = ProjectUtils.FindProjectFileFromName(ProjectArg);
                }

                ProjectArgForEditor = ProjectFile.FullName;
            }

            if (GenerateProject)
            {
                Log.TraceVerbose("Generating project files for {0}", ProjectArgForEditor);

                if (BuildHostPlatform.Current.Platform == UnrealTargetPlatform.Win64 ||
                    BuildHostPlatform.Current.Platform == UnrealTargetPlatform.Win32)
                {
                    CommandUtils.Run("GenerateProjectFiles.bat", ProjectArgForEditor);
                }
                else
                {
                    CommandUtils.Run("GenerateProjectFiles.sh", ProjectArgForEditor);
                }
            }

            UE4Build Build = new UE4Build(this);
            if (!Unversioned && !ProjectOnly)
            {
                Build.UpdateVersionFiles(ActuallyUpdateVersionFiles: true, ChangelistNumberOverride: CL, IsPromotedOverride: false);
            }

            // Build everything
            if (BuildProject && ExitStatus == ExitCode.Success)
            {
                Log.TraceVerbose("Building Editor for {0}", ProjectArgForEditor);

                // Invalidate the location of the Target.cs files incase they were synced
                if (ProjectFile != null)
                {
                    string TargetSourceDir = CommandUtils.CombinePaths(Path.GetDirectoryName(ProjectFile.FullName), "Source");
                    RulesCompiler.InvalidateRulesFileCache(TargetSourceDir);
                }

                BuildEditor BuildCmd = new BuildEditor();
                BuildCmd.Clean       = ParseParam("clean");
                BuildCmd.ProjectName = ProjectArgForEditor;
                ExitStatus           = BuildCmd.Execute();
            }

            if (OpenProject && ExitStatus == ExitCode.Success)
            {
                Log.TraceVerbose("Opening Editor for {0}", ProjectArgForEditor);

                OpenEditor OpenCmd = new OpenEditor();
                OpenCmd.ProjectName = ProjectArgForEditor;
                ExitStatus          = OpenCmd.Execute();
            }
        }

        return(ExitCode.Success);
    }
예제 #23
0
    public KlawrClrHostNative(TargetInfo Target)
    {
        // This module is built externally, just need to let UBT know the include and library paths
        // that should be passed through to any targets that depend on this module.
        Type = ModuleType.External;

        var moduleName = this.GetType().Name;
        // path to directory containing this Build.cs file
        var basePath = Path.GetDirectoryName(RulesCompiler.GetModuleFilename(moduleName));

        string architecture = null;

        if (Target.Platform == UnrealTargetPlatform.Win64)
        {
            architecture = "x64";
        }
        else if (Target.Platform == UnrealTargetPlatform.Win32)
        {
            architecture = "x86";
        }

        string configuration = null;

        switch (Target.Configuration)
        {
        case UnrealTargetConfiguration.Debug:
        case UnrealTargetConfiguration.DebugGame:
            configuration = BuildConfiguration.bDebugBuildsActuallyUseDebugCRT ? "Debug" : "Release";
            break;

        default:
            configuration = "Release";
            break;
        }

        Console.WriteLine("KlawrClrHostNative Target.Configuration: " + configuration);

        if ((architecture != null) && (configuration != null))
        {
            PublicIncludePaths.Add(Path.Combine(basePath, "Public"));
            var libName = "Klawr.ClrHost.Native-" + architecture + "-" + configuration + ".lib";
            PublicLibraryPaths.Add(Path.Combine(basePath, "..", "Build"));
            PublicAdditionalLibraries.Add(libName);
        }

        // copy the CLR host assembly (assumed to have been built previously) to the engine binaries
        // directory so that it can be found and loaded at runtime by the unmanaged CLR host

        string hostAssemblyName      = "Klawr.ClrHost.Managed";
        string hostAssemblyDLL       = hostAssemblyName + ".dll";
        string hostAssemblyPDB       = hostAssemblyName + ".pdb";
        string hostAssemblySourceDir = Path.Combine(
            basePath, Path.Combine("..", "ClrHostManaged", "bin", configuration)
            );

        Utils.CollapseRelativeDirectories(ref hostAssemblySourceDir);

        string binariesDir = Path.Combine(
            BuildConfiguration.RelativeEnginePath, "Binaries", Target.Platform.ToString()
            );

        bool bOverwrite = true;

        File.Copy(
            Path.Combine(hostAssemblySourceDir, hostAssemblyDLL),
            Path.Combine(binariesDir, hostAssemblyDLL),
            bOverwrite
            );
        File.Copy(
            Path.Combine(hostAssemblySourceDir, hostAssemblyPDB),
            Path.Combine(binariesDir, hostAssemblyPDB),
            bOverwrite
            );
    }
예제 #24
0
    public AgogCore(TargetInfo Target)
    {
        Type = ModuleType.External;

        var bPlatformAllowed = false;

        string platPathSuffix = Target.Platform.ToString();

        switch (Target.Platform)
        {
        case UnrealTargetPlatform.Win32:
            bPlatformAllowed = true;
            platPathSuffix   = Path.Combine("Win32", "VS2013");
            Definitions.Add("WIN32_LEAN_AND_MEAN");
            break;

        case UnrealTargetPlatform.Win64:
            bPlatformAllowed = true;
            platPathSuffix   = Path.Combine("Win64", "VS2013");
            Definitions.Add("WIN32_LEAN_AND_MEAN");
            break;
        }

        string libNameSuffix = "";

        switch (Target.Configuration)
        {
        case UnrealTargetConfiguration.Debug:
        case UnrealTargetConfiguration.DebugGame:
            Definitions.Add("A_EXTRA_CHECK=1");
            Definitions.Add("A_UNOPTIMIZED=1");
            Definitions.Add("SKOOKUM=31");

            if (BuildConfiguration.bDebugBuildsActuallyUseDebugCRT)
            {
                // Use Debug C run-time
                libNameSuffix = "-Debug.lib";
            }
            else
            {
                // Use Optimized C run-time
                libNameSuffix = "-DebugCRTOpt.lib";
            }

            break;

        case UnrealTargetConfiguration.Development:
        case UnrealTargetConfiguration.Test:
            Definitions.Add("A_EXTRA_CHECK=1");
            Definitions.Add("SKOOKUM=31");
            libNameSuffix = "-Development.lib";
            break;

        case UnrealTargetConfiguration.Shipping:
            Definitions.Add("SKOOKUM=8");
            libNameSuffix = "-Shipping.lib";
            break;
        }

        // Determine path to directory containing this Build.cs file
        var modulePath = Path.GetDirectoryName(RulesCompiler.GetModuleFilename(this.GetType().Name));

        PublicIncludePaths.Add(Path.Combine(modulePath, "Public"));

        if (bPlatformAllowed)
        {
            var libPath = Path.Combine(modulePath, "Lib", platPathSuffix);

            Log.TraceVerbose("AgogCore library added to path: {0}", libPath);

            PublicLibraryPaths.Add(libPath);
            PublicAdditionalLibraries.Add(Path.Combine(libPath, "AgogCore" + libNameSuffix));
        }
    }