Exemplo n.º 1
0
    private static string GetCMakeArguments(TargetPlatformData TargetData, string BuildConfig = "", WindowsCompiler TargetWindowsCompiler = WindowsCompiler.VisualStudio2015_DEPRECATED)
    {
        string VisualStudioName;

        switch (TargetWindowsCompiler)
        {
        case WindowsCompiler.VisualStudio2015_DEPRECATED:
            VisualStudioName = "Visual Studio 14 2015";
            break;

        default:
            throw new AutomationException(String.Format("Non-CMake or unsupported platform '{0}' supplied to GetCMakeArguments", TargetData.ToString()));
        }

        string OutputFlags = "";

        // Enable response files for platforms that require them.
        // Response files are used for include paths etc, to fix max command line length issues.
        if (TargetData.Platform == UnrealTargetPlatform.Linux)
        {
            OutputFlags += " -DUSE_RESPONSE_FILES=1";
        }

        DirectoryReference CMakeFilePath = DirectoryReference.Combine(SourceRootDirectory, "projects");

        if (TargetData.Platform == UnrealTargetPlatform.Win64)
        {
            return(CMakeFilePath.ToString() + " -G \"" + VisualStudioName + "\" -Ax64 -DTARGET_BUILD_PLATFORM=windows" + OutputFlags);
        }
        else if (TargetData.Platform == UnrealTargetPlatform.Linux)
        {
            return(CMakeFilePath.ToString() + " --no-warn-unused-cli -G \"Unix Makefiles\" -DTARGET_BUILD_PLATFORM=linux " + " -DCMAKE_BUILD_TYPE=" + BuildConfig + GetLinuxToolchainSettings(TargetData) + OutputFlags);
        }
        else if (TargetData.Platform == UnrealTargetPlatform.Mac)
        {
            return(CMakeFilePath.ToString() + " -G \"Xcode\" -DTARGET_BUILD_PLATFORM=mac" + OutputFlags);
        }
        else
        {
            throw new AutomationException(String.Format("Non-CMake or unsupported platform '{0}' supplied to GetCMakeArguments", TargetData.ToString()));
        }
    }
        public static void SetupModuleBlastSupport(ModuleRules Rules, string[] BlastLibs)
        {
            string LibConfiguration = GetBlastLibrarySuffix(Rules);

            Rules.PublicDefinitions.Add(string.Format("BLAST_LIB_CONFIG_STRING=\"{0}\"", LibConfiguration));

            //Go up two from Source/Blast
            DirectoryReference ModuleRootFolder = (new DirectoryReference(Rules.ModuleDirectory)).ParentDirectory.ParentDirectory;
            DirectoryReference EngineDirectory  = new DirectoryReference(Path.GetFullPath(Rules.Target.RelativeEnginePath));
            string             BLASTLibDir      = Path.Combine("$(EngineDir)", ModuleRootFolder.MakeRelativeTo(EngineDirectory), "Libraries", Rules.Target.Platform.ToString());

            Rules.PublicLibraryPaths.Add(Path.Combine(ModuleRootFolder.ToString(), "Libraries", Rules.Target.Platform.ToString()));

            string DLLSuffix = "";
            string DLLPrefix = "";
            string LibSuffix = "";

            // Libraries and DLLs for windows platform
            if (Rules.Target.Platform == UnrealTargetPlatform.Win64)
            {
                DLLSuffix = "_x64.dll";
                LibSuffix = "_x64.lib";
            }
            else if (Rules.Target.Platform == UnrealTargetPlatform.Win32)
            {
                DLLSuffix = "_x86.dll";
                LibSuffix = "_x86.lib";
            }
            else if (Rules.Target.Platform == UnrealTargetPlatform.Linux)
            {
                DLLPrefix = "lib";
                DLLSuffix = ".so";
            }

            Rules.PublicDefinitions.Add(string.Format("BLAST_LIB_DLL_SUFFIX=\"{0}\"", DLLSuffix));
            Rules.PublicDefinitions.Add(string.Format("BLAST_LIB_DLL_PREFIX=\"{0}\"", DLLPrefix));

            foreach (string Lib in BlastLibs)
            {
                Rules.PublicAdditionalLibraries.Add(String.Format("{0}{1}{2}", Lib, LibConfiguration, LibSuffix));
                var DllName = String.Format("{0}{1}{2}{3}", DLLPrefix, Lib, LibConfiguration, DLLSuffix);
                Rules.PublicDelayLoadDLLs.Add(DllName);
                Rules.RuntimeDependencies.Add(Path.Combine(BLASTLibDir, DllName));
            }

            //It's useful to periodically turn this on since the order of appending files in unity build is random.
            //The use of types without the right header can creep in and cause random build failures

            //Rules.bFasterWithoutUnity = true;
        }
