Beispiel #1
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);
            }

            string BundleVersion = MacToolChain.LoadEngineDisplayVersion();

            PListData = PListData.Replace("${EXECUTABLE_NAME}", ExeName).Replace("${APP_NAME}", GameName).Replace("${ICON_NAME}", GameName).Replace("${MACOSX_DEPLOYMENT_TARGET}", MacToolChain.MinMacOSVersion).Replace("${BUNDLE_VERSION}", BundleVersion);

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

            return(true);
        }
Beispiel #2
0
        public override void ValidateBuildConfiguration(CPPTargetConfiguration Configuration, CPPTargetPlatform Platform, bool bCreateDebugInfo)
        {
            if (BuildHostPlatform.Current.Platform != UnrealTargetPlatform.Mac)
            {
                // @todo: Temporarily disable precompiled header files when building remotely due to errors
                BuildConfiguration.bUsePCHFiles = false;
            }
            BuildConfiguration.bCheckExternalHeadersForModification = BuildHostPlatform.Current.Platform != UnrealTargetPlatform.Mac;
            BuildConfiguration.bCheckSystemHeadersForModification   = BuildHostPlatform.Current.Platform != UnrealTargetPlatform.Mac;
            BuildConfiguration.ProcessorCountMultiplier             = MacToolChain.GetAdjustedProcessorCountMultiplier();
            BuildConfiguration.bUseSharedPCHs = false;

            // we always deploy - the build machines need to be able to copy the files back, which needs the full bundle
            BuildConfiguration.bDeployAfterCompile = true;
        }
Beispiel #3
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);
        }
Beispiel #4
0
        /// <summary>
        /// Strips symbols from a file
        /// </summary>
        /// <param name="SourceFile">The input file</param>
        /// <param name="TargetFile">The output file</param>
        public static void StripSymbols(FileReference SourceFile, FileReference TargetFile)
        {
            MacToolChain ToolChain = new MacToolChain(null, MacToolChainOptions.None);

            ToolChain.StripSymbols(SourceFile, TargetFile);
        }
