Example #1
0
        public List <string> GetFiles()
        {
            List <string> files = null;

            if (IsLibaryDll)
            {
                if (ISABS)
                {
                    files = FileUtils.GetFilePaths(Path, "*.dll", true, SearchOption.AllDirectories);
                }
                else
                {
                    files = FileUtils.GetFilePaths(ModuleDefManager.GetStaticLibPath() + Path, "*.dll", true, SearchOption.TopDirectoryOnly);
                }
            }
            else
            {
                if (ISABS)
                {
                    files = FileUtils.GetFilePaths(Path, "*.lib", true, SearchOption.AllDirectories);
                }
                else
                {
                    files = FileUtils.GetFilePaths(ModuleDefManager.GetStaticLibPath() + Path, "*.lib", true, SearchOption.TopDirectoryOnly);
                }
            }
            return(files);
        }
Example #2
0
        void AddCustomTargets(List <ModuleDef> Modules, List <BuildConfig> buildConfigs)
        {
            List <PlatformDefinition> Platforms = PlatformDefinition.GetDefaultPlatforms();

            outputdata += "group \" Build/\"\n";
            outputdata += "project \"HeaderTool\"\n";
            outputdata += "kind (\"Makefile\")\n";

            string headertoolString = StringUtils.SanitizePath(ModuleDefManager.GetSourcePath() + "\\EngineHeaderTool.exe ");

            headertoolString += " -Name " + ModuleDefManager.CoreModule.GameModuleName;
            Console.WriteLine("Game Module is " + ModuleDefManager.CoreModule.GameModuleName);
            outputdata += "buildcommands {\" " + headertoolString + "  \"}\n";
            foreach (PlatformDefinition PD in Platforms)
            {
                if (PD == null)
                {
                    continue;
                }

                foreach (BuildConfig Bc in buildConfigs)
                {
                    if (Bc.CurrentPackageType == BuildConfiguration.PackageType.Package)
                    {
                        PushFilter(PD.TypeId, "\"configurations:" + Bc.Name + "\"");
                        outputdata += "     buildcommands{\"$(MSBuildProjectDirectory)/../Binaries/Win64/Release/StandaloneShaderComplier.exe " + PD.Name + "\"}\n";
                    }
                }
            }
            PopFilter();
            // outputdata += "buildoutputs {  '" + StringUtils.SanitizePath(ModuleDefManager.GetIntermediate Dir() + "\\Generated\\Core\\Core\\Components\\LightComponent.generated.h") + "' }\n";
        }
Example #3
0
 public static string RelativeToABS(List <string> Paths)
 {
     for (int i = 0; i < Paths.Count; i++)
     {
         Paths[i] = SanitizePath(ModuleDefManager.GetSourcePath()) + "/" + Paths[i];
     }
     return(ArrayStringQuotes(Paths.ToArray()));
 }
        public override void ClearCache()
        {
            string CMakeDir = ModuleDefManager.GetIntermediateDir() + "\\CMakeFiles";

            if (Directory.Exists(CMakeDir))
            {
                Directory.Delete(CMakeDir, true);
            }
        }
        public override void GenerateList(List <ModuleDef> Modules, ModuleDef CoreModule, List <BuildConfig> buildConfigs)
        {
            Console.WriteLine("Running CMake");
            Console.WriteLine("Targeting Platform " + SingleTargetPlatform.Name);
            GenHeader(buildConfigs);
            ProcessModule(CoreModule);

            foreach (ModuleDef M in Modules)
            {
                ProcessModule(M);
            }
            {//Header tool project
                OutputData += "add_custom_target(" + HeaderToolTarget + " DEPENDS  always_rebuild)\n";
                string headertoolString = StringUtils.SanitizePath(ModuleDefManager.GetSourcePath() + "/EngineHeaderTool.exe \" ");
                Console.WriteLine("Game Module is " + CoreModule.GameModuleName);
                OutputData += "add_custom_command(TARGET " + HeaderToolTarget + "  PRE_BUILD  \nCOMMAND \"" + headertoolString +
                              " -Name " + CoreModule.GameModuleName + " )\n";
                OutputData += "set_target_properties(" + HeaderToolTarget + " PROPERTIES FOLDER " + "Build/" + ")\n";
            }
            if (UseAllBuildWorkAround)
            {
                OutputData += "add_custom_target(" + BuildAllTarget + " ALL)\n";
                if (PreBuild_HeaderTool)
                {
                    OutputData += "add_dependencies(" + BuildAllTarget + " " + HeaderToolTarget + ")\n";
                }
                foreach (ModuleDef M in Modules)
                {
                    OutputData += "add_dependencies(" + BuildAllTarget + " " + M.ModuleName + ")\n";
                }
                //A Workaround is used here to set the correct directories for running the project
                OutputData += "set_target_properties(" + BuildAllTarget + " PROPERTIES FOLDER " + "Targets/" + ")\n";

                OutputData += "set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT " + BuildAllTarget + ")\n";
            }
            else
            {
                ModuleDef Temp_GMOut = null;
                foreach (ModuleDef M in Modules)
                {
                    if (M.ModuleOutputType == ModuleDef.ModuleType.EXE)
                    {
                        Temp_GMOut = M;
                        break;
                    }
                }
                foreach (ModuleDef M in Modules)
                {
                    OutputData += "add_dependencies(" + Temp_GMOut.ModuleName + " " + M.ModuleName + ")\n";
                }
                OutputData += "set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT " + Temp_GMOut.ModuleName + ")\n";
            }

            WriteToFile(ModuleDefManager.GetSourcePath());
        }
Example #6
0
 public void GatherIncludes()
 {
     for (int i = 0; i < IncludeDirectories.Count; i++)
     {
         if (IncludeDirectories[i].Contains("$"))
         {
             continue;
         }
         IncludeDirectories[i] = StringUtils.SanitizePath(ModuleDefManager.GetRootPath() + IncludeDirectories[i]);
     }
 }
        public static void ReplaceAllModule(ModuleDef md, string target, string replacement)
        {
            string VxprojPath = ModuleDefManager.GetIntermediateDir() + "\\" + md.ModuleName + ".vcxproj";

            if (!File.Exists(VxprojPath))
            {
                Console.WriteLine("Error: No project file!");
                return;
            }
            ReplaceAll(VxprojPath, target, replacement);
        }
 //this allows a cmake install to be placed in a folder called CmakeLocal
 bool FindLocalCmake()
 {
     CmakeLocalPath = ModuleDefManager.GetRootPath() + "\\CmakeLocal\\CMake\\bin";
     if (!Directory.Exists(CmakeLocalPath))
     {
         return(false);
     }
     CmakeLocalPath += "\\cmake.exe";
     if (!File.Exists(CmakeLocalPath))
     {
         return(false);
     }
     return(true);
 }
