예제 #1
0
        public static void AddAppBundleContentsToManifest(ref FileManifest Manifest, UEBuildBinary Binary)
        {
            if (Binary.Target.GlobalLinkEnvironment.Config.bIsBuildingConsoleApplication || Binary.Config.Type != UEBuildBinaryType.Executable)
            {
                return;
            }

            string ContentsDirectory = Path.GetDirectoryName(Path.GetDirectoryName(Binary.Config.OutputFilePath)) + "/";

            // We need to know what third party dylibs would be copied to the bundle
            var Modules = Binary.GetAllDependencyModules(bIncludeDynamicallyLoaded: false, bForceCircular: false);
            var BinaryLinkEnvironment = new LinkEnvironment(Binary.Target.GlobalLinkEnvironment);
            var BinaryDependencies = new List<UEBuildBinary>();
            var LinkEnvironmentVisitedModules = new Dictionary<UEBuildModule, bool>();
            foreach (var Module in Modules)
            {
                Module.SetupPrivateLinkEnvironment(ref BinaryLinkEnvironment, ref BinaryDependencies, ref LinkEnvironmentVisitedModules);
            }

            foreach (string AdditionalLibrary in BinaryLinkEnvironment.Config.AdditionalLibraries)
            {
                string LibName = Path.GetFileName(AdditionalLibrary);
                    if (LibName.StartsWith("lib"))
                {
                    if (Path.GetExtension(AdditionalLibrary) == ".dylib")
                    {
                        Manifest.AddFileName(ContentsDirectory + "MacOS/" + LibName);
                    }
                }
            }

            // And we also need all the resources
            Manifest.AddFileName(ContentsDirectory + "Info.plist");
            Manifest.AddFileName(ContentsDirectory + "PkgInfo");
            Manifest.AddFileName(ContentsDirectory + "Resources/UE4.icns");
            Manifest.AddFileName(ContentsDirectory + "Resources/OpenXcodeAtFileAndLine.applescript");
            Manifest.AddFileName(ContentsDirectory + "Resources/English.lproj/InfoPlist.strings");
            Manifest.AddFileName(ContentsDirectory + "Resources/English.lproj/MainMenu.nib");
            Manifest.AddFileName(ContentsDirectory + "Resources/RadioEffectUnit.component/Contents/MacOS/RadioEffectUnit");
            Manifest.AddFileName(ContentsDirectory + "Resources/RadioEffectUnit.component/Contents/Resources/English.lproj/Localizable.strings");
            Manifest.AddFileName(ContentsDirectory + "Resources/RadioEffectUnit.component/Contents/Resources/RadioEffectUnit.rsrc");
            Manifest.AddFileName(ContentsDirectory + "Resources/RadioEffectUnit.component/Contents/Info.plist");
        }
예제 #2
0
        public override void AddFilesToReceipt(BuildReceipt Receipt, UEBuildBinary Binary)
		{
			if (Binary.Target.GlobalLinkEnvironment.Config.bIsBuildingConsoleApplication)
			{
				return;
			}

			if (BundleContentsDirectory == "" && Binary.Config.Type == UEBuildBinaryType.Executable)
			{
				BundleContentsDirectory = Path.GetDirectoryName(Path.GetDirectoryName(Binary.Config.OutputFilePath)) + "/";
			}

			// We need to know what third party dylibs would be copied to the bundle
			if(Binary.Config.Type != UEBuildBinaryType.StaticLibrary)
			{
				var Modules = Binary.GetAllDependencyModules(bIncludeDynamicallyLoaded: false, bForceCircular: false);
				var BinaryLinkEnvironment = Binary.Target.GlobalLinkEnvironment.DeepCopy();
				var BinaryDependencies = new List<UEBuildBinary>();
				var LinkEnvironmentVisitedModules = new Dictionary<UEBuildModule, bool>();
				foreach (var Module in Modules)
				{
					Module.SetupPrivateLinkEnvironment(Binary, BinaryLinkEnvironment, BinaryDependencies, LinkEnvironmentVisitedModules);
				}

				foreach (string AdditionalLibrary in BinaryLinkEnvironment.Config.AdditionalLibraries)
				{
					string LibName = Path.GetFileName(AdditionalLibrary);
					if (LibName.StartsWith("lib"))
					{
						if (Path.GetExtension(AdditionalLibrary) == ".dylib" && !String.IsNullOrEmpty(BundleContentsDirectory))
						{
							string Entry = BundleContentsDirectory + "MacOS/" + LibName;
							Receipt.AddBuildProduct(Entry, BuildProductType.DynamicLibrary);
						}
					}
				}

				foreach (UEBuildBundleResource Resource in BinaryLinkEnvironment.Config.AdditionalBundleResources)
				{
					if (Directory.Exists(Resource.ResourcePath))
					{
						foreach (string ResourceFile in Directory.GetFiles(Resource.ResourcePath, "*", SearchOption.AllDirectories))
						{
							Receipt.AddBuildProduct(Path.Combine(BundleContentsDirectory, Resource.BundleContentsSubdir, ResourceFile.Substring(Path.GetDirectoryName(Resource.ResourcePath).Length + 1)), BuildProductType.RequiredResource);
						}
					}
					else
					{
						Receipt.AddBuildProduct(Path.Combine(BundleContentsDirectory, Resource.BundleContentsSubdir, Path.GetFileName(Resource.ResourcePath)), BuildProductType.RequiredResource);
					}
				}
			}

			if (Binary.Config.Type == UEBuildBinaryType.Executable)
			{
				// And we also need all the resources
				Receipt.AddBuildProduct(BundleContentsDirectory + "Info.plist", BuildProductType.RequiredResource);
				Receipt.AddBuildProduct(BundleContentsDirectory + "PkgInfo", BuildProductType.RequiredResource);
				Receipt.AddBuildProduct(BundleContentsDirectory + "Resources/UE4.icns", BuildProductType.RequiredResource);

				if (Binary.Target.AppName.StartsWith("UE4Editor"))
				{
					Receipt.AddBuildProduct(BundleContentsDirectory + "Resources/UProject.icns", BuildProductType.RequiredResource);
				}
			}
		}
