/// <summary> /// Write the defines section to the .kdev4/$ProjectName.kdev4 project file. /// </summary> /// <param name="FileContent">File content.</param> private void WriteDefineSection(ref StringBuilder FileContent) { List <string> DefineHolder = new List <string>(); foreach (var CurProject in GeneratedProjectFiles) { KDevelopProjectFile KDevelopProject = CurProject as KDevelopProjectFile; if (KDevelopProject == null) { System.Console.WriteLine("KDevelopProject == null"); continue; } foreach (var CurDefine in KDevelopProject.IntelliSensePreprocessorDefinitions) { if (!DefineHolder.Contains(CurDefine)) { DefineHolder.Add(CurDefine); } } } foreach (var Def in DefineHolder) { FileContent.Append(Def + "\n"); } FileContent.Append("\n\n"); }
/// <summary> /// Write the defines section to the .kdev4/$ProjectName.kdev4 project file. /// </summary> /// <param name="FileContent">File content.</param> private void WriteDefineSection(ref StringBuilder FileContent) { String Key = ""; String Value = ""; List <string> DefineHolder = new List <string>(); foreach (var CurProject in GeneratedProjectFiles) { KDevelopProjectFile KDevelopProject = CurProject as KDevelopProjectFile; if (KDevelopProject == null) { System.Console.WriteLine("KDevelopProject == null"); continue; } foreach (var CurDefine in KDevelopProject.IntelliSensePreprocessorDefinitions) { SplitDefinitionAndValue(CurDefine, out Key, out Value); if (string.IsNullOrEmpty(Value)) { DefineHolder.Add(String.Format("{0} \\\n", Key)); } else { DefineHolder.Add(String.Format("{0}={1} \\\n", Key, Value)); } } } // Remove duplicates if they are present. List <string> Tmp = new List <string>(); Tmp = DefineHolder.Distinct().ToList(); DefineHolder = Tmp.ToList(); foreach (var Def in DefineHolder) { FileContent.Append(Def); } FileContent.Append("\n\n"); }
/// <summary> /// Adds the include directory to the list, after converting it to an absolute path to UE4 root directory. /// </summary> /// <param name="FileContent">File content.</param> private void WriteIncludeSection(ref StringBuilder FileContent) { List <string> IncludeDirectories = new List <string>(); List <string> SystemIncludeDirectories = new List <string>(); var UnrealEngineRootPath = Path.GetFullPath(ProjectFileGenerator.RootRelativePath); int IncludeIndex = 1; // Iterate through all the include paths that // UnrealBuildTool.exe generates foreach (var CurProject in GeneratedProjectFiles) { KDevelopProjectFile KDevelopProject = CurProject as KDevelopProjectFile; if (KDevelopProject == null) { System.Console.WriteLine("KDevelopProject == null"); continue; } foreach (var CurPath in KDevelopProject.IntelliSenseIncludeSearchPaths) { string FullProjectPath = ProjectFileGenerator.MasterProjectPath.FullName; string FullPath = ""; // need to test to see if this in the project souce tree if (CurPath.StartsWith("/") && !CurPath.StartsWith(FullProjectPath)) { // Full path to a folder outside of project FullPath = CurPath; } else { FullPath = Path.GetFullPath(Path.Combine(Path.GetDirectoryName(KDevelopProject.ProjectFilePath.FullName), CurPath)); FullPath = Utils.MakePathRelativeTo(FullPath, FullProjectPath); FullPath = FullPath.TrimEnd('/'); FullPath = Path.Combine(UnrealEngineRootPath, FullPath); } if (!FullPath.Contains("FortniteGame/") && !FullPath.Contains("ThirdParty/")) { SystemIncludeDirectories.Add(String.Format("{0}", FullPath)); IncludeIndex++; } } foreach (var CurPath in KDevelopProject.IntelliSenseSystemIncludeSearchPaths) { string FullProjectPath = ProjectFileGenerator.MasterProjectPath.FullName; string FullPath = ""; if (CurPath.StartsWith("/") && !CurPath.StartsWith(FullProjectPath)) { // Full path to a folder outside of project FullPath = CurPath; } else { FullPath = Path.GetFullPath(Path.Combine(Path.GetDirectoryName(KDevelopProject.ProjectFilePath.FullName), CurPath)); FullPath = Utils.MakePathRelativeTo(FullPath, FullProjectPath); FullPath = FullPath.TrimEnd('/'); FullPath = Path.Combine(UnrealEngineRootPath, FullPath); } if (!FullPath.Contains("FortniteGame/") && !FullPath.Contains("ThirdParty/")) // @todo: skipping Fortnite header paths to shorten clang command line for building UE4XcodeHelper { SystemIncludeDirectories.Add(String.Format("{0}", FullPath)); IncludeIndex++; } } } // Remove duplicate paths from include dir and system include dir list List <string> Tmp = new List <string>(); List <string> Stmp = new List <string>(); Tmp = IncludeDirectories.Distinct().ToList(); Stmp = SystemIncludeDirectories.Distinct().ToList(); IncludeDirectories = Tmp.ToList(); SystemIncludeDirectories = Stmp.ToList(); foreach (var CurPath in IncludeDirectories) { FileContent.Append(CurPath); FileContent.Append(" \n"); } foreach (var CurPath in SystemIncludeDirectories) { FileContent.Append(CurPath); FileContent.Append(" \n"); } FileContent.Append("\n"); }