Example #9
0
        public override void Execute()
        {
            string premakeExe = ModuleDefManager.GetRootPath() + "\\Scripts\\premake5.exe";
            string Args       = (Use2019 ? "vs2019" : "vs2017 ") + " --file=\"" + DefinitionFile + "\"";
            int    code       = -1;

            try
            {
                code = ProcessUtils.RunProcess(premakeExe, Args);
            }
            catch
            { }
            Console.WriteLine("PreMake finished with Code: " + code);
        }
        public override void RunPostStep(List <ModuleDef> Modules, ModuleDef CoreModule)
        {
            string replacement        = " Win64|x64";
            string ConfigToken        = "</Configuration>";
            string ConfigreplaceToken = " Win64</Configuration>";

            VisualStudioProjectEditor.EnableUnityBuild(CoreModule);
            VisualStudioProjectEditor.ReplaceAllModule(CoreModule, "|x64", replacement);
            VisualStudioProjectEditor.ReplaceAllModule(CoreModule, ConfigToken, ConfigreplaceToken);
            foreach (ModuleDef m in Modules)
            {
                VisualStudioProjectEditor.EnableUnityBuild(m);
                VisualStudioProjectEditor.ProcessFile(m);
                VisualStudioProjectEditor.ReplaceAllModule(m, "|x64", replacement);
                VisualStudioProjectEditor.ReplaceAllModule(m, ConfigToken, ConfigreplaceToken);
            }
            string buildall = ModuleDefManager.GetIntermediateDir() + "\\ALL_Build.vcxproj";

            VisualStudioProjectEditor.ReplaceAll(buildall, "|x64", replacement);
            VisualStudioProjectEditor.ReplaceAll(buildall, ConfigToken, ConfigreplaceToken);
            string HeaderTool = ModuleDefManager.GetIntermediateDir() + "\\HeaderTool.vcxproj";

            VisualStudioProjectEditor.ReplaceAll(HeaderTool, "|x64", replacement);
            VisualStudioProjectEditor.ReplaceAll(HeaderTool, ConfigToken, ConfigreplaceToken);
            string SLNpath = ModuleDefManager.GetIntermediateDir() + "\\Engine.sln";

            foreach (BuildConfig bc in ModuleDefManager.CurrentConfigs)
            {
                string token            = "|x64.ActiveCfg = " + bc.Name + "|x64";
                string repalcementtoken = "|Win64.ActiveCfg = " + bc.Name + " Win64|x64";
                VisualStudioProjectEditor.ReplaceAll(SLNpath, token, repalcementtoken);
                token            = "|x64.Build.0 = " + bc.Name + "|x64";
                repalcementtoken = "|Win64.Build.0 = " + bc.Name + " Win64|x64";
                VisualStudioProjectEditor.ReplaceAll(SLNpath, token, repalcementtoken);
                token            = "|x64 = " + bc.Name + "|x64";
                repalcementtoken = "|Win64 = " + bc.Name + "|Win64";
                VisualStudioProjectEditor.ReplaceAll(SLNpath, token, repalcementtoken);
            }
            if (UseAllBuildWorkAround)
            {
                foreach (BuildConfig bc in ModuleDefManager.CurrentConfigs)
                {
                    string path = StringUtils.SanitizePath(ModuleDefManager.GetBinPath() + "\\" + bc.Name + "\\");
                    VisualStudioProjectEditor.SetTargetOutput(BuildAllTarget, path, CoreModule.OutputObjectName, bc.Name);
                }
            }
        }