예제 #3
0
파일: UEBuildTarget.cs 프로젝트: mymei/UE4
        private List<string> GenerateLinkerFixupsContents(UEBuildBinary ExecutableBinary, CPPEnvironment CompileEnvironment, string HeaderFilename, string LinkerFixupsName, List<string> PrivateDependencyModuleNames)
        {
            var Result = new List<string>();

            Result.Add("#include \"" + HeaderFilename + "\"");

            // To reduce the size of the command line for the compiler, we're going to put all definitions inside of the cpp file.
            foreach (var Definition in CompileEnvironment.Config.Definitions)
            {
                string MacroName;
                string MacroValue = String.Empty;
                int EqualsIndex = Definition.IndexOf('=');
                if (EqualsIndex >= 0)
                {
                    MacroName = Definition.Substring(0, EqualsIndex);
                    MacroValue = Definition.Substring(EqualsIndex + 1);
                }
                else
                {
                    MacroName = Definition;
                }
                Result.Add("#ifndef " + MacroName);
                Result.Add(String.Format("\t#define {0} {1}", MacroName, MacroValue));
                Result.Add("#endif");
            }

            // Add a function that is not referenced by anything that invokes all the empty functions in the different static libraries
            Result.Add("void " + LinkerFixupsName + "()");
            Result.Add("{");

            // Fill out the body of the function with the empty function calls. This is what causes the static libraries to be considered relevant
            var DependencyModules = ExecutableBinary.GetAllDependencyModules(bIncludeDynamicallyLoaded: false, bForceCircular: false);
            foreach(string ModuleName in DependencyModules.OfType<UEBuildModuleCPP>().Where(CPPModule => CPPModule.AutoGenerateCppInfo != null).Select(CPPModule => CPPModule.Name).Distinct())
            {
                Result.Add("    extern void EmptyLinkFunctionForGeneratedCode" + ModuleName + "();");
                Result.Add("    EmptyLinkFunctionForGeneratedCode" + ModuleName + "();");
            }
            foreach (var DependencyModuleName in PrivateDependencyModuleNames)
            {
                Result.Add("    extern void EmptyLinkFunctionForStaticInitialization" + DependencyModuleName + "();");
                Result.Add("    EmptyLinkFunctionForStaticInitialization" + DependencyModuleName + "();");
            }

            // End the function body that was started above
            Result.Add("}");

            return Result;
        }