Exemplo n.º 3
0
        private static bool HasIcons(DirectoryReference ProjectDirectoryName)
        {
            string IconDir = ProjectDirectoryName.ToString() + "/Build/IOS/Resources/Graphics";

            if (Directory.Exists(IconDir))
            {
                FileInfo[] Files = (new DirectoryInfo(IconDir).GetFiles("Icon*.*", SearchOption.AllDirectories));
                if (Files.Length > 0)
                {
                    return(true);
                }
            }

            return(false);
        }
Exemplo n.º 4
0
    private static void BuildMakefileTarget(TargetPlatformData TargetData, List <string> TargetConfigurations)
    {
        // FIXME: use absolute path
        string MakeCommand = "make";

        // FIXME: "j -16" should be tweakable
        //string MakeOptions = "-j 1";
        string MakeOptions = "-j 16";

        // Bundled GNU make does not pass job number to subprocesses on Windows, work around that...
        if (BuildHostPlatform.Current.Platform == UnrealTargetPlatform.Win64)
        {
            // Redefining the MAKE variable will cause the -j flag to be passed to child make instances.
            MakeOptions = string.Format("{1} \"MAKE={0} {1}\"", MakeCommand, MakeOptions);
        }

        // makefile build has "projects" for every configuration. However, we abstract away from that by assuming GetProjectDirectory points to the "meta-project"
        foreach (string BuildConfig in TargetConfigurations)
        {
            DirectoryReference MetaProjectDirectory = GetProjectDirectory(TargetData);
            DirectoryReference ConfigDirectory      = DirectoryReference.Combine(MetaProjectDirectory, BuildConfig);
            string             Makefile             = FileReference.Combine(ConfigDirectory, "Makefile").ToString();
            if (!FileExists(Makefile))
            {
                throw new AutomationException(String.Format("Unabled to build {0} - file not found.", Makefile));
            }

            ProcessStartInfo StartInfo = new ProcessStartInfo();
            StartInfo.FileName         = MakeCommand;
            StartInfo.WorkingDirectory = ConfigDirectory.ToString();
            StartInfo.Arguments        = MakeOptions;

            LogInformation("Working in: {0}", StartInfo.WorkingDirectory);
            LogInformation("{0} {1}", StartInfo.FileName, StartInfo.Arguments);

            if (RunLocalProcessAndLogOutput(StartInfo) != 0)
            {
                throw new AutomationException(String.Format("Unabled to build {0}. Build process failed.", Makefile));
            }
        }
    }