Example #11
0
        public void PostInit(TargetRules r)
        {
            PreProcessorDefines.Add(ModuleName.ToUpper() + "_EXPORT");
            if (ModuleOutputType == ModuleType.LIB)
            {
                PreProcessorDefines.Add("STATIC_MODULE");
            }
            foreach (string t in r.GlobalDefines)
            {
                PreProcessorDefines.Add(t);
            }
            string path = "//Intermediate//Generated//" + ModuleName + "//";

            IncludeDirectories.Add(path);
            IncludeDirectories.Add("//Source//" + ModuleName + "//");
            IncludeDirectories.Add("//Source//" + SourceFileSearchDir + "//");
            foreach (ExternalModuleDef EMD in ExternalModules)
            {
                EMD.Build();

                IncludeDirectories.Add(ModuleDefManager.GetThirdPartyDirRelative() + EMD.IncludeDir);
                DLLs.AddRange(EMD.DynamaicLibs);
                LibNameRefs.AddRange(EMD.StaticLibs);
                AdditonalLibSearchPaths.AddRange(EMD.LibrarySearchPaths);
                SystemLibNames.AddRange(EMD.SystemLibNames);
            }
            foreach (string s in SystemLibNames)
            {
                LibRef L = new LibRef();
                L.Path      = s;
                L.BuildCFg  = LibBuildConfig.General;
                L.BuildType = Library.BCToString(LibBuildConfig.General);
                ModuleLibs.Add(L);
            }
            foreach (LibDependency l in StaticLibraries)
            {
                if (l.NeedsDll)
                {
                    LibNameRef lref;
                    lref.Config  = LibBuildConfig.General;
                    lref.IsDLL   = true;
                    lref.LibName = l.LibName.Replace(".lib", ".dll");
                    DLLs.Add(lref);
                }
            }
        }
        public override void Execute()
        {
            string SDKVersion = ModuleDefManager.TargetRulesObject.GetWinSDKVer();
            string Arg        = " -DCMAKE_SYSTEM_VERSION=" + SDKVersion + " -DCMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION=" + SDKVersion;
            string Vs17Args   = "\"Visual Studio 15 2017 Win64\"" + Arg;
            string Vs15Args   = "\"Visual Studio 14 2015 Win64\"" + Arg;
            string CmakeArgs  = "-G  " + (UseVs17 ? Vs17Args : Vs15Args) + " \"" + ModuleDefManager.GetSourcePath() + "\"";
            string Cmakeexe   = "cmake";

            if (FindLocalCmake())
            {
                Cmakeexe = CmakeLocalPath;
            }
            int code = ProcessUtils.RunProcess(Cmakeexe, CmakeArgs);

            Console.WriteLine("Cmake finished with Code: " + code);
        }
        public ModuleDefManager()
        {
            Instance  = this;
            SourceDir = Directory.GetCurrentDirectory() + "\\Source";;
#if DEBUG
            SourceDir = "C:\\Users\\AANdr\\Documents\\Dev\\Engine\\Engine\\Repo\\GraphicsEngine\\Source\\";
            if (Directory.Exists(SourceDir))
            {
                USEPREMAKE = true;
            }
            else
            {
                SourceDir = Directory.GetCurrentDirectory() + "\\Source";;
            }
#endif
            Projectdata = new Library();
            SettingCache.Load();
        }
        //const string SDKVersion = "10.0.17763.0";
        // const string SDKVersion = "10.0.18362.0";
        void GenHeader(List <BuildConfig> buildConfigs)
        {
            string SDKVersion = ModuleDefManager.TargetRulesObject.GetWinSDKVer();

            OutputData += "cmake_minimum_required (VERSION 3.12.1)\n";
            OutputData += "message(\"Detected CMAKE_SYSTEM_VERSION = '${CMAKE_SYSTEM_VERSION}'\")\n";
            OutputData += "set_property(GLOBAL PROPERTY USE_FOLDERS ON)\n";
            OutputData += "Project(" + "Engine" + " CSharp C CXX )\n";
            string OutputDir = StringUtils.SanitizePath(ModuleDefManager.GetBinPath());

            OutputData += "set(CMAKE_RUNTIME_OUTPUT_DIRECTORY \"" + OutputDir + "\")\n";
            OutputData += "set(CMAKE_LIBRARY_OUTPUT_DIRECTORY  \"" + OutputDir + "\")\n";
            OutputData += "set(CMAKE_MODULE_OUTPUT_DIRECTORY  \"" + OutputDir + "\")\n";///NODEFAULTLIB:MSVCRT
            OutputData += "set(CMAKE_EXE_LINKER_FLAGS \"${CMAKE_EXE_LINKER_FLAGS} /SUBSYSTEM:WINDOWS /IGNORE:4099 \")\n";
            OutputData += "set(CMAKE_EXE_LINKER_CONSOLE_FLAGS \"${CMAKE_EXE_LINKER_FLAGS} /SUBSYSTEM:CONSOLE  \")\n";

            if (EnableFastLink)
            {
                OutputData += "set(CMAKE_EXE_LINKER_FLAGS \"${CMAKE_EXE_LINKER_FLAGS} /INCREMENTAL /debug:fastlink \")\n";
                OutputData += "set(CMAKE_MODULE_LINKER_FLAGS \"${CMAKE_EXE_LINKER_FLAGS} /INCREMENTAL /debug:fastlink \")\n";
                OutputData += "set(CMAKE_SHARED_LINKER_FLAGS \"${CMAKE_EXE_LINKER_FLAGS} /INCREMENTAL /debug:fastlink \")\n";
            }
            OutputData += "set(CMAKE_CONFIGURATION_TYPES" + GetConfigNames(buildConfigs) + ")\n";
            OutputData += "set(CMAKE_SUPPRESS_REGENERATION true)\n";
            OutputData += GetConfigationStrings(buildConfigs);
            OutputData += "add_definitions(/MP)\n";
            OutputData += "add_definitions(-DUNICODE)\nadd_definitions(-D_UNICODE)\n add_definitions(/sdl)\n";//add_definitions(/sdl)\n
            foreach (BuildConfig b in buildConfigs)
            {
                if (b.CurrentPackageType == BuildConfiguration.PackageType.ShippingPackage && b.CurrentType == BuildConfiguration.BuildType.Release)
                {
                    OutputData += AppendConfigFlags(b, "EXE_LINKER", "/LTCG");
                    OutputData += AppendConfigFlags(b, "MODULE_LINKER", "/LTCG");
                    OutputData += AppendConfigFlags(b, "CXX", "/Ob2 /Ot /Oi /GL /arch:AVX2");
                }
                else if (b.CurrentType == BuildConfiguration.BuildType.Release)
                {
                    //OutputData += AppendConfigFlags(b, "EXE_LINKER", "/LTCG");
                    //OutputData += AppendConfigFlags(b, "MODULE_LINKER", "/LTCG");
                    OutputData += AppendConfigFlags(b, "CXX", "/Ob2 /Ot /Oi");
                }
            }
            OutputData += "message(\"Detected CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION = '${CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION}'\")\n";
        }