예제 #4
0
		public override void ModifyBuildProducts(UEBuildBinary Binary, Dictionary<FileReference, BuildProductType> BuildProducts)
		{
			if (BuildConfiguration.bUsePDBFiles == true)
			{
				KeyValuePair<FileReference, BuildProductType>[] BuildProductsArray = BuildProducts.ToArray();

				foreach (KeyValuePair<FileReference, BuildProductType> BuildProductPair in BuildProductsArray)
				{
					string DebugExtension = "";
					switch (BuildProductPair.Value)
					{
						case BuildProductType.Executable:
							DebugExtension = UEBuildPlatform.GetBuildPlatform(Binary.Target.Platform).GetDebugInfoExtension(UEBuildBinaryType.Executable);
							break;
						case BuildProductType.DynamicLibrary:
							DebugExtension = UEBuildPlatform.GetBuildPlatform(Binary.Target.Platform).GetDebugInfoExtension(UEBuildBinaryType.DynamicLinkLibrary);
							break;
					}
					if (DebugExtension == ".dSYM")
					{
						string BinaryPath = BuildProductPair.Key.FullName;
						if(BinaryPath.Contains(".app"))
						{
							while(BinaryPath.Contains(".app"))
							{
								BinaryPath = Path.GetDirectoryName(BinaryPath);
							}
							BinaryPath = Path.Combine(BinaryPath, BuildProductPair.Key.GetFileName());
							BinaryPath = Path.ChangeExtension(BinaryPath, DebugExtension);
							FileReference Ref = new FileReference(BinaryPath);
							BuildProducts.Add(Ref, BuildProductType.SymbolFile);
						}
					}
					else if(BuildProductPair.Value == BuildProductType.SymbolFile && BuildProductPair.Key.FullName.Contains(".app"))
					{
						BuildProducts.Remove(BuildProductPair.Key);
					}
				}
			}

			if (Binary.Target.GlobalLinkEnvironment.Config.bIsBuildingConsoleApplication)
			{
				return;
			}

			if (BundleContentsDirectory == null && Binary.Config.Type == UEBuildBinaryType.Executable)
			{
				BundleContentsDirectory = Binary.Config.OutputFilePath.Directory.ParentDirectory;
			}

			// We need to know what third party dylibs would be copied to the bundle
			if (Binary.Config.Type != UEBuildBinaryType.StaticLibrary)
			{
				var Modules = Binary.GetAllDependencyModules(bIncludeDynamicallyLoaded: false, bForceCircular: false);
				var BinaryLinkEnvironment = Binary.Target.GlobalLinkEnvironment.DeepCopy();
				var BinaryDependencies = new List<UEBuildBinary>();
				var LinkEnvironmentVisitedModules = new HashSet<UEBuildModule>();
				foreach (var Module in Modules)
				{
					Module.SetupPrivateLinkEnvironment(Binary, BinaryLinkEnvironment, BinaryDependencies, LinkEnvironmentVisitedModules);
				}

				foreach (string AdditionalLibrary in BinaryLinkEnvironment.Config.AdditionalLibraries)
				{
					string LibName = Path.GetFileName(AdditionalLibrary);
					if (LibName.StartsWith("lib"))
					{
						if (Path.GetExtension(AdditionalLibrary) == ".dylib" && BundleContentsDirectory != null)
						{
							FileReference Entry = FileReference.Combine(BundleContentsDirectory, "MacOS", LibName);
							if (!BuildProducts.ContainsKey(Entry))
							{
								BuildProducts.Add(Entry, BuildProductType.DynamicLibrary);
							}
						}
					}
				}

				foreach (UEBuildBundleResource Resource in BinaryLinkEnvironment.Config.AdditionalBundleResources)
				{
					if (Directory.Exists(Resource.ResourcePath))
					{
						foreach (string ResourceFile in Directory.GetFiles(Resource.ResourcePath, "*", SearchOption.AllDirectories))
						{
							BuildProducts.Add(FileReference.Combine(BundleContentsDirectory, Resource.BundleContentsSubdir, ResourceFile.Substring(Path.GetDirectoryName(Resource.ResourcePath).Length + 1)), BuildProductType.RequiredResource);
						}
					}
					else
					{
						BuildProducts.Add(FileReference.Combine(BundleContentsDirectory, Resource.BundleContentsSubdir, Path.GetFileName(Resource.ResourcePath)), BuildProductType.RequiredResource);
					}
				}
			}

			if (Binary.Config.Type == UEBuildBinaryType.Executable)
			{
				// And we also need all the resources
				BuildProducts.Add(FileReference.Combine(BundleContentsDirectory, "Info.plist"), BuildProductType.RequiredResource);
				BuildProducts.Add(FileReference.Combine(BundleContentsDirectory, "PkgInfo"), BuildProductType.RequiredResource);

				if (Binary.Target.TargetType == TargetRules.TargetType.Editor)
				{
					BuildProducts.Add(FileReference.Combine(BundleContentsDirectory, "Resources/UE4Editor.icns"), BuildProductType.RequiredResource);
					BuildProducts.Add(FileReference.Combine(BundleContentsDirectory, "Resources/UProject.icns"), BuildProductType.RequiredResource);
				}
				else
				{
					string IconName = Binary.Target.TargetName;
					if (IconName == "EpicGamesBootstrapLauncher")
					{
						IconName = "EpicGamesLauncher";
					}
					BuildProducts.Add(FileReference.Combine(BundleContentsDirectory, "Resources/" + IconName + ".icns"), BuildProductType.RequiredResource);
				}
			}
		}
