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);
                }
            }
        }
        //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";
        }
Esempio n. 3
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 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;
        }
Esempio n. 5
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);
        }
Esempio n. 6
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);
        }
Esempio n. 7
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";
            }
        }