Example #15
0
        public void CopyDllsToConfig(List <PlatformDefinition> Platforms, List <BuildConfig> configs, List <ModuleDef> ALLModules)
        {
            foreach (PlatformDefinition PD in Platforms)
            {
                foreach (BuildConfig bc in configs)
                {
                    Console.WriteLine("Copying Files for: '" + bc.Name + "' Of type " + bc.CurrentType.ToString());
                    List <string> DLLsForConfig = new List <string>();
                    foreach (ModuleDef M in ALLModules)
                    {
                        foreach (LibNameRef LNR in M.DLLs)
                        {
                            LibRef DLLref = null;
                            GetLib(LNR.LibName, out DLLref, LibBuildConfig.General, true);
                            if (DLLref == null)
                            {
                                Console.WriteLine("Error Failed to find DLL " + LNR.LibName);
                                continue;
                            }
                            if (!IsValidConfig(DLLref.BuildCFg, bc.GetLibType()))
                            {
                                continue;
                            }
                            string filepath = ModuleDefManager.GetBinPath() + "\\" + PD.Name + "\\" + bc.Name + "\\" + Path.GetFileName(LNR.LibName);

                            if (File.Exists(filepath))
                            {
                                if (File.GetLastWriteTime(filepath) >= File.GetLastWriteTime(DLLref.Path))
                                {
                                    continue;
                                }
                            }
                            Directory.CreateDirectory(Path.GetDirectoryName(filepath));
                            File.Copy(DLLref.Path, filepath, true);
                            if (ModuleDefManager.IsDebug())
                            {
                                Console.WriteLine("Copied " + Path.GetFileName(LNR.LibName) + " to output dir");
                            }
                        }
                    }
                }
            }
        }
        public static void ProcessFile(ModuleDef md)
        {
            string VxprojPath = ModuleDefManager.GetIntermediateDir() + "\\" + md.ModuleName + ".vcxproj";

            if (!File.Exists(VxprojPath))
            {
                Console.WriteLine("Error: No project file!");
                return;
            }
            XmlDocument doc = new XmlDocument();

            doc.Load(VxprojPath);
            var nsmgr = new XmlNamespaceManager(doc.NameTable);

            nsmgr.AddNamespace("a", "http://schemas.microsoft.com/developer/msbuild/2003");
            PostProcessStepAddNuGet(doc, nsmgr, md);

            doc.Save(VxprojPath);
        }
        public static void EnableUnityBuild(ModuleDef md)
        {
            if (!CanModuleUnity(md))
            {
                return;
            }
            Console.WriteLine("Experimental VS Unity Build running on module " + md.ModuleName);
            string VxprojPath = ModuleDefManager.GetIntermediateDir() + "\\" + md.ModuleName + ".vcxproj";

            if (!File.Exists(VxprojPath))
            {
                Console.WriteLine("Error: No project file!");
                return;
            }
            XmlDocument doc = new XmlDocument();

            doc.Load(VxprojPath);
            XmlNode target = doc.SelectSingleNode("//EnableUnitySupport");

            if (target == null)
            {
                XmlNode newnode = doc.CreateNode(XmlNodeType.Element, "PropertyGroup", doc.DocumentElement.NamespaceURI);
                doc.DocumentElement.InsertAfter(newnode, doc.DocumentElement.FirstChild);
                XmlNode a = doc.CreateNode(XmlNodeType.Element, "EnableUnitySupport", doc.DocumentElement.NamespaceURI);
                a.InnerText = "true";
                newnode.AppendChild(a);
                var nsmgr = new XmlNamespaceManager(doc.NameTable);
                nsmgr.AddNamespace("a", "http://schemas.microsoft.com/developer/msbuild/2003");
                XmlNodeList complies = doc.SelectNodes("//a:ClCompile", nsmgr);
                foreach (XmlNode x in complies)
                {
                    XmlNode value = doc.CreateNode(XmlNodeType.Element, "IncludeInUnityFile", doc.DocumentElement.NamespaceURI);
                    value.InnerText = "true";//<IncludeInUnityFile>true</IncludeInUnityFile>
                    x.AppendChild(value);
                }

                ProcessExpections(doc, nsmgr, md);

                doc.Save(VxprojPath);
            }
        }
        public static void SetTargetOutput(string Targetname, string outdir, string TargetNamestr, string config)
        {
            string VxprojPath = ModuleDefManager.GetIntermediateDir() + "\\" + Targetname + ".vcxproj";

            if (!File.Exists(VxprojPath))
            {
                Console.WriteLine("Error: No project file!");
                return;
            }
            XmlDocument doc = new XmlDocument();

            doc.Load(VxprojPath);
            var nsmgr = new XmlNamespaceManager(doc.NameTable);

            nsmgr.AddNamespace("a", "http://schemas.microsoft.com/developer/msbuild/2003");
            //  string Conditionstr = "'$(Configuration)|$(Platform)'=='" + config + "Win64|x64'";
            string  Conditionstr = "'$(Configuration)|$(Platform)'=='" + config + "|x64'";
            string  Querry       = "//a:PropertyGroup[@Condition=\"" + Conditionstr + "\"]";
            XmlNode target       = doc.SelectSingleNode(Querry, nsmgr);

            if (target == null)
            {
                XmlNode newnode = doc.CreateElement("PropertyGroup", doc.DocumentElement.NamespaceURI);
                doc.DocumentElement.InsertAfter(newnode, doc.DocumentElement.FirstChild);
                XmlAttribute attrib = doc.CreateAttribute("Condition");
                attrib.Value = Conditionstr;
                newnode.Attributes.Append(attrib);
                target = newnode;
            }

            XmlNode OutDir = doc.CreateElement("OutDir", doc.DocumentElement.NamespaceURI);

            OutDir.InnerText = outdir;
            target.AppendChild(OutDir);
            XmlNode TargetName = doc.CreateElement("TargetName", doc.DocumentElement.NamespaceURI);

            TargetName.InnerText = TargetNamestr;
            target.AppendChild(TargetName);

            doc.Save(VxprojPath);
        }
Example #19
0
 public void GatherSourceFiles()
 {
     if (ModuleSourceFiles.Count != 0)
     {
         return;
     }
     if (LaunguageType == ProjectType.CSharp)
     {
         GetFiles("*.cs");
         ModuleSourceFiles.RemoveAll(IsBuildfile);
     }
     else
     {
         GetFiles("*.h");
         GetFiles("*.hpp");
         GetFiles("*.c");
         GetFiles("*.cpp");
         GetFiles("*.rc");
         GetFiles("*.cs", ModuleDefManager.GetSourcePath() + "\\" + SourceFileSearchDir, true);
         if (IsCoreModule)
         {
             GetFiles("*.hlsl", ModuleDefManager.GetRootPath() + "\\Shaders", false);
             GetFiles("*.h", ModuleDefManager.GetRootPath() + "\\Shaders", false);
             ModuleExtraFiles.Add(StringUtils.SanitizePath(ModuleDefManager.GetSourcePath() + "\\Core.Target.cs"));
         }
     }
     for (int i = 0; i < ModuleSourceFiles.Count; i++)
     {
         foreach (string folder in ExcludedFolders)
         {
             string Safe = folder.Replace("*", "");
             if (ModuleSourceFiles[i].Contains(Safe))
             {
                 ModuleSourceFiles[i] = "";
             }
         }
     }
 }
Example #20
0
 public static int RunProcess(string File, string CmakeArgs)
 {
     System.Diagnostics.Process          process   = new System.Diagnostics.Process();
     System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo();
     startInfo.WindowStyle            = System.Diagnostics.ProcessWindowStyle.Hidden;
     startInfo.FileName               = File;
     startInfo.Arguments              = CmakeArgs;
     startInfo.WorkingDirectory       = ModuleDefManager.GetIntermediateDir();
     startInfo.RedirectStandardOutput = true;
     startInfo.UseShellExecute        = false;
     process.StartInfo = startInfo;
     process.Start();
     while (!process.HasExited)
     {
         using (StreamReader reader = process.StandardOutput)
         {
             string result = reader.ReadToEnd();
             Console.Write(result);
         }
     }
     process.WaitForExit();
     return(process.ExitCode);
 }
        public static void ProcessExpections(XmlDocument doc, XmlNamespaceManager nsmgr, ModuleDef md)
        {
            List <string> Excludes = new List <string>();

            foreach (string path in md.UnityBuildExcludedFolders)
            {
                Excludes.AddRange(FileUtils.GetFilePaths(ModuleDefManager.GetSourcePath() + "\\" + md.ModuleName + "\\" + path, "*.cpp", true));
                Console.WriteLine("Excluded " + path + " from unity build for module " + md.ModuleName);
            }

            XmlNodeList cl = doc.SelectNodes("//a:ItemGroup", nsmgr);

            foreach (string s in Excludes)
            {
                string parsed  = StringUtils.SanitizePathToDoubleBack(s);
                string RelPath = parsed.Replace(StringUtils.SanitizePathToDoubleBack(Directory.GetCurrentDirectory()), "..");
                //..\Source\Core\AI\Core\AIBase.cpp
                XmlNodeList cc = doc.SelectNodes("//a:ClCompile[*]", nsmgr);
                foreach (XmlNode nn in cc)
                {
                    if (nn.Attributes.Count > 0)
                    {
                        if (nn.Attributes[0].Value == RelPath)
                        {
                            foreach (XmlNode child in nn.ChildNodes)
                            {
                                if (child.Name == "IncludeInUnityFile")
                                {
                                    child.InnerText = "false";
                                }
                            }
                        }
                    }
                }
            }
        }