예제 #5
0
        public override void AddFilesToReceipt(BuildReceipt Receipt, UEBuildBinary Binary)
		{
			// The cross-platform code adds .dSYMs for static libraries, which is just wrong, so
			// eliminate them here for now.
			string DebugExtension = UEBuildPlatform.GetBuildPlatform(Binary.Target.Platform).GetDebugInfoExtension(Binary.Config.Type);
			if(DebugExtension == ".dsym")
			{
				for (int i = 0; i < Receipt.BuildProducts.Count; i++)
				{
					if(Path.GetExtension(Receipt.BuildProducts[i].Path) == DebugExtension && Receipt.BuildProducts[i].Path.Contains(".app"))
					{
						Receipt.BuildProducts.RemoveAt(i--);
					}
				}

				for (int i = 0; i < Receipt.BuildProducts.Count; i++)
				{
					if((Receipt.BuildProducts[i].Type == BuildProductType.Executable || Receipt.BuildProducts[i].Type == BuildProductType.DynamicLibrary) && Receipt.BuildProducts[i].Path.Contains(".app"))
					{
						string BinaryPath = Receipt.BuildProducts[i].Path;
						while(BinaryPath.Contains(".app"))
						{
							BinaryPath = Path.GetDirectoryName(BinaryPath);
						}
						BinaryPath = Path.Combine(BinaryPath, Path.GetFileName(Receipt.BuildProducts[i].Path));
						Receipt.AddBuildProduct(Path.ChangeExtension(BinaryPath, DebugExtension), BuildProductType.SymbolFile);
					}
				}
			}

			if (Binary.Target.GlobalLinkEnvironment.Config.bIsBuildingConsoleApplication)
			{
				return;
			}

			if (BundleContentsDirectory == "" && Binary.Config.Type == UEBuildBinaryType.Executable)
			{
				BundleContentsDirectory = Path.GetDirectoryName(Path.GetDirectoryName(Binary.Config.OutputFilePath)) + "/";
			}

			// We need to know what third party dylibs would be copied to the bundle
			if(Binary.Config.Type != UEBuildBinaryType.StaticLibrary)
			{
				var Modules = Binary.GetAllDependencyModules(bIncludeDynamicallyLoaded: false, bForceCircular: false);
				var BinaryLinkEnvironment = Binary.Target.GlobalLinkEnvironment.DeepCopy();
				var BinaryDependencies = new List<UEBuildBinary>();
				var LinkEnvironmentVisitedModules = new Dictionary<UEBuildModule, bool>();
				foreach (var Module in Modules)
				{
					Module.SetupPrivateLinkEnvironment(Binary, BinaryLinkEnvironment, BinaryDependencies, LinkEnvironmentVisitedModules);
				}

				foreach (string AdditionalLibrary in BinaryLinkEnvironment.Config.AdditionalLibraries)
				{
					string LibName = Path.GetFileName(AdditionalLibrary);
					if (LibName.StartsWith("lib"))
					{
						if (Path.GetExtension(AdditionalLibrary) == ".dylib" && !String.IsNullOrEmpty(BundleContentsDirectory))
						{
							string Entry = BundleContentsDirectory + "MacOS/" + LibName;
							Receipt.AddBuildProduct(Entry, BuildProductType.DynamicLibrary);
						}
					}
				}

				foreach (UEBuildBundleResource Resource in BinaryLinkEnvironment.Config.AdditionalBundleResources)
				{
					if (Directory.Exists(Resource.ResourcePath))
					{
						foreach (string ResourceFile in Directory.GetFiles(Resource.ResourcePath, "*", SearchOption.AllDirectories))
						{
							Receipt.AddBuildProduct(Path.Combine(BundleContentsDirectory, Resource.BundleContentsSubdir, ResourceFile.Substring(Path.GetDirectoryName(Resource.ResourcePath).Length + 1)), BuildProductType.RequiredResource);
						}
					}
					else
					{
						Receipt.AddBuildProduct(Path.Combine(BundleContentsDirectory, Resource.BundleContentsSubdir, Path.GetFileName(Resource.ResourcePath)), BuildProductType.RequiredResource);
					}
				}
			}

			if (Binary.Config.Type == UEBuildBinaryType.Executable)
			{
				// And we also need all the resources
				Receipt.AddBuildProduct(BundleContentsDirectory + "Info.plist", BuildProductType.RequiredResource);
				Receipt.AddBuildProduct(BundleContentsDirectory + "PkgInfo", BuildProductType.RequiredResource);
				Receipt.AddBuildProduct(BundleContentsDirectory + "Resources/UE4.icns", BuildProductType.RequiredResource);

				if (Binary.Target.AppName.StartsWith("UE4Editor"))
				{
					Receipt.AddBuildProduct(BundleContentsDirectory + "Resources/UProject.icns", BuildProductType.RequiredResource);
				}
			}
		}