private bool IsPartOfUE4XcodeHelperTarget(XcodeSourceFile SourceFile) { string FileExtension = Path.GetExtension(SourceFile.FilePath); if (IsSourceCode(FileExtension)) // || GetFileType(FileExtension) == "sourcecode.c.h") @todo: It seemed that headers need to be added to project for live issues detection to work in them { foreach (string PlatformName in Enum.GetNames(typeof(UnrealTargetPlatform))) { string AltName = PlatformName == "Win32" || PlatformName == "Win64" ? "windows" : PlatformName.ToLower(); if ((SourceFile.FilePath.ToLower().Contains("/" + PlatformName.ToLower() + "/") || SourceFile.FilePath.ToLower().Contains("/" + AltName + "/")) && PlatformName != "Mac") { // UE4XcodeHelper is Mac only target, so skip other platforms files return(false); } else if (SourceFile.FilePath.EndsWith("SimplygonMeshReduction.cpp") || SourceFile.FilePath.EndsWith("MeshBoneReduction.cpp") || SourceFile.FilePath.EndsWith("Android.cpp") || SourceFile.FilePath.EndsWith("Amazon.cpp") || SourceFile.FilePath.EndsWith("FacebookModule.cpp") || SourceFile.FilePath.EndsWith("SDL_angle.c") || SourceFile.FilePath.Contains("VisualStudioSourceCodeAccess") || SourceFile.FilePath.Contains("AndroidDevice") || SourceFile.FilePath.Contains("IOSDevice") || SourceFile.FilePath.Contains("WindowsDevice") || SourceFile.FilePath.Contains("WindowsMoviePlayer") || SourceFile.FilePath.EndsWith("IOSTapJoy.cpp")) { // @todo: We need a way to filter out files that use SDKs we don't have return(false); } } return(true); } return(false); }
/** * Generates bodies of all sections that contain a list of source files plus a dictionary of project navigator groups. */ public void GenerateSectionsContents(ref string PBXBuildFileSection, ref string PBXFileReferenceSection, ref string PBXSourcesBuildPhaseSection, ref Dictionary <string, XcodeFileGroup> Groups) { StringBuilder FileSection = new StringBuilder(); StringBuilder ReferenceSection = new StringBuilder(); StringBuilder BuildPhaseSection = new StringBuilder(); foreach (var CurSourceFile in SourceFiles) { XcodeSourceFile SourceFile = CurSourceFile as XcodeSourceFile; string FileName = Path.GetFileName(SourceFile.FilePath); string FileExtension = Path.GetExtension(FileName); string FilePath = Utils.MakePathRelativeTo(SourceFile.FilePath, XcodeProjectFileGenerator.MasterProjectRelativePath); string FilePathMac = Utils.CleanDirectorySeparators(FilePath, '/'); // Xcode doesn't parse the project file correctly if the build files don't use the same file reference ID, // so you can't just manually add an entry for UE4CmdLineRun.m, because the ID will conflict with the // ID that gets generated above implicitly by "XcodeSourceFile SourceFile = CurSourceFile as XcodeSourceFile;" // At the same time, it is necessary to manually add an entry for it, because we're compiling the unit test with // exactly one source file. // This is ugly, but the project file generator wasn't designed to handle special cases like this, // so we're left with little choice. if (FileName == "UE4CmdLineRun.m") { SourceFile.ReplaceGUIDS(UE4CmdLineRunFileGuid, UE4CmdLineRunFileRefGuid); } if (IsGeneratedProject) { FileSection.Append(string.Format("\t\t{0} /* {1} in {2} */ = {{isa = PBXBuildFile; fileRef = {3} /* {1} */; }};" + ProjectFileGenerator.NewLine, SourceFile.FileGUID, FileName, GetFileCategory(FileExtension), SourceFile.FileRefGUID)); } ReferenceSection.Append(string.Format("\t\t{0} /* {1} */ = {{isa = PBXFileReference; lastKnownFileType = {2}; name = \"{1}\"; path = \"{3}\"; sourceTree = SOURCE_ROOT; }};" + ProjectFileGenerator.NewLine, SourceFile.FileRefGUID, FileName, GetFileType(FileExtension), FilePathMac)); if (IsPartOfUE4XcodeHelperTarget(SourceFile)) { BuildPhaseSection.Append("\t\t\t\t" + SourceFile.FileGUID + " /* " + FileName + " in Sources */," + ProjectFileGenerator.NewLine); } string GroupPath = Path.GetFullPath(Path.GetDirectoryName(SourceFile.FilePath)); XcodeFileGroup Group = FindGroupByFullPath(ref Groups, GroupPath); if (Group != null) { Group.Files.Add(SourceFile); } } PBXBuildFileSection += FileSection.ToString(); PBXFileReferenceSection += ReferenceSection.ToString(); PBXSourcesBuildPhaseSection += BuildPhaseSection.ToString(); }
private bool IsPartOfUE4XcodeHelperTarget(XcodeSourceFile SourceFile) { string FileExtension = Path.GetExtension(SourceFile.FilePath); if (IsSourceCode(FileExtension))// || GetFileType(FileExtension) == "sourcecode.c.h") @todo: It seemed that headers need to be added to project for live issues detection to work in them { foreach (string PlatformName in Enum.GetNames(typeof(UnrealTargetPlatform))) { string AltName = PlatformName == "Win32" || PlatformName == "Win64" ? "windows" : PlatformName.ToLower(); if ((SourceFile.FilePath.ToLower().Contains("/" + PlatformName.ToLower() + "/") || SourceFile.FilePath.ToLower().Contains("/" + AltName + "/")) && PlatformName != "Mac") { // UE4XcodeHelper is Mac only target, so skip other platforms files return false; } else if (SourceFile.FilePath.EndsWith("SimplygonMeshReduction.cpp") || SourceFile.FilePath.EndsWith("MeshBoneReduction.cpp") || SourceFile.FilePath.EndsWith("Android.cpp") || SourceFile.FilePath.EndsWith("Amazon.cpp") || SourceFile.FilePath.EndsWith("FacebookModule.cpp") || SourceFile.FilePath.EndsWith("SDL_angle.c") || SourceFile.FilePath.Contains("VisualStudioSourceCodeAccess") || SourceFile.FilePath.Contains("AndroidDevice") || SourceFile.FilePath.Contains("IOSDevice") || SourceFile.FilePath.Contains("WindowsDevice") || SourceFile.FilePath.Contains("WindowsMoviePlayer") || SourceFile.FilePath.EndsWith("IOSTapJoy.cpp")) { // @todo: We need a way to filter out files that use SDKs we don't have return false; } } return true; } return false; }
private bool ShouldIncludeFileInBuildPhaseSection(XcodeSourceFile SourceFile) { string FileExtension = SourceFile.Reference.GetExtension(); if (IsSourceCode(FileExtension)) { foreach (string PlatformName in Enum.GetNames(typeof(UnrealTargetPlatform))) { string AltName = PlatformName == "Win32" || PlatformName == "Win64" ? "windows" : PlatformName.ToLower(); if ((SourceFile.Reference.FullName.ToLower().Contains("/" + PlatformName.ToLower() + "/") || SourceFile.Reference.FullName.ToLower().Contains("/" + AltName + "/")) && PlatformName != "Mac" && PlatformName != "IOS" && PlatformName != "TVOS") { // Build phase is used for indexing only and indexing currently works only with files that can be compiled for Mac, so skip files for other platforms return false; } } return true; } return false; }