Example #22
0
 void GetFiles(string Type, string path, bool Source)
 {
     try
     {
         string[] files = Directory.GetFiles(path, Type, SearchOption.AllDirectories);
         for (int i = 0; i < files.Length; i++)
         {
             files[i] = files[i].Replace(ModuleDefManager.GetSourcePath() + "\\", "");
             files[i] = files[i].Replace(ModuleDefManager.GetRootPath() + "\\", "../");
             files[i] = StringUtils.SanitizePath(files[i]);
         }
         if (Source)
         {
             ModuleSourceFiles.AddRange(files);
         }
         else
         {
             ModuleExtraFiles.AddRange(files);
         }
     }
     catch
     {
     }
 }
        public void ProcessModule(ModuleDef Module)
        {
            if (Module.Processed)
            {
                return;
            }
            OutputData += "#-------------Module Start " + Module.ModuleName + "----------------\n";
            Module.GatherSourceFiles();
            Module.GatherIncludes();
            if (Module.LaunguageType == ModuleDef.ProjectType.CSharp)
            {
                OutputData += CmakeCSharpProject.GetModule(Module);
                return;
            }
            Module.PreProcessorDefines.AddRange(SingleTargetPlatform.Defines);
            string AllSourceFiles   = StringUtils.ArrayStringQuotes(Module.ModuleSourceFiles.ToArray());
            string ExtraSourceFiles = StringUtils.ArrayStringQuotes(Module.ModuleExtraFiles.ToArray());
            string ALLFiles         = StringUtils.RelativeToABS(Module.ModuleSourceFiles) + ExtraSourceFiles;

            if (Module.ModuleOutputType == ModuleDef.ModuleType.ModuleDLL)
            {
                OutputData += "add_library( " + Module.ModuleName + " MODULE " + ALLFiles + ")\n";
            }
            else if (Module.ModuleOutputType == ModuleDef.ModuleType.DLL)
            {
                OutputData += "add_library( " + Module.ModuleName + " SHARED " + ALLFiles + ")\n";
            }
            else if (Module.ModuleOutputType == ModuleDef.ModuleType.LIB)
            {
                OutputData += "add_library( " + Module.ModuleName + " STATIC " + ALLFiles + ")\n";
            }
            else if (Module.ModuleOutputType == ModuleDef.ModuleType.EXE)
            {
                OutputData += "add_executable( " + Module.ModuleName + " " + ALLFiles + ")\n";
                OutputData += "set_target_properties(" + Module.ModuleName + " PROPERTIES ENABLE_EXPORTS On)\n";
            }

            if (Module.UseConsoleSubSystem)
            {
                OutputData += "set_target_properties(" + Module.ModuleName + " PROPERTIES LINK_FLAGS ${CMAKE_EXE_LINKER_CONSOLE_FLAGS})\n";

                foreach (BuildConfig bc in ModuleDefManager.CurrentConfigs)
                {
                    string OutputDir = StringUtils.SanitizePath(ModuleDefManager.GetBinPath() + "\\Tools\\" + bc.Name + "\\");
                    OutputData += "set_target_properties(" + Module.ModuleName + " PROPERTIES RUNTIME_OUTPUT_DIRECTORY_" + bc.Name.ToUpper() + " \"" + OutputDir + "\")\n";
                }
            }
            if (Module.OutputObjectName.Length > 0)
            {
                OutputData += "set_target_properties(" + Module.ModuleName + " PROPERTIES OUTPUT_NAME \"" + Module.OutputObjectName + "\")\n";
            }
            if (Module.SolutionFolderPath.Length == 0)
            {
                Module.SolutionFolderPath = "Engine/Modules";
            }
            OutputData += "set_target_properties(" + Module.ModuleName + " PROPERTIES FOLDER " + Module.SolutionFolderPath + ")\n";

            if (Module.ModuleLibs.Count != 0)
            {
                OutputData += "target_link_libraries(" + Module.ModuleName + " " + StringUtils.ArrayStringQuotes(Module.ModuleLibs.ToArray()) + ")\n";
            }
            if (PreBuild_HeaderTool)
            {
                OutputData += "add_dependencies(" + Module.ModuleName + " " + HeaderToolTarget + ")\n";
            }
            if (Module.LaunguageType == ModuleDef.ProjectType.ManagedCPP)
            {
                //Module.ModuleDepends.Add("CSharpCore");
            }
            if (Module.ModuleDepends.Count != 0)
            {
                OutputData += "target_link_libraries(" + Module.ModuleName + " " + StringUtils.ArrayStringQuotes(Module.ModuleDepends.ToArray()) + ")\n";
            }
            VisualStudioProjectEditor.ProcessNuGetPacks(Module);
            List <string> Dirs = new List <string>();

            Module.GetIncludeDirs(ref Dirs);
            if (Module != ModuleDefManager.CoreModule)
            {
                ModuleDefManager.CoreModule.GetIncludeDirs(ref Dirs);
            }
            if (Dirs.Count > 0)
            {
#if true
                OutputData += "target_include_directories(" + Module.ModuleName + " PRIVATE " + StringUtils.ArrayStringQuotes(Dirs.ToArray()) + ")\n";
#else
                OutputData += "include_directories(" + Module.ModuleName + " " + ArrayStringQuotes(Dirs.ToArray()) + ")\n";
#endif
                Dirs.Clear();
            }
            OutputData += "source_group(TREE \"" + StringUtils.SanitizePath(ModuleDefManager.GetRootPath()) + "\" REGULAR_EXPRESSION \"*.h\" FILES " + ALLFiles + ")\n";

            OutputData += "set_source_files_properties(" + ExtraSourceFiles + " PROPERTIES HEADER_FILE_ONLY ON)\n";
            OutputData += "set_target_properties( " + Module.ModuleName + " PROPERTIES GHS_NO_SOURCE_GROUP_FILE OFF)\n";
            if (Module.UseCorePCH)
            {
                Module.PCH = ModuleDefManager.CoreModule.PCH;
            }
            if (Module.PCH.Length != 0)
            {
                string PCHString        = /*"Source/" +*/ /*Module.SourceFileSearchDir + "/"+*/ Module.PCH;
                string pchstring        = "/FI" + PCHString + ".h";
                string SharedHeaderData = " /Yu" + PCHString + ".h ";
                if (Module.UseCorePCH)
                {
                    SharedHeaderData = "";
                }
#if false
                if (Module.UseCorePCH)
                {
                    SharedHeaderData = "/Fp" + ModuleDefManager.CoreModule.ModuleName + ".dir" + "/$(Configuration)/" + ModuleDefManager.CoreModule.ModuleName + ".pch";
                }
#endif
                OutputData += "set_target_properties(" + Module.ModuleName + " PROPERTIES COMPILE_FLAGS \"" + SharedHeaderData + pchstring + "\" )\n";

                if (!Module.UseCorePCH)
                {
                    OutputData += "SET_SOURCE_FILES_PROPERTIES(\"" + Module.SourceFileSearchDir + "/" + Module.PCH + ".cpp\" COMPILE_FLAGS \"/Yc" + PCHString + ".h\" )\n";
                }
            }

            if (VisualStudioProjectEditor.CanModuleUnity(Module))
            {
                Module.PreProcessorDefines.Add("WITH_UNITY");
            }
            OutputData += "target_compile_definitions(" + Module.ModuleName + " PRIVATE " + StringUtils.ListStringDefines(Module.PreProcessorDefines) + ")\n";
            ///WHOLEARCHIVE
            if (Module.ModuleDepends.Count > 0 && Module.ModuleOutputType == ModuleDef.ModuleType.LIB)
            {
                string WholeDataString = "";
                foreach (string s in Module.ModuleDepends)
                {
                    WholeDataString += "/WHOLEARCHIVE:" + s + " ";
                }
                OutputData += "SET_TARGET_PROPERTIES(" + Module.ModuleName + " PROPERTIES LINK_FLAGS_DEBUG " + WholeDataString + " )\n";
            }
            if (Module.NeedsCore && Module != ModuleDefManager.CoreModule)
            {
                OutputData += "add_dependencies(" + Module.ModuleName + " Core )\n";
            }
            if (Module.IsCoreModule)
            {
                string VersionGetterString = StringUtils.SanitizePath(ModuleDefManager.GetRootPath() + "/Scripts/WriteCommit.bat ");
                OutputData += "add_custom_command(TARGET " + Module.ModuleName + "  PRE_BUILD  \nCOMMAND \"" + VersionGetterString + "\" )\n";
            }
            if (Module.LaunguageType == ModuleDef.ProjectType.ManagedCPP)
            {
                //Imported_common_language_runtime
                OutputData += "set_property(TARGET " + Module.ModuleName + " PROPERTY VS_DOTNET_TARGET_FRAMEWORK_VERSION \"v4.6.1\")\n";
                OutputData += "set_target_properties(" + Module.ModuleName + " PROPERTIES COMMON_LANGUAGE_RUNTIME \"\")\n";

                //OutputData += "SET (MANAGEDFLAGS \"${CMAKE_CXX_FLAGS}\")\n";
                //OutputData += "SET (MANAGEDFLAGS_D \"${CMAKE_CXX_FLAGS_DEBUG}\")\n";
                //OutputData += "STRING(REPLACE \"/EHsc\" \"/EHa\" MANAGEDFLAGS ${MANAGEDFLAGS}) \n STRING(REPLACE \"/RTC1\" \"\" MANAGEDFLAGS_D ${MANAGEDFLAGS_D})\n";
                //OutputData += "set_target_properties(" + Module.ModuleName + " PROPERTIES COMPILE_FLAGS \"${CMAKE_CXX_FLAGS}" + "/clr" + "\" )\n";
                OutputData += "set_property(TARGET " + Module.ModuleName + " PROPERTY VS_DOTNET_REFERENCES  \"System\" " + StringUtils.ArrayStringQuotes(Module.NetReferences.ToArray()) + " )\n";
            }
            Module.Processed = true;
        }