Beispiel #5
0
        public override bool PrepTargetForDeployment(UEBuildTarget InTarget)
        {
            Log.TraceInformation("Deploying now!");

            string IntermediateDirectory = InTarget.AppName + "/Intermediate/Build/Mac/" + InTarget.AppName + "/" + InTarget.Configuration;

            if (!Directory.Exists("../../" + IntermediateDirectory))
            {
                IntermediateDirectory = "Engine/Intermediate/Build/Mac/" + InTarget.AppName + "/" + InTarget.Configuration;
            }

            MacToolChain Toolchain = UEToolChain.GetPlatformToolChain(CPPTargetPlatform.Mac) as MacToolChain;

            string FixDylibDepsScript      = Path.Combine(IntermediateDirectory, "FixDylibDependencies.sh");
            string FinalizeAppBundleScript = Path.Combine(IntermediateDirectory, "FinalizeAppBundle.sh");

            string RemoteWorkingDir = "";

            bool bIsStaticLibrary = InTarget.OutputPath.EndsWith(".a");

            if (BuildHostPlatform.Current.Platform != UnrealTargetPlatform.Mac)
            {
                if (!bIsStaticLibrary)
                {
                    // Copy the command scripts to the intermediate on the target Mac.
                    string RemoteFixDylibDepsScript = Toolchain.ConvertPath(Path.GetFullPath(FixDylibDepsScript));
                    RemoteFixDylibDepsScript = RemoteFixDylibDepsScript.Replace("../../../../", "../../");
                    RPCUtilHelper.CopyFile("../../" + FixDylibDepsScript, RemoteFixDylibDepsScript, true);

                    if (!InTarget.GlobalLinkEnvironment.Config.bIsBuildingConsoleApplication)
                    {
                        string RemoteFinalizeAppBundleScript = Toolchain.ConvertPath(Path.GetFullPath(FinalizeAppBundleScript));
                        RemoteFinalizeAppBundleScript = RemoteFinalizeAppBundleScript.Replace("../../../../", "../../");
                        RPCUtilHelper.CopyFile("../../" + FinalizeAppBundleScript, RemoteFinalizeAppBundleScript, true);
                    }


                    // run it remotely
                    RemoteWorkingDir = Toolchain.ConvertPath(Path.GetDirectoryName(Path.GetFullPath(FixDylibDepsScript)));

                    Log.TraceInformation("Running FixDylibDependencies.sh...");
                    Hashtable Results = RPCUtilHelper.Command(RemoteWorkingDir, "/bin/sh", "FixDylibDependencies.sh", null);
                    if (Results != null)
                    {
                        string Result = (string)Results["CommandOutput"];
                        if (Result != null)
                        {
                            Log.TraceInformation(Result);
                        }
                    }

                    if (!InTarget.GlobalLinkEnvironment.Config.bIsBuildingConsoleApplication)
                    {
                        Log.TraceInformation("Running FinalizeAppBundle.sh...");
                        Results = RPCUtilHelper.Command(RemoteWorkingDir, "/bin/sh", "FinalizeAppBundle.sh", null);
                        if (Results != null)
                        {
                            string Result = (string)Results["CommandOutput"];
                            if (Result != null)
                            {
                                Log.TraceInformation(Result);
                            }
                        }
                    }
                }


                // If it is requested, send the app bundle back to the platform executing these commands.
                if (BuildConfiguration.bCopyAppBundleBackToDevice)
                {
                    Log.TraceInformation("Copying binaries back to this device...");

                    try
                    {
                        string BinaryDir = Path.GetDirectoryName(InTarget.OutputPath) + "\\";
                        if (BinaryDir.EndsWith(InTarget.AppName + "\\Binaries\\Mac\\") && InTarget.TargetType != TargetRules.TargetType.Game)
                        {
                            BinaryDir = BinaryDir.Replace(InTarget.TargetType.ToString(), "Game");
                        }

                        string RemoteBinariesDir = Toolchain.ConvertPath(BinaryDir);
                        string LocalBinariesDir  = BinaryDir;

                        // Get the app bundle's name
                        string AppFullName = InTarget.AppName;
                        if (InTarget.Configuration != UnrealTargetConfiguration.Development)
                        {
                            AppFullName += "-" + InTarget.Platform.ToString();
                            AppFullName += "-" + InTarget.Configuration.ToString();
                        }

                        if (!InTarget.GlobalLinkEnvironment.Config.bIsBuildingConsoleApplication)
                        {
                            AppFullName += ".app";
                        }

                        List <string> NotBundledBinaries = new List <string>();
                        foreach (string BinaryPath in Toolchain.BuiltBinaries)
                        {
                            if (InTarget.GlobalLinkEnvironment.Config.bIsBuildingConsoleApplication || bIsStaticLibrary || !BinaryPath.StartsWith(LocalBinariesDir + AppFullName))
                            {
                                NotBundledBinaries.Add(BinaryPath);
                            }
                        }

                        // Zip the app bundle for transferring.
                        if (!InTarget.GlobalLinkEnvironment.Config.bIsBuildingConsoleApplication && !bIsStaticLibrary)
                        {
                            string ZipCommand = "zip -0 -r -y -T \"" + AppFullName + ".zip\" \"" + AppFullName + "\"";
                            RPCUtilHelper.Command(RemoteBinariesDir, ZipCommand, "", null);

                            // Copy the AppBundle back to the source machine
                            string LocalZipFileLocation  = LocalBinariesDir + AppFullName + ".zip ";
                            string RemoteZipFileLocation = RemoteBinariesDir + AppFullName + ".zip";

                            RPCUtilHelper.CopyFile(RemoteZipFileLocation, LocalZipFileLocation, false);

                            // Extract the copied app bundle (in zip format) to the local binaries directory
                            using (ZipFile AppBundleZip = ZipFile.Read(LocalZipFileLocation))
                            {
                                foreach (ZipEntry Entry in AppBundleZip)
                                {
                                    Entry.Extract(LocalBinariesDir, ExtractExistingFileAction.OverwriteSilently);
                                }
                            }

                            // Delete the zip as we no longer need/want it.
                            File.Delete(LocalZipFileLocation);
                            RPCUtilHelper.Command(RemoteBinariesDir, "rm -f \"" + AppFullName + ".zip\"", "", null);
                        }

                        if (NotBundledBinaries.Count > 0)
                        {
                            foreach (string BinaryPath in NotBundledBinaries)
                            {
                                RPCUtilHelper.CopyFile(Toolchain.ConvertPath(BinaryPath), BinaryPath, false);
                            }
                        }

                        Log.TraceInformation("Copied binaries successfully.");
                    }
                    catch (Exception)
                    {
                        Log.TraceInformation("Copying binaries back to this device failed.");
                    }
                }
            }

            return(true);
        }
Beispiel #6
0
 public override void PostCodeGeneration(UHTManifest Manifest)
 {
     MacToolChain.PostCodeGeneration(Manifest);
 }
Beispiel #7
0
 public override void PostBuildSync(UEBuildTarget Target)
 {
     MacToolChain.PostBuildSync(Target);
 }
Beispiel #8
0
 public override void PreBuildSync()
 {
     MacToolChain.PreBuildSync();
 }
Beispiel #9
0
 /// <summary>
 /// Converts the passed in path from UBT host to compiler native format.
 /// </summary>
 /// <param name="OriginalPath">The path to convert</param>
 /// <returns>The path in native format for the toolchain</returns>
 public override string ConvertPath(string OriginalPath)
 {
     return(MacToolChain.ConvertPath(OriginalPath));
 }