private static void write_nuspec_file_entry(config_sqlite3 cfg, XmlWriter f) { f.WriteComment(string.Format("{0}", cfg.get_name())); var a = new List<string>(); cfg.get_products(a); foreach (string s in a) { f.WriteStartElement("file"); f.WriteAttributeString("src", string.Format("release\\bin\\{0}", s)); f.WriteAttributeString("target", cfg.get_nuget_target_path()); f.WriteEndElement(); // file } }
private static void gen_sqlite3(config_sqlite3 cfg, string root, string top) { XmlWriterSettings settings = new XmlWriterSettings(); settings.Indent = true; settings.OmitXmlDeclaration = false; using (XmlWriter f = XmlWriter.Create(Path.Combine(top, cfg.get_project_filename()), settings)) { f.WriteStartDocument(); f.WriteComment("Automatically generated"); f.WriteStartElement("Project", "http://schemas.microsoft.com/developer/msbuild/2003"); f.WriteAttributeString("ToolsVersion", ToolsVersion); f.WriteAttributeString("DefaultTargets", "Build"); f.WriteStartElement("ItemGroup"); f.WriteAttributeString("Label", "ProjectConfigurations"); f.WriteStartElement("ProjectConfiguration"); f.WriteAttributeString("Include", string.Format("Debug|{0}", cfg.fixed_cpu())); f.WriteElementString("Configuration", "Debug"); f.WriteElementString("Platform", cfg.fixed_cpu()); f.WriteEndElement(); // ProjectConfiguration f.WriteStartElement("ProjectConfiguration"); f.WriteAttributeString("Include", string.Format("Release|{0}", cfg.fixed_cpu())); f.WriteElementString("Configuration", "Release"); f.WriteElementString("Platform", cfg.fixed_cpu()); f.WriteEndElement(); // ProjectConfiguration f.WriteEndElement(); // ItemGroup f.WriteStartElement("PropertyGroup"); f.WriteElementString("ProjectGuid", cfg.guid); f.WriteElementString("Keyword", "Win32Proj"); f.WriteElementString("DefaultLanguage", "en-us"); switch (cfg.env) { case "winxp": break; } f.WriteEndElement(); // PropertyGroup f.WriteStartElement("Import"); f.WriteAttributeString("Project", "$(VCTargetsPath)\\Microsoft.Cpp.Default.props"); f.WriteEndElement(); // Import f.WriteStartElement("PropertyGroup"); if (cfg.dll) { f.WriteElementString("ConfigurationType", "DynamicLibrary"); } else { f.WriteElementString("ConfigurationType", "StaticLibrary"); } f.WriteElementString("TargetName", "sqlite3"); switch (cfg.env) { case "winxp": f.WriteElementString("PlatformToolset", PlatformToolset + "_xp"); break; } f.WriteEndElement(); // PropertyGroup switch (cfg.env) { case "winxp": break; } switch (cfg.env) { case "winxp": break; } f.WriteStartElement("PropertyGroup"); f.WriteAttributeString("Condition", string.Format(" '$(Configuration)' == 'Debug' ")); f.WriteElementString("UseDebugLibraries", "true"); f.WriteEndElement(); // PropertyGroup f.WriteStartElement("PropertyGroup"); f.WriteAttributeString("Condition", string.Format(" '$(Configuration)' == 'Release' ")); f.WriteElementString("UseDebugLibraries", "false"); f.WriteEndElement(); // PropertyGroup f.WriteStartElement("Import"); f.WriteAttributeString("Project", "$(VCTargetsPath)\\Microsoft.Cpp.props"); f.WriteEndElement(); // Import f.WriteStartElement("PropertyGroup"); f.WriteElementString("OutDir", string.Format("$(Configuration)\\bin\\{0}\\", cfg.get_dest_subpath())); f.WriteElementString("IntDir", string.Format("$(Configuration)\\obj\\{0}\\", cfg.get_dest_subpath())); f.WriteEndElement(); // PropertyGroup f.WriteStartElement("ItemDefinitionGroup"); f.WriteStartElement("ClCompile"); if (cfg.dll) { write_cpp_define(f, "_USRDLL"); write_cpp_define(f, "SQLITE_API=__declspec(dllexport)"); } else { write_cpp_define(f, "_LIB"); } //write_cpp_define(f, "SQLITE_OMIT_LOAD_EXTENSION"); //write_cpp_define(f, "SQLITE_THREADSAFE=whatever"); //write_cpp_define(f, "SQLITE_TEMP_STORE=whatever"); write_cpp_define(f, "SQLITE_DEFAULT_FOREIGN_KEYS=1"); //write_cpp_define(f, "SQLITE_ENABLE_RTREE"); write_cpp_define(f, "SQLITE_ENABLE_FTS4"); write_cpp_define(f, "SQLITE_ENABLE_FTS3_PARENTHESIS"); write_cpp_define(f, "SQLITE_ENABLE_COLUMN_METADATA"); f.WriteElementString("PrecompiledHeader", "NotUsing"); f.WriteElementString("CompileAsWinRT", "false"); f.WriteElementString("SDLCheck", "false"); f.WriteEndElement(); // ClCompile f.WriteStartElement("Link"); f.WriteElementString("SubSystem", "Console"); f.WriteElementString("IgnoreAllDefaultLibraries", "false"); f.WriteElementString("GenerateWindowsMetadata", "false"); f.WriteEndElement(); // Link f.WriteEndElement(); // ItemDefinitionGroup f.WriteStartElement("ItemDefinitionGroup"); f.WriteAttributeString("Condition", string.Format("'$(Configuration)'=='{0}' ", "Debug")); f.WriteStartElement("ClCompile"); f.WriteElementString("Optimization", "Disabled"); write_cpp_define(f, "_DEBUG"); f.WriteEndElement(); // ClCompile f.WriteStartElement("Link"); f.WriteElementString("GenerateDebugInformation", "true"); f.WriteEndElement(); // Link f.WriteEndElement(); // ItemDefinitionGroup f.WriteStartElement("ItemDefinitionGroup"); f.WriteStartElement("ClCompile"); f.WriteAttributeString("Condition", string.Format("'$(Configuration)'=='{0}' ", "Release")); f.WriteElementString("Optimization", "MaxSpeed"); f.WriteElementString("FunctionLevelLinking", "true"); f.WriteElementString("IntrinsicFunctions", "true"); write_cpp_define(f, "NDEBUG"); f.WriteEndElement(); // ClCompile f.WriteStartElement("Link"); f.WriteElementString("GenerateDebugInformation", "false"); f.WriteElementString("EnableCOMDATFolding", "true"); f.WriteElementString("OptimizeReferences", "true"); f.WriteEndElement(); // Link f.WriteEndElement(); // ItemDefinitionGroup f.WriteStartElement("ItemGroup"); { string path = Path.Combine(root, "sqlite3\\sqlite3.c"); f.WriteStartElement("ClCompile"); f.WriteAttributeString("Include", path); f.WriteEndElement(); // ClCompile } f.WriteEndElement(); // ItemGroup f.WriteStartElement("Import"); f.WriteAttributeString("Project", "$(VCTargetsPath)\\Microsoft.Cpp.targets"); f.WriteEndElement(); // Import f.WriteEndElement(); // Project f.WriteEndDocument(); } }
private static void gen_sqlite3(config_sqlite3 cfg, string root, string top) { XmlWriterSettings settings = new XmlWriterSettings(); settings.Indent = true; settings.OmitXmlDeclaration = false; string proj = cfg.get_project_path(top); using (XmlWriter f = XmlWriter.Create(proj, settings)) { f.WriteStartDocument(); f.WriteComment("Automatically generated"); f.WriteStartElement("Project", "http://schemas.microsoft.com/developer/msbuild/2003"); f.WriteAttributeString("ToolsVersion", "4.0"); f.WriteAttributeString("DefaultTargets", "Build"); f.WriteStartElement("ItemGroup"); f.WriteAttributeString("Label", "ProjectConfigurations"); f.WriteStartElement("ProjectConfiguration"); f.WriteAttributeString("Include", string.Format("Debug|{0}", cfg.fixed_cpu())); f.WriteElementString("Configuration", "Debug"); f.WriteElementString("Platform", cfg.fixed_cpu()); f.WriteEndElement(); // ProjectConfiguration f.WriteStartElement("ProjectConfiguration"); f.WriteAttributeString("Include", string.Format("Release|{0}", cfg.fixed_cpu())); f.WriteElementString("Configuration", "Release"); f.WriteElementString("Platform", cfg.fixed_cpu()); f.WriteEndElement(); // ProjectConfiguration f.WriteEndElement(); // ItemGroup f.WriteStartElement("PropertyGroup"); f.WriteElementString("ProjectGuid", cfg.guid); f.WriteElementString("Keyword", "Win32Proj"); f.WriteElementString("DefaultLanguage", "en-us"); switch (cfg.toolset) { case "v110_xp": break; case "v110": f.WriteElementString("MinimumVisualStudioVersion", "11.0"); f.WriteElementString("WindowsAppContainer", "true"); f.WriteElementString("AppContainerApplication", "true"); break; case "v120": f.WriteElementString("MinimumVisualStudioVersion", "12.0"); f.WriteElementString("WindowsAppContainer", "true"); f.WriteElementString("AppContainerApplication", "true"); break; case "wp81_sl": // TODO what to do with this? f.WriteElementString("MinimumVisualStudioVersion", "12.0"); f.WriteElementString("AppContainerApplication", "true"); f.WriteElementString("ApplicationType", "Windows Phone Silverlight"); f.WriteElementString("ApplicationTypeRevision", "8.1"); break; case "v140": f.WriteElementString("MinimumVisualStudioVersion", "14.0"); f.WriteElementString("ApplicationType", "Windows Store"); f.WriteElementString("AppContainerApplication", "true"); f.WriteElementString("ApplicationTypeRevision", "10.0"); f.WriteElementString("WindowsTargetPlatformMinVersion", "10.0.10240.0"); f.WriteElementString("WindowsTargetPlatformVersion", "10.0.10586.0"); break; case "v110_wp80": f.WriteElementString("MinimumVisualStudioVersion", "11.0"); break; case "v120_wp81": f.WriteElementString("MinimumVisualStudioVersion", "12.0"); f.WriteElementString("AppContainerApplication", "true"); f.WriteElementString("ApplicationType", "Windows Phone"); f.WriteElementString("ApplicationTypeRevision", "8.1"); break; default: throw new Exception("unknown toolset"); } f.WriteEndElement(); // PropertyGroup f.WriteStartElement("Import"); f.WriteAttributeString("Project", "$(VCTargetsPath)\\Microsoft.Cpp.Default.props"); f.WriteEndElement(); // Import f.WriteStartElement("PropertyGroup"); if (cfg.dll) { f.WriteElementString("ConfigurationType", "DynamicLibrary"); } else { f.WriteElementString("ConfigurationType", "StaticLibrary"); } f.WriteElementString("TargetName", "sqlite3"); f.WriteElementString("PlatformToolset", cfg.toolset); f.WriteEndElement(); // PropertyGroup switch (cfg.toolset) { case "v110_xp": break; case "v110": case "v120": case "v110_wp80": case "v120_wp81": case "v140": f.WriteStartElement("ItemDefinitionGroup"); f.WriteStartElement("ClCompile"); write_cpp_define(f, "SQLITE_OS_WINRT"); f.WriteEndElement(); // ClCompile f.WriteEndElement(); // ItemDefinitionGroup break; default: throw new Exception("unknown toolset"); } f.WriteStartElement("ItemDefinitionGroup"); f.WriteStartElement("ClCompile"); write_cpp_define(f, "SQLITE_WIN32_FILEMAPPING_API=1"); f.WriteEndElement(); // ClCompile f.WriteEndElement(); // ItemDefinitionGroup f.WriteStartElement("PropertyGroup"); f.WriteAttributeString("Condition", string.Format(" '$(Configuration)' == 'Debug' ")); f.WriteElementString("UseDebugLibraries", "true"); f.WriteEndElement(); // PropertyGroup f.WriteStartElement("PropertyGroup"); f.WriteAttributeString("Condition", string.Format(" '$(Configuration)' == 'Release' ")); f.WriteElementString("UseDebugLibraries", "false"); f.WriteEndElement(); // PropertyGroup f.WriteStartElement("Import"); f.WriteAttributeString("Project", "$(VCTargetsPath)\\Microsoft.Cpp.props"); f.WriteEndElement(); // Import f.WriteStartElement("PropertyGroup"); f.WriteElementString("OutDir", Path.Combine(top, string.Format("$(Configuration)\\bin\\{0}\\", cfg.get_dest_subpath()))); f.WriteElementString("IntDir", Path.Combine(top, string.Format("$(Configuration)\\obj\\{0}\\", cfg.get_dest_subpath()))); f.WriteEndElement(); // PropertyGroup f.WriteStartElement("ItemDefinitionGroup"); f.WriteStartElement("ClCompile"); if (cfg.dll) { write_cpp_define(f, "_USRDLL"); write_cpp_define(f, "SQLITE_API=__declspec(dllexport)"); } else { write_cpp_define(f, "_LIB"); } //write_cpp_define(f, "SQLITE_OMIT_LOAD_EXTENSION"); //write_cpp_define(f, "SQLITE_THREADSAFE=whatever"); //write_cpp_define(f, "SQLITE_TEMP_STORE=whatever"); write_cpp_define(f, "SQLITE_DEFAULT_FOREIGN_KEYS=1"); //write_cpp_define(f, "SQLITE_ENABLE_RTREE"); write_cpp_define(f, "SQLITE_ENABLE_JSON1"); write_cpp_define(f, "SQLITE_ENABLE_FTS4"); write_cpp_define(f, "SQLITE_ENABLE_FTS3_PARENTHESIS"); write_cpp_define(f, "SQLITE_ENABLE_COLUMN_METADATA"); f.WriteElementString("PrecompiledHeader", "NotUsing"); f.WriteElementString("CompileAsWinRT", "false"); f.WriteElementString("SDLCheck", "false"); f.WriteEndElement(); // ClCompile f.WriteStartElement("Link"); f.WriteElementString("SubSystem", "Console"); f.WriteElementString("IgnoreAllDefaultLibraries", "false"); f.WriteElementString("GenerateWindowsMetadata", "false"); f.WriteEndElement(); // Link f.WriteEndElement(); // ItemDefinitionGroup f.WriteStartElement("ItemDefinitionGroup"); f.WriteAttributeString("Condition", string.Format("'$(Configuration)'=='{0}' ", "Debug")); f.WriteStartElement("ClCompile"); f.WriteElementString("Optimization", "Disabled"); write_cpp_define(f, "_DEBUG"); f.WriteEndElement(); // ClCompile f.WriteStartElement("Link"); f.WriteElementString("GenerateDebugInformation", "true"); f.WriteEndElement(); // Link f.WriteEndElement(); // ItemDefinitionGroup f.WriteStartElement("ItemDefinitionGroup"); f.WriteStartElement("ClCompile"); f.WriteAttributeString("Condition", string.Format("'$(Configuration)'=='{0}' ", "Release")); f.WriteElementString("Optimization", "MaxSpeed"); f.WriteElementString("FunctionLevelLinking", "true"); f.WriteElementString("IntrinsicFunctions", "true"); write_cpp_define(f, "NDEBUG"); f.WriteEndElement(); // ClCompile f.WriteStartElement("Link"); f.WriteElementString("GenerateDebugInformation", "false"); f.WriteElementString("EnableCOMDATFolding", "true"); f.WriteElementString("OptimizeReferences", "true"); f.WriteEndElement(); // Link f.WriteEndElement(); // ItemDefinitionGroup f.WriteStartElement("ItemGroup"); { string path = Path.Combine(root, "sqlite3\\sqlite3.c"); f.WriteStartElement("ClCompile"); f.WriteAttributeString("Include", path); f.WriteEndElement(); // ClCompile } f.WriteEndElement(); // ItemGroup f.WriteStartElement("Import"); f.WriteAttributeString("Project", "$(VCTargetsPath)\\Microsoft.Cpp.targets"); f.WriteEndElement(); // Import f.WriteEndElement(); // Project f.WriteEndDocument(); } }