Example #24
0
        void GetFiles(string Type)
        {
            string path = ModuleDefManager.GetSourcePath() + "\\" + SourceFileSearchDir;

            GetFiles(Type, path, true);
        }
Example #25
0
        static void Main(string[] args)
        {
            ModuleDefManager.USEPREMAKE = true;
            System.Diagnostics.Stopwatch Time = new System.Diagnostics.Stopwatch();
            Time.Start();
            for (int i = 0; i < args.Length; i++)
            {
                args[i] = args[i].ToLower();
            }
            ModuleDefManager manager = new ModuleDefManager();

            if (args.Length > 0)
            {
                if (!args[0].Contains("-"))
                {
                    manager.TargetRulesName = args[0];
                }
                if (args.Contains("-vs19"))
                {
                    PreMakeGenerator.Use2019 = true;
                }
                else
                {
                    PreMakeGenerator.Use2019 = false;// FileUtils.FindVSVersion();
                }
                if (args.Contains("-nounity"))
                {
                    VisualStudioProjectEditor.AllowUnityBuild = false;
                }
                if (args.Contains("-premake"))
                {
                    ModuleDefManager.USEPREMAKE = true;
                }
            }
            else
            {
                CmakeGenerator.UseVs17 = FileUtils.FindVSVersion();
            }
            Console.WriteLine("Using Visual Studio " + (CmakeGenerator.UseVs17 ? "2017" : "2015"));
            if (args.Contains("-clean"))
            {
                manager.Clean();
            }
            if (!args.Contains("-nogen"))
            {
                manager.Run();
            }
            Time.Stop();
            Console.WriteLine("Build tool finished in " + Time.ElapsedMilliseconds + "ms ");
            if (Console.IsOutputRedirected)
            {
                return;
            }
            Console.WriteLine("Closing In 5s Press any key to abort");
            Time.Restart();
            float Starttime = 5;

            while (Time.ElapsedMilliseconds < (Starttime * 1000))
            {
                if (Console.KeyAvailable)
                {
                    Console.WriteLine("\nAborted! Press Any Key To exit");
                    Console.ReadKey(true);
                    Console.ReadKey(true);
                    break;
                }
                Console.Write("\rClosing In " + (Starttime - Time.Elapsed.Seconds) + "s ");
            }
            Time.Stop();
        }