Exemplo n.º 5
0
    private static void SetupBuildForTargetLibAndPlatform(TargetPlatformData TargetData, List <string> TargetConfigurations, List <WindowsCompiler> TargetWindowsCompilers, bool bCleanOnly)
    {
        string CMakeName = GetCMakeNameAndSetupEnv(TargetData);

        if (TargetData.Platform == UnrealTargetPlatform.Win64)
        {
            // for windows platforms we support building against multiple compilers
            foreach (WindowsCompiler TargetWindowsCompiler in TargetWindowsCompilers)
            {
                DirectoryReference CMakeTargetDirectory = GetProjectDirectory(TargetData, TargetWindowsCompiler);
                MakeFreshDirectoryIfRequired(CMakeTargetDirectory);

                if (!bCleanOnly)
                {
                    LogInformation("Generating projects for lib " + TargetData.ToString());

                    ProcessStartInfo StartInfo = new ProcessStartInfo();
                    StartInfo.FileName         = CMakeName;
                    StartInfo.WorkingDirectory = CMakeTargetDirectory.ToString();
                    StartInfo.Arguments        = GetCMakeArguments(TargetData, "", TargetWindowsCompiler);

                    if (RunLocalProcessAndLogOutput(StartInfo) != 0)
                    {
                        throw new AutomationException(String.Format("Unable to generate projects for {0}.", TargetData.ToString()));
                    }
                }
            }
        }
        else if (TargetData.Platform == UnrealTargetPlatform.Linux)
        {
            foreach (string BuildConfig in TargetConfigurations)
            {
                DirectoryReference CMakeTargetDirectory = GetProjectDirectory(TargetData);
                CMakeTargetDirectory = DirectoryReference.Combine(CMakeTargetDirectory, BuildConfig);
                MakeFreshDirectoryIfRequired(CMakeTargetDirectory);

                if (!bCleanOnly)
                {
                    LogInformation("Generating projects for lib " + TargetData.ToString());

                    ProcessStartInfo StartInfo = new ProcessStartInfo();
                    StartInfo.FileName         = CMakeName;
                    StartInfo.WorkingDirectory = CMakeTargetDirectory.ToString();
                    StartInfo.Arguments        = GetCMakeArguments(TargetData, BuildConfig);

                    System.Console.WriteLine("Working in '{0}'", StartInfo.WorkingDirectory);
                    LogInformation("Working in '{0}'", StartInfo.WorkingDirectory);

                    System.Console.WriteLine("{0} {1}", StartInfo.FileName, StartInfo.Arguments);
                    LogInformation("{0} {1}", StartInfo.FileName, StartInfo.Arguments);

                    if (RunLocalProcessAndLogOutput(StartInfo) != 0)
                    {
                        throw new AutomationException(String.Format("Unable to generate projects for {0}.", TargetData.ToString()));
                    }
                }
            }
        }
        else if (TargetData.Platform == UnrealTargetPlatform.Mac)
        {
            DirectoryReference CMakeTargetDirectory = GetProjectDirectory(TargetData);
            MakeFreshDirectoryIfRequired(CMakeTargetDirectory);

            if (!bCleanOnly)
            {
                LogInformation("Generating projects for lib " + TargetData.ToString());

                ProcessStartInfo StartInfo = new ProcessStartInfo();
                StartInfo.FileName         = CMakeName;
                StartInfo.WorkingDirectory = CMakeTargetDirectory.ToString();
                StartInfo.Arguments        = GetCMakeArguments(TargetData);

                if (RunLocalProcessAndLogOutput(StartInfo) != 0)
                {
                    throw new AutomationException(String.Format("Unable to generate projects for {0}.", TargetData.ToString()));
                }
            }
        }
        else
        {
            throw new AutomationException(String.Format("Unable to generate projects for {0}.", TargetData.ToString()));
        }
    }
Exemplo n.º 6
0
 /// <summary>
 /// Formats the pattern as a string
 /// </summary>
 /// <returns>The original representation of this pattern</returns>
 public override string ToString()
 {
     return(BaseDirectory.ToString() + Path.DirectorySeparatorChar + String.Join("", Tokens));
 }
Exemplo n.º 7
0
 /// <summary>
 /// Returns a string representation of this directory for debugging
 /// </summary>
 /// <returns>Path to this directory</returns>
 public override string ToString()
 {
     return(Location.ToString());
 }