Example #26
0
        string CreateLibs(ModuleDef m, BuildConfig BC, PlatformDefinition PD)
        {
            string linkout = "";

            if (m.UnsupportedPlatforms.Contains(PD.Name))
            {
                return("");
            }
            string DllOut = "";

            if (m != ModuleDefManager.CoreModule)
            {
                DllOut += "\"" + ModuleDefManager.CoreModule.ModuleName + "\", ";
            }
            List <LibRef> AllLibs = new List <LibRef>();

            AllLibs.AddRange(m.ModuleLibs);
            if (m != ModuleDefManager.CoreModule)
            {
                LibRef r = new LibRef();
                r.TargetPlatform = PlatformID.Invalid;
                string OutputDir = StringUtils.SanitizePath(ModuleDefManager.GetBinPath()) + "/" + PD.Name + "/" + BC.Name;
                r.Path = OutputDir + "/Core.lib";
                AllLibs.Add(r);
                AllLibs.AddRange(ModuleDefManager.CoreModule.ModuleLibs);
            }
            //new core
            List <LibDependency> StaticLibs = new List <LibDependency>();

            StaticLibs.AddRange(m.StaticLibraries);

            foreach (ExternalModuleDef ExtraMods in m.ExternalModules)
            {
                // if (!ExtraMods.UnsupportedPlatformsTypes.Contains(""))
                {
                    StaticLibs.AddRange(ExtraMods.StaticLibraries);
                }
            }
            foreach (LibDependency dep in StaticLibs)
            {
                if (dep.Platforms.Contains(PD.TypeId))
                {
                    DllOut += "\"" + dep.LibName + "\", ";
                }
            }
            foreach (LibRef r in AllLibs)
            {
                if (r.TargetPlatform != PlatformID.Invalid && r.TargetPlatform != PD.TypeId)
                {
                    continue;
                }
                if (r.BuildCFg == BC.GetLibType() || r.BuildCFg == LibBuildConfig.General)
                {
                    DllOut += "\"" + r.Path + "\", ";
                }
            }

            if (m.LaunguageType == ModuleDef.ProjectType.CSharp || m.LaunguageType == ModuleDef.ProjectType.ManagedCPP)
            {
                foreach (string s in m.NetReferences)
                {
                    DllOut += "\"" + s + "\", ";
                }
            }
            ModuleDefManager.Instance.OnPreMakeAddLibs(m, BC, PD, ref DllOut);
            return(linkout + DllOut);
        }
Example #27
0
        public override void GenerateList(List <ModuleDef> Modules, ModuleDef CoreModule, List <BuildConfig> buildConfigs)
        {
            Console.WriteLine("Running Premake");
            ModuleDefManager.Instance.PatchPremakeFileHeader(ref outputdata);

            outputdata += "workspace 'Engine'\n";
            outputdata += " location \"" + StringUtils.SanitizePath(ModuleDefManager.GetIntermediateDir()) + "\"\n";
            string OutputDir = StringUtils.SanitizePath(ModuleDefManager.GetBinPath());

            outputdata += "     targetdir  \"" + OutputDir + "\"\n";
            string Configurations = "";

            foreach (BuildConfig B in buildConfigs)
            {
                Configurations += "\"" + B.Name + "\",";
            }
            outputdata += " configurations {" + Configurations + " }\n";


            outputdata += "--Platform Definitions\n";
            List <PlatformDefinition> Platforms = PlatformDefinition.GetDefaultPlatforms();
            string PlatformData = "";

            foreach (PlatformDefinition PDef in Platforms)
            {
                PlatformData += "\"" + PDef.Name + "\",";
            }
            outputdata += " platforms { " + PlatformData + " }\n";


            foreach (PlatformDefinition PDef in Platforms)
            {
                outputdata += "filter{\"platforms:" + PDef.Name + "\"}\n";
                outputdata += "     system \"" + PDef.SystemType + "\"\n";
                outputdata += "     architecture \"" + PDef.ProcessorArch + "\"\n";
                outputdata += "     defines{" + StringUtils.ArrayStringQuotesComma(PDef.Defines.ToArray()) + " }\n";
                outputdata += "     systemversion \"" + PDef.SystemVersion + "\"\n";
            }
            PopFilter();
            PushPlatformFilter(PlatformDefinition.WindowsID);
            foreach (BuildConfig B in buildConfigs)
            {
                outputdata += "filter{\"configurations:" + B.Name + "\"}\n";
                if (B.CurrentType == BuildConfiguration.BuildType.Debug)
                {
                    outputdata += "     defines { \"DEBUG\" } \n symbols \"On\"\n";
                }
                else if (B.CurrentType == BuildConfiguration.BuildType.Release)
                {
                    outputdata += "     defines { \"NDEBUG\" } \n  optimize   \"On\" \n";
                }
            }
            PopFilter();
            AddCustomTargets(Modules, buildConfigs);
            CoreModule.ModuleDepends.Add("HeaderTool");
            AddModule(CoreModule, buildConfigs);
            foreach (ModuleDef m in Modules)
            {
                if (m.IsOutputEXE && m.ModuleOutputType == ModuleDef.ModuleType.EXE)
                {
                    foreach (ModuleDef mn in Modules)
                    {
                        m.ModuleDepends.Add(mn.ModuleName);
                    }
                }
                AddModule(m, buildConfigs);
            }

            File.WriteAllText(DefinitionFile, outputdata);
        }
Example #28
0
 public PreMakeGenerator()
 {
     DefinitionFile = StringUtils.SanitizePath(ModuleDefManager.GetSourcePath() + "/premake.lua");
 }
Example #29
0
        void AddModule(ModuleDef m, List <BuildConfig> buildConfigs)
        {
            List <PlatformDefinition> Platforms = PlatformDefinition.GetDefaultPlatforms();

            m.GatherSourceFiles();
            m.GatherIncludes();
            string        AllSourceFiles   = StringUtils.ArrayStringQuotesComma(m.ModuleSourceFiles.ToArray());
            string        ExtraSourceFiles = StringUtils.ArrayStringQuotesComma(m.ModuleExtraFiles.ToArray());
            List <string> ABSSourceFiles   = m.ModuleSourceFiles;
            string        ALLFiles         = AllSourceFiles + ", " + ExtraSourceFiles;

            outputdata += "\n--Begin Module " + m.ModuleName + "\n";
            outputdata += "group \"" + StringUtils.SanitizePath(m.SolutionFolderPath) + "\"\n";
            outputdata += "project '" + m.ModuleName + "' \n";
            if (m.ModuleOutputType == ModuleDef.ModuleType.EXE)
            {
                if (m.UseConsoleSubSystem)
                {
                    outputdata += "     kind \"ConsoleApp\"\n";
                }
                else
                {
                    outputdata += "     kind \"WindowedApp\"\n";
                }
            }
            else if (m.ModuleOutputType == ModuleDef.ModuleType.LIB)
            {
                outputdata += "     kind \"StaticLib\"\n";
            }
            else
            {
                outputdata += "     kind \"SharedLib\"\n";
            }

            outputdata += "     language \"" + ConvertLanguage(m) + "\"\n";
            outputdata += "     flags {\"NoImportLib\"}\n";
            outputdata += "     editandcontinue \"Off\" \n";
            outputdata += "     cppdialect \"C++17\"\n";

            PushPlatformFilter(PlatformDefinition.WindowsID);
            outputdata += "     buildoptions  {\"/bigobj\"}\n";
            outputdata += "     flags {\"NoImportLib\", \"MultiProcessorCompile\"}\n";
            PopFilter();


            ModuleDefManager.Instance.OnPreMakeWriteModule(m, ref outputdata);

            if (PushPlatformFilter(PlatformDefinition.AndroidID))
            {
                outputdata += "     buildoptions  {\"-frtti -fexceptions\" }\n";
                outputdata += "     cppdialect \"C++14\"\n";
                PopFilter();
            }

            if (m.PCH.Length > 0)
            {
                outputdata += "     pchheader \"" + m.PCH + ".h\"\n";
                outputdata += "     pchsource (\"" + StringUtils.SanitizePath(ModuleDefManager.GetSourcePath() + "/" + m.SourceFileSearchDir) + "/" + m.PCH + ".cpp\")\n";
                outputdata += "     forceincludes {\"" + m.PCH + ".h\"} \n";
            }
            outputdata += "     files {" + ALLFiles + "}\n";
            if (m.PCH.Length > 0)
            {
                outputdata += "     pchsource (\"" + StringUtils.SanitizePath(ModuleDefManager.GetSourcePath() + "/" + m.SourceFileSearchDir) + "/" + m.PCH + ".cpp\")\n";
            }
            List <string> Dirs = new List <string>();

            m.GetIncludeDirs(ref Dirs);
            if (m != ModuleDefManager.CoreModule)
            {
                ModuleDefManager.CoreModule.GetIncludeDirs(ref Dirs);
            }
            outputdata += "     includedirs {" + StringUtils.ArrayStringQuotesComma(Dirs.ToArray()) + "}\n";
            if (m.LaunguageType == ModuleDef.ProjectType.ManagedCPP)
            {
                outputdata += " clr \"on\"\n";
            }
            if (m.UnsupportedPlatforms.Count > 0)
            {
                outputdata += "removeplatforms  { " + StringUtils.ArrayStringQuotesComma(m.UnsupportedPlatforms.ToArray()) + "}\n";
            }
            if (m.ModuleDepends.Count > 0)
            {
                outputdata += "dependson {" + StringUtils.ArrayStringQuotesComma(m.ModuleDepends.ToArray()) + "}\n";
            }
            if (m.ExcludedFolders.Count > 0)
            {
                outputdata += "removefiles { " + StringUtils.ArrayStringQuotesComma(m.ExcludedFolders.ToArray()) + " }\n";
            }
            if (m.ExcludeConfigs.Count > 0)
            {
                outputdata += "removeconfigurations{" + StringUtils.ArrayStringQuotesComma(m.ExcludeConfigs.ToArray()) + "};\n";
            }
            if (m.ExcludedFoldersNew.Count > 0)
            {
                foreach (FolderPlatformPair p in m.ExcludedFoldersNew)
                {
                    PushPlatformFilter(p.Platforms.ToArray(), "files:" + p.FolderName);
                    outputdata += "flags{ \"ExcludeFromBuild\" }\n ";
                    PopFilter();
                }
            }
            List <PlatformID> MergePlatoforms = new List <PlatformID>();

            foreach (PlatformDefinition PD in Platforms)
            {
                if (MergePlatoforms.Contains(PD.TypeId))
                {
                    continue;
                }
                List <PlatformID> AllOthers = new List <PlatformID>();
                PlatformDefinition.TryAddPlatfromsFromString("!" + PD.Name, ref AllOthers);
                for (int i = AllOthers.Count - 1; i >= 0; i--)
                {
                    if (PlatformDefinition.GetDefinition(AllOthers[i]) != null && PlatformDefinition.GetDefinition(AllOthers[i]).ExcludedPlatformFolder == PD.ExcludedPlatformFolder)
                    {
                        MergePlatoforms.Add(AllOthers[i]);
                        AllOthers.RemoveAt(i);
                    }
                }

                foreach (PlatformID i in AllOthers)
                {
                    if (PlatformDefinition.GetDefinition(i) != null)
                    {
                        PlatformID[] d = { i };
                        PushPlatformFilter(d, "files:" + PD.ExcludedPlatformFolder);
                        outputdata += "flags{\"ExcludeFromBuild\"}\n ";
                        PopFilter();
                    }
                }
            }
            //outputdata += "     filter{\"files:**.*\",\"platforms:Win64\"}\n  flags{\"ExcludeFromBuild\"}\n ";
            outputdata += "     filter{\"files:**.hlsl\"}\n  flags{\"ExcludeFromBuild\"}\n ";
            PopFilter();
            foreach (PlatformDefinition PD in Platforms)
            {
                if (PD == null)
                {
                    continue;
                }

                foreach (BuildConfig Bc in buildConfigs)
                {
                    string Links = CreateLibs(m, Bc, PD);
                    if (Links.Length > 0)
                    {
                        PushFilter(PD.TypeId, "\"configurations:" + Bc.Name + "\"");
                        outputdata += "          links { " + Links + "}\n";
                        string OutputDir = StringUtils.SanitizePath(ModuleDefManager.GetBinPath()) + "/" + PD.Name + "/" + Bc.Name;
                        outputdata += "          targetdir  (\"" + OutputDir + "\")\n";
                        if (m.OutputObjectName.Length != 0)
                        {
                            outputdata += "          targetname \"" + m.OutputObjectName + "\"\n";
                        }
                        List <string> Defines = new List <string>();
                        List <string> LibDirs = new List <string>();
                        Defines.AddRange(m.PreProcessorDefines);
                        Defines.AddRange(Bc.Defines);
                        foreach (ExternalModuleDef ExtraMods in m.ExternalModules)
                        {
                            if (!ExtraMods.UnsupportedPlatformsTypes.Contains(PD.TypeId))
                            {
                                Defines.AddRange(ExtraMods.Defines);
                                LibDirs.AddRange(ExtraMods.LibDirs);
                            }
                        }
                        outputdata += "     defines{" + StringUtils.ArrayStringQuotesComma(Defines.ToArray()) + " }\n";
                        outputdata += "     libdirs{" + StringUtils.ArrayStringQuotesComma(LibDirs.ToArray()) + " }\n";
                        PopFilter();
                    }
                }
            }
            PopFilter();
            if (m.IsCoreModule)
            {
                outputdata += "prebuildcommands(\"$(MSBuildProjectDirectory)/../Scripts/WriteCommit.bat\")\n";
            }
        }
Example #30
0
 static string GetSettingFilePath()
 {
     return(ModuleDefManager.GetIntermediateDir() + "\\SettingCache.xml");
 }