Merge topic 'use-cmXMLWriter'
51465da1
CPack/IFW: port to cmXMLWriter754485af
cmExtraEclipseCDT4Generator: port to cmXMLWriterc45671b0
cmGlobalKdevelopGenerator: port to cmXMLWriterdcdc270e
cmExtraCodeLiteGenerator: port to cmXMLWriter27e09764
cmExtraCodeBlocksGenerator: port to cmXMLWriterd7407621
cmXMLWriter: add Doctype() methoddd27e313
cmXMLWriter: overload Element() method for empty elements
This commit is contained in:
commit
405766757c
|
@ -27,7 +27,7 @@
|
||||||
#include <cmSystemTools.h>
|
#include <cmSystemTools.h>
|
||||||
#include <cmMakefile.h>
|
#include <cmMakefile.h>
|
||||||
#include <cmGeneratedFileStream.h>
|
#include <cmGeneratedFileStream.h>
|
||||||
#include <cmXMLSafe.h>
|
#include <cmXMLWriter.h>
|
||||||
#include <cmVersionConfig.h>
|
#include <cmVersionConfig.h>
|
||||||
#include <cmTimestamp.h>
|
#include <cmTimestamp.h>
|
||||||
|
|
||||||
|
@ -611,18 +611,19 @@ cmCPackIFWPackage* cmCPackIFWGenerator::GetComponentPackage(
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
void cmCPackIFWGenerator::WriteGeneratedByToStrim(cmGeneratedFileStream &xout)
|
void cmCPackIFWGenerator::WriteGeneratedByToStrim(cmXMLWriter &xout)
|
||||||
{
|
{
|
||||||
xout << "<!-- Generated by CPack " << CMake_VERSION << " IFW generator "
|
std::stringstream comment;
|
||||||
|
comment << "Generated by CPack " << CMake_VERSION << " IFW generator "
|
||||||
<< "for QtIFW ";
|
<< "for QtIFW ";
|
||||||
if(IsVersionLess("2.0"))
|
if(IsVersionLess("2.0"))
|
||||||
{
|
{
|
||||||
xout << "less 2.0";
|
comment << "less 2.0";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
xout << FrameworkVersion;
|
comment << FrameworkVersion;
|
||||||
}
|
}
|
||||||
xout << " tools at " << cmTimestamp().CurrentTime("", true) << " -->"
|
comment << " tools at " << cmTimestamp().CurrentTime("", true);
|
||||||
<< std::endl;
|
xout.Comment(comment.str().c_str());
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,12 +13,13 @@
|
||||||
#ifndef cmCPackIFWGenerator_h
|
#ifndef cmCPackIFWGenerator_h
|
||||||
#define cmCPackIFWGenerator_h
|
#define cmCPackIFWGenerator_h
|
||||||
|
|
||||||
#include <cmGeneratedFileStream.h>
|
|
||||||
#include <CPack/cmCPackGenerator.h>
|
#include <CPack/cmCPackGenerator.h>
|
||||||
|
|
||||||
#include "cmCPackIFWPackage.h"
|
#include "cmCPackIFWPackage.h"
|
||||||
#include "cmCPackIFWInstaller.h"
|
#include "cmCPackIFWInstaller.h"
|
||||||
|
|
||||||
|
class cmXMLWriter;
|
||||||
|
|
||||||
/** \class cmCPackIFWGenerator
|
/** \class cmCPackIFWGenerator
|
||||||
* \brief A generator for Qt Installer Framework tools
|
* \brief A generator for Qt Installer Framework tools
|
||||||
*
|
*
|
||||||
|
@ -121,7 +122,7 @@ protected: // Methods
|
||||||
cmCPackIFWPackage* GetGroupPackage(cmCPackComponentGroup *group) const;
|
cmCPackIFWPackage* GetGroupPackage(cmCPackComponentGroup *group) const;
|
||||||
cmCPackIFWPackage* GetComponentPackage(cmCPackComponent *component) const;
|
cmCPackIFWPackage* GetComponentPackage(cmCPackComponent *component) const;
|
||||||
|
|
||||||
void WriteGeneratedByToStrim(cmGeneratedFileStream& xout);
|
void WriteGeneratedByToStrim(cmXMLWriter& xout);
|
||||||
|
|
||||||
protected: // Data
|
protected: // Data
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
#include <CPack/cmCPackLog.h>
|
#include <CPack/cmCPackLog.h>
|
||||||
|
|
||||||
#include <cmGeneratedFileStream.h>
|
#include <cmGeneratedFileStream.h>
|
||||||
#include <cmXMLSafe.h>
|
#include <cmXMLWriter.h>
|
||||||
|
|
||||||
#ifdef cmCPackLogger
|
#ifdef cmCPackLogger
|
||||||
# undef cmCPackLogger
|
# undef cmCPackLogger
|
||||||
|
@ -334,30 +334,27 @@ void cmCPackIFWInstaller::GenerateInstallerFile()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Output stream
|
// Output stream
|
||||||
cmGeneratedFileStream xout((Directory + "/config/config.xml").data());
|
cmGeneratedFileStream fout((Directory + "/config/config.xml").data());
|
||||||
|
cmXMLWriter xout(fout);
|
||||||
|
|
||||||
xout << "<?xml version=\"1.0\"?>" << std::endl;
|
xout.StartDocument();
|
||||||
|
|
||||||
WriteGeneratedByToStrim(xout);
|
WriteGeneratedByToStrim(xout);
|
||||||
|
|
||||||
xout << "<Installer>" << std::endl;
|
xout.StartElement("Installer");
|
||||||
|
|
||||||
xout << " <Name>" << cmXMLSafe(Name).str() << "</Name>" << std::endl;
|
xout.Element("Name", Name);
|
||||||
|
xout.Element("Version", Version);
|
||||||
xout << " <Version>" << Version << "</Version>" << std::endl;
|
xout.Element("Title", Title);
|
||||||
|
|
||||||
xout << " <Title>" << cmXMLSafe(Title).str() << "</Title>"
|
|
||||||
<< std::endl;
|
|
||||||
|
|
||||||
if(!Publisher.empty())
|
if(!Publisher.empty())
|
||||||
{
|
{
|
||||||
xout << " <Publisher>" << cmXMLSafe(Publisher).str()
|
xout.Element("Publisher", Publisher);
|
||||||
<< "</Publisher>" << std::endl;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!ProductUrl.empty())
|
if(!ProductUrl.empty())
|
||||||
{
|
{
|
||||||
xout << " <ProductUrl>" << ProductUrl << "</ProductUrl>" << std::endl;
|
xout.Element("ProductUrl", ProductUrl);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ApplicationIcon
|
// ApplicationIcon
|
||||||
|
@ -369,8 +366,7 @@ void cmCPackIFWInstaller::GenerateInstallerFile()
|
||||||
name = cmSystemTools::GetFilenameWithoutExtension(name);
|
name = cmSystemTools::GetFilenameWithoutExtension(name);
|
||||||
cmsys::SystemTools::CopyFileIfDifferent(
|
cmsys::SystemTools::CopyFileIfDifferent(
|
||||||
InstallerApplicationIcon.data(), path.data());
|
InstallerApplicationIcon.data(), path.data());
|
||||||
xout << " <InstallerApplicationIcon>" << name
|
xout.Element("InstallerApplicationIcon", name);
|
||||||
<< "</InstallerApplicationIcon>" << std::endl;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// WindowIcon
|
// WindowIcon
|
||||||
|
@ -380,8 +376,7 @@ void cmCPackIFWInstaller::GenerateInstallerFile()
|
||||||
std::string path = Directory + "/config/" + name;
|
std::string path = Directory + "/config/" + name;
|
||||||
cmsys::SystemTools::CopyFileIfDifferent(
|
cmsys::SystemTools::CopyFileIfDifferent(
|
||||||
InstallerWindowIcon.data(), path.data());
|
InstallerWindowIcon.data(), path.data());
|
||||||
xout << " <InstallerWindowIcon>" << name
|
xout.Element("InstallerWindowIcon", name);
|
||||||
<< "</InstallerWindowIcon>" << std::endl;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Logo
|
// Logo
|
||||||
|
@ -390,104 +385,91 @@ void cmCPackIFWInstaller::GenerateInstallerFile()
|
||||||
std::string name = cmSystemTools::GetFilenameName(Logo);
|
std::string name = cmSystemTools::GetFilenameName(Logo);
|
||||||
std::string path = Directory + "/config/" + name;
|
std::string path = Directory + "/config/" + name;
|
||||||
cmsys::SystemTools::CopyFileIfDifferent(Logo.data(), path.data());
|
cmsys::SystemTools::CopyFileIfDifferent(Logo.data(), path.data());
|
||||||
xout << " <Logo>" << name << "</Logo>" << std::endl;
|
xout.Element("Logo", name);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Start menu
|
// Start menu
|
||||||
if(!IsVersionLess("2.0"))
|
if(!IsVersionLess("2.0"))
|
||||||
{
|
{
|
||||||
xout << " <StartMenuDir>" << StartMenuDir
|
xout.Element("StartMenuDir", StartMenuDir);
|
||||||
<< "</StartMenuDir>" << std::endl;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Target dir
|
// Target dir
|
||||||
if(!TargetDir.empty())
|
if(!TargetDir.empty())
|
||||||
{
|
{
|
||||||
xout << " <TargetDir>" << TargetDir << "</TargetDir>" << std::endl;
|
xout.Element("TargetDir", TargetDir);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Admin target dir
|
// Admin target dir
|
||||||
if(!AdminTargetDir.empty())
|
if(!AdminTargetDir.empty())
|
||||||
{
|
{
|
||||||
xout << " <AdminTargetDir>" << AdminTargetDir
|
xout.Element("AdminTargetDir", AdminTargetDir);
|
||||||
<< "</AdminTargetDir>" << std::endl;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remote repositories
|
// Remote repositories
|
||||||
if (!Repositories.empty())
|
if (!Repositories.empty())
|
||||||
{
|
{
|
||||||
xout << " <RemoteRepositories>" << std::endl;
|
xout.StartElement("RemoteRepositories");
|
||||||
for(std::vector<RepositoryStruct>::iterator
|
for(std::vector<RepositoryStruct>::iterator
|
||||||
rit = Repositories.begin(); rit != Repositories.end(); ++rit)
|
rit = Repositories.begin(); rit != Repositories.end(); ++rit)
|
||||||
{
|
{
|
||||||
xout << " <Repository>" << std::endl;
|
xout.StartElement("Repository");
|
||||||
// Url
|
// Url
|
||||||
xout << " <Url>" << rit->Url
|
xout.Element("Url", rit->Url);
|
||||||
<< "</Url>" << std::endl;
|
|
||||||
// Enabled
|
// Enabled
|
||||||
if(!rit->Enabled.empty())
|
if(!rit->Enabled.empty())
|
||||||
{
|
{
|
||||||
xout << " <Enabled>" << rit->Enabled
|
xout.Element("Enabled", rit->Enabled);
|
||||||
<< "</Enabled>" << std::endl;
|
|
||||||
}
|
}
|
||||||
// Username
|
// Username
|
||||||
if(!rit->Username.empty())
|
if(!rit->Username.empty())
|
||||||
{
|
{
|
||||||
xout << " <Username>" << rit->Username
|
xout.Element("Username", rit->Username);
|
||||||
<< "</Username>" << std::endl;
|
|
||||||
}
|
}
|
||||||
// Password
|
// Password
|
||||||
if(!rit->Password.empty())
|
if(!rit->Password.empty())
|
||||||
{
|
{
|
||||||
xout << " <Password>" << rit->Password
|
xout.Element("Password", rit->Password);
|
||||||
<< "</Password>" << std::endl;
|
|
||||||
}
|
}
|
||||||
// DisplayName
|
// DisplayName
|
||||||
if(!rit->DisplayName.empty())
|
if(!rit->DisplayName.empty())
|
||||||
{
|
{
|
||||||
xout << " <DisplayName>" << rit->DisplayName
|
xout.Element("DisplayName", rit->DisplayName);
|
||||||
<< "</DisplayName>" << std::endl;
|
|
||||||
}
|
}
|
||||||
xout << " </Repository>" << std::endl;
|
xout.EndElement();
|
||||||
}
|
}
|
||||||
xout << " </RemoteRepositories>" << std::endl;
|
xout.EndElement();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Maintenance tool
|
// Maintenance tool
|
||||||
if(!IsVersionLess("2.0") && !MaintenanceToolName.empty())
|
if(!IsVersionLess("2.0") && !MaintenanceToolName.empty())
|
||||||
{
|
{
|
||||||
xout << " <MaintenanceToolName>" << MaintenanceToolName
|
xout.Element("MaintenanceToolName", MaintenanceToolName);
|
||||||
<< "</MaintenanceToolName>" << std::endl;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Maintenance tool ini file
|
// Maintenance tool ini file
|
||||||
if(!IsVersionLess("2.0") && !MaintenanceToolIniFile.empty())
|
if(!IsVersionLess("2.0") && !MaintenanceToolIniFile.empty())
|
||||||
{
|
{
|
||||||
xout << " <MaintenanceToolIniFile>" << MaintenanceToolIniFile
|
xout.Element("MaintenanceToolIniFile", MaintenanceToolIniFile);
|
||||||
<< "</MaintenanceToolIniFile>" << std::endl;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Different allows
|
// Different allows
|
||||||
if(IsVersionLess("2.0"))
|
if(IsVersionLess("2.0"))
|
||||||
{
|
{
|
||||||
// CPack IFW default policy
|
// CPack IFW default policy
|
||||||
xout << " <!-- CPack IFW default policy for QtIFW less 2.0 -->"
|
xout.Comment("CPack IFW default policy for QtIFW less 2.0");
|
||||||
<< std::endl;
|
xout.Element("AllowNonAsciiCharacters", "true");
|
||||||
xout << " <AllowNonAsciiCharacters>true</AllowNonAsciiCharacters>"
|
xout.Element("AllowSpaceInPath", "true");
|
||||||
<< std::endl;
|
|
||||||
xout << " <AllowSpaceInPath>true</AllowSpaceInPath>" << std::endl;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if(!AllowNonAsciiCharacters.empty())
|
if(!AllowNonAsciiCharacters.empty())
|
||||||
{
|
{
|
||||||
xout << " <AllowNonAsciiCharacters>" << AllowNonAsciiCharacters
|
xout.Element("AllowNonAsciiCharacters", AllowNonAsciiCharacters);
|
||||||
<< "</AllowNonAsciiCharacters>" << std::endl;
|
|
||||||
}
|
}
|
||||||
if(!AllowSpaceInPath.empty())
|
if(!AllowSpaceInPath.empty())
|
||||||
{
|
{
|
||||||
xout << " <AllowAllowSpaceInPath>" << AllowSpaceInPath
|
xout.Element("AllowSpaceInPath", AllowSpaceInPath);
|
||||||
<< "</AllowSpaceInPath>" << std::endl;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -497,10 +479,11 @@ void cmCPackIFWInstaller::GenerateInstallerFile()
|
||||||
std::string name = cmSystemTools::GetFilenameName(ControlScript);
|
std::string name = cmSystemTools::GetFilenameName(ControlScript);
|
||||||
std::string path = Directory + "/config/" + name;
|
std::string path = Directory + "/config/" + name;
|
||||||
cmsys::SystemTools::CopyFileIfDifferent(ControlScript.data(), path.data());
|
cmsys::SystemTools::CopyFileIfDifferent(ControlScript.data(), path.data());
|
||||||
xout << " <ControlScript>" << name << "</ControlScript>" << std::endl;
|
xout.Element("ControlScript", name);
|
||||||
}
|
}
|
||||||
|
|
||||||
xout << "</Installer>" << std::endl;
|
xout.EndElement();
|
||||||
|
xout.EndDocument();
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
|
@ -535,7 +518,7 @@ void cmCPackIFWInstaller::GeneratePackageFiles()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void cmCPackIFWInstaller::WriteGeneratedByToStrim(cmGeneratedFileStream &xout)
|
void cmCPackIFWInstaller::WriteGeneratedByToStrim(cmXMLWriter &xout)
|
||||||
{
|
{
|
||||||
if(Generator) Generator->WriteGeneratedByToStrim(xout);
|
if(Generator) Generator->WriteGeneratedByToStrim(xout);
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,11 +13,11 @@
|
||||||
#ifndef cmCPackIFWInstaller_h
|
#ifndef cmCPackIFWInstaller_h
|
||||||
#define cmCPackIFWInstaller_h
|
#define cmCPackIFWInstaller_h
|
||||||
|
|
||||||
#include <cmGeneratedFileStream.h>
|
|
||||||
#include <cmStandardIncludes.h>
|
#include <cmStandardIncludes.h>
|
||||||
|
|
||||||
class cmCPackIFWPackage;
|
class cmCPackIFWPackage;
|
||||||
class cmCPackIFWGenerator;
|
class cmCPackIFWGenerator;
|
||||||
|
class cmXMLWriter;
|
||||||
|
|
||||||
/** \class cmCPackIFWInstaller
|
/** \class cmCPackIFWInstaller
|
||||||
* \brief A binary installer to be created CPack IFW generator
|
* \brief A binary installer to be created CPack IFW generator
|
||||||
|
@ -115,7 +115,7 @@ public: // Internal implementation
|
||||||
std::string Directory;
|
std::string Directory;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void WriteGeneratedByToStrim(cmGeneratedFileStream& xout);
|
void WriteGeneratedByToStrim(cmXMLWriter& xout);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // cmCPackIFWInstaller_h
|
#endif // cmCPackIFWInstaller_h
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
|
|
||||||
#include <cmGeneratedFileStream.h>
|
#include <cmGeneratedFileStream.h>
|
||||||
#include <cmTimestamp.h>
|
#include <cmTimestamp.h>
|
||||||
|
#include <cmXMLWriter.h>
|
||||||
|
|
||||||
//----------------------------------------------------------------- Logger ---
|
//----------------------------------------------------------------- Logger ---
|
||||||
#ifdef cmCPackLogger
|
#ifdef cmCPackLogger
|
||||||
|
@ -447,35 +448,28 @@ void cmCPackIFWPackage::GeneratePackageFile()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Output stream
|
// Output stream
|
||||||
cmGeneratedFileStream xout((Directory + "/meta/package.xml").data());
|
cmGeneratedFileStream fout((Directory + "/meta/package.xml").data());
|
||||||
|
cmXMLWriter xout(fout);
|
||||||
|
|
||||||
xout << "<?xml version=\"1.0\"?>" << std::endl;
|
xout.StartDocument();
|
||||||
|
|
||||||
WriteGeneratedByToStrim(xout);
|
WriteGeneratedByToStrim(xout);
|
||||||
|
|
||||||
xout << "<Package>" << std::endl;
|
xout.StartElement("Package");
|
||||||
|
|
||||||
xout << " <DisplayName>" << DisplayName
|
xout.Element("DisplayName", DisplayName);
|
||||||
<< "</DisplayName>" << std::endl;
|
xout.Element("Description", Description);
|
||||||
|
xout.Element("Name", Name);
|
||||||
|
xout.Element("Version", Version);
|
||||||
|
|
||||||
xout << " <Description>" << Description
|
if (!ReleaseDate.empty())
|
||||||
<< "</Description>" << std::endl;
|
|
||||||
|
|
||||||
xout << " <Name>" << Name << "</Name>" << std::endl;
|
|
||||||
|
|
||||||
xout << " <Version>" << Version
|
|
||||||
<< "</Version>" << std::endl;
|
|
||||||
|
|
||||||
xout << " <ReleaseDate>";
|
|
||||||
if(ReleaseDate.empty())
|
|
||||||
{
|
{
|
||||||
xout << cmTimestamp().CurrentTime("%Y-%m-%d", true);
|
xout.Element("ReleaseDate", ReleaseDate);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
xout << ReleaseDate;
|
xout.Element("ReleaseDate", cmTimestamp().CurrentTime("%Y-%m-%d", true));
|
||||||
}
|
}
|
||||||
xout << "</ReleaseDate>" << std::endl;
|
|
||||||
|
|
||||||
// Script (copy to meta dir)
|
// Script (copy to meta dir)
|
||||||
if(!Script.empty())
|
if(!Script.empty())
|
||||||
|
@ -483,7 +477,7 @@ void cmCPackIFWPackage::GeneratePackageFile()
|
||||||
std::string name = cmSystemTools::GetFilenameName(Script);
|
std::string name = cmSystemTools::GetFilenameName(Script);
|
||||||
std::string path = Directory + "/meta/" + name;
|
std::string path = Directory + "/meta/" + name;
|
||||||
cmsys::SystemTools::CopyFileIfDifferent(Script.data(), path.data());
|
cmsys::SystemTools::CopyFileIfDifferent(Script.data(), path.data());
|
||||||
xout << " <Script>" << name << "</Script>" << std::endl;
|
xout.Element("Script", name);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Dependencies
|
// Dependencies
|
||||||
|
@ -501,16 +495,16 @@ void cmCPackIFWPackage::GeneratePackageFile()
|
||||||
// Write dependencies
|
// Write dependencies
|
||||||
if (!compDepSet.empty())
|
if (!compDepSet.empty())
|
||||||
{
|
{
|
||||||
xout << " <Dependencies>";
|
std::stringstream dependencies;
|
||||||
std::set<DependenceStruct>::iterator it = compDepSet.begin();
|
std::set<DependenceStruct>::iterator it = compDepSet.begin();
|
||||||
xout << it->NameWithCompare();
|
dependencies << it->NameWithCompare();
|
||||||
++it;
|
++it;
|
||||||
while(it != compDepSet.end())
|
while(it != compDepSet.end())
|
||||||
{
|
{
|
||||||
xout << "," << it->NameWithCompare();
|
dependencies << "," << it->NameWithCompare();
|
||||||
++it;
|
++it;
|
||||||
}
|
}
|
||||||
xout << "</Dependencies>" << std::endl;
|
xout.Element("Dependencies", dependencies.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Licenses (copy to meta dir)
|
// Licenses (copy to meta dir)
|
||||||
|
@ -524,43 +518,42 @@ void cmCPackIFWPackage::GeneratePackageFile()
|
||||||
}
|
}
|
||||||
if(!licenses.empty())
|
if(!licenses.empty())
|
||||||
{
|
{
|
||||||
xout << " <Licenses>" << std::endl;
|
xout.StartElement("Licenses");
|
||||||
for(size_t i = 0; i < licenses.size(); i += 2)
|
for(size_t i = 0; i < licenses.size(); i += 2)
|
||||||
{
|
{
|
||||||
xout << " <License "
|
xout.StartElement("License");
|
||||||
<< "name=\"" << licenses[i] << "\" "
|
xout.Attribute("name", licenses[i]);
|
||||||
<< "file=\"" << licenses[i + 1] << "\" "
|
xout.Attribute("file", licenses[i + 1]);
|
||||||
<< "/>" <<std::endl;
|
xout.EndElement();
|
||||||
}
|
}
|
||||||
xout << " </Licenses>" << std::endl;
|
xout.EndElement();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!ForcedInstallation.empty())
|
if (!ForcedInstallation.empty())
|
||||||
{
|
{
|
||||||
xout << " <ForcedInstallation>" << ForcedInstallation
|
xout.Element("ForcedInstallation", ForcedInstallation);
|
||||||
<< "</ForcedInstallation>" << std::endl;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Virtual.empty())
|
if (!Virtual.empty())
|
||||||
{
|
{
|
||||||
xout << " <Virtual>" << Virtual << "</Virtual>" << std::endl;
|
xout.Element("Virtual", Virtual);
|
||||||
}
|
}
|
||||||
else if (!Default.empty())
|
else if (!Default.empty())
|
||||||
{
|
{
|
||||||
xout << " <Default>" << Default << "</Default>" << std::endl;
|
xout.Element("Default", Default);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Priority
|
// Priority
|
||||||
if(!SortingPriority.empty())
|
if(!SortingPriority.empty())
|
||||||
{
|
{
|
||||||
xout << " <SortingPriority>" << SortingPriority
|
xout.Element("SortingPriority", SortingPriority);
|
||||||
<< "</SortingPriority>" << std::endl;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
xout << "</Package>" << std::endl;
|
xout.EndElement();
|
||||||
|
xout.EndDocument();
|
||||||
}
|
}
|
||||||
|
|
||||||
void cmCPackIFWPackage::WriteGeneratedByToStrim(cmGeneratedFileStream &xout)
|
void cmCPackIFWPackage::WriteGeneratedByToStrim(cmXMLWriter &xout)
|
||||||
{
|
{
|
||||||
if(Generator) Generator->WriteGeneratedByToStrim(xout);
|
if(Generator) Generator->WriteGeneratedByToStrim(xout);
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,12 +14,12 @@
|
||||||
#define cmCPackIFWPackage_h
|
#define cmCPackIFWPackage_h
|
||||||
|
|
||||||
#include <cmStandardIncludes.h>
|
#include <cmStandardIncludes.h>
|
||||||
#include <cmGeneratedFileStream.h>
|
|
||||||
|
|
||||||
class cmCPackComponent;
|
class cmCPackComponent;
|
||||||
class cmCPackComponentGroup;
|
class cmCPackComponentGroup;
|
||||||
class cmCPackIFWInstaller;
|
class cmCPackIFWInstaller;
|
||||||
class cmCPackIFWGenerator;
|
class cmCPackIFWGenerator;
|
||||||
|
class cmXMLWriter;
|
||||||
|
|
||||||
/** \class cmCPackIFWPackage
|
/** \class cmCPackIFWPackage
|
||||||
* \brief A single component to be installed by CPack IFW generator
|
* \brief A single component to be installed by CPack IFW generator
|
||||||
|
@ -135,7 +135,7 @@ public: // Internal implementation
|
||||||
std::string Directory;
|
std::string Directory;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void WriteGeneratedByToStrim(cmGeneratedFileStream& xout);
|
void WriteGeneratedByToStrim(cmXMLWriter& xout);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // cmCPackIFWPackage_h
|
#endif // cmCPackIFWPackage_h
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
#include "cmSourceFile.h"
|
#include "cmSourceFile.h"
|
||||||
#include "cmGeneratedFileStream.h"
|
#include "cmGeneratedFileStream.h"
|
||||||
#include "cmSystemTools.h"
|
#include "cmSystemTools.h"
|
||||||
#include "cmXMLSafe.h"
|
#include "cmXMLWriter.h"
|
||||||
|
|
||||||
#include <cmsys/SystemTools.hxx>
|
#include <cmsys/SystemTools.hxx>
|
||||||
|
|
||||||
|
@ -101,11 +101,11 @@ struct Tree
|
||||||
void InsertPath(const std::vector<std::string>& splitted,
|
void InsertPath(const std::vector<std::string>& splitted,
|
||||||
std::vector<std::string>::size_type start,
|
std::vector<std::string>::size_type start,
|
||||||
const std::string& fileName);
|
const std::string& fileName);
|
||||||
void BuildVirtualFolder(std::string& virtualFolders) const;
|
void BuildVirtualFolder(cmXMLWriter& xml) const;
|
||||||
void BuildVirtualFolderImpl(std::string& virtualFolders,
|
void BuildVirtualFolderImpl(std::string& virtualFolders,
|
||||||
const std::string& prefix) const;
|
const std::string& prefix) const;
|
||||||
void BuildUnit(std::string& unitString, const std::string& fsPath) const;
|
void BuildUnit(cmXMLWriter& xml, const std::string& fsPath) const;
|
||||||
void BuildUnitImpl(std::string& unitString,
|
void BuildUnitImpl(cmXMLWriter& xml,
|
||||||
const std::string& virtualFolderPath,
|
const std::string& virtualFolderPath,
|
||||||
const std::string& fsPath) const;
|
const std::string& fsPath) const;
|
||||||
};
|
};
|
||||||
|
@ -159,16 +159,18 @@ void Tree::InsertPath(const std::vector<std::string>& splitted,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Tree::BuildVirtualFolder(std::string& virtualFolders) const
|
void Tree::BuildVirtualFolder(cmXMLWriter& xml) const
|
||||||
{
|
{
|
||||||
virtualFolders += "<Option virtualFolders=\"CMake Files\\;";
|
xml.StartElement("Option");
|
||||||
|
std::string virtualFolders = "CMake Files\\;";
|
||||||
for (std::vector<Tree>::const_iterator it = folders.begin();
|
for (std::vector<Tree>::const_iterator it = folders.begin();
|
||||||
it != folders.end();
|
it != folders.end();
|
||||||
++it)
|
++it)
|
||||||
{
|
{
|
||||||
it->BuildVirtualFolderImpl(virtualFolders, "");
|
it->BuildVirtualFolderImpl(virtualFolders, "");
|
||||||
}
|
}
|
||||||
virtualFolders += "\" />";
|
xml.Attribute("virtualFolders", virtualFolders);
|
||||||
|
xml.EndElement();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -185,26 +187,31 @@ void Tree::BuildVirtualFolderImpl(std::string& virtualFolders,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Tree::BuildUnit(std::string& unitString, const std::string& fsPath) const
|
void Tree::BuildUnit(cmXMLWriter& xml, const std::string& fsPath) const
|
||||||
{
|
{
|
||||||
for (std::vector<std::string>::const_iterator it = files.begin();
|
for (std::vector<std::string>::const_iterator it = files.begin();
|
||||||
it != files.end();
|
it != files.end();
|
||||||
++it)
|
++it)
|
||||||
{
|
{
|
||||||
unitString += " <Unit filename=\"" + fsPath + *it + "\">\n";
|
xml.StartElement("Unit");
|
||||||
unitString += " <Option virtualFolder=\"CMake Files\\\" />\n";
|
xml.Attribute("filename", fsPath + *it);
|
||||||
unitString += " </Unit>\n";
|
|
||||||
|
xml.StartElement("Option");
|
||||||
|
xml.Attribute("virtualFolder", "CMake Files\\");
|
||||||
|
xml.EndElement();
|
||||||
|
|
||||||
|
xml.EndElement();
|
||||||
}
|
}
|
||||||
for (std::vector<Tree>::const_iterator it = folders.begin();
|
for (std::vector<Tree>::const_iterator it = folders.begin();
|
||||||
it != folders.end();
|
it != folders.end();
|
||||||
++it)
|
++it)
|
||||||
{
|
{
|
||||||
it->BuildUnitImpl(unitString, "", fsPath);
|
it->BuildUnitImpl(xml, "", fsPath);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Tree::BuildUnitImpl(std::string& unitString,
|
void Tree::BuildUnitImpl(cmXMLWriter& xml,
|
||||||
const std::string& virtualFolderPath,
|
const std::string& virtualFolderPath,
|
||||||
const std::string& fsPath) const
|
const std::string& fsPath) const
|
||||||
{
|
{
|
||||||
|
@ -212,16 +219,21 @@ void Tree::BuildUnitImpl(std::string& unitString,
|
||||||
it != files.end();
|
it != files.end();
|
||||||
++it)
|
++it)
|
||||||
{
|
{
|
||||||
unitString += " <Unit filename=\"" +fsPath+path+ "/" + *it + "\">\n";
|
xml.StartElement("Unit");
|
||||||
unitString += " <Option virtualFolder=\"CMake Files\\"
|
xml.Attribute("filename", fsPath + path + "/" + *it);
|
||||||
+ virtualFolderPath + path + "\\\" />\n";
|
|
||||||
unitString += " </Unit>\n";
|
xml.StartElement("Option");
|
||||||
|
xml.Attribute("virtualFolder",
|
||||||
|
"CMake Files\\" + virtualFolderPath + path + "\\");
|
||||||
|
xml.EndElement();
|
||||||
|
|
||||||
|
xml.EndElement();
|
||||||
}
|
}
|
||||||
for (std::vector<Tree>::const_iterator it = folders.begin();
|
for (std::vector<Tree>::const_iterator it = folders.begin();
|
||||||
it != folders.end();
|
it != folders.end();
|
||||||
++it)
|
++it)
|
||||||
{
|
{
|
||||||
it->BuildUnitImpl(unitString,
|
it->BuildUnitImpl(xml,
|
||||||
virtualFolderPath + path + "\\", fsPath + path + "/");
|
virtualFolderPath + path + "\\", fsPath + path + "/");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -289,30 +301,41 @@ void cmExtraCodeBlocksGenerator
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Now build a virtual tree string
|
|
||||||
std::string virtualFolders;
|
|
||||||
tree.BuildVirtualFolder(virtualFolders);
|
|
||||||
// And one for <Unit>
|
|
||||||
std::string unitFiles;
|
|
||||||
tree.BuildUnit(unitFiles, std::string(lgs[0]->GetSourceDirectory()) + "/");
|
|
||||||
|
|
||||||
// figure out the compiler
|
// figure out the compiler
|
||||||
std::string compiler = this->GetCBCompilerId(mf);
|
std::string compiler = this->GetCBCompilerId(mf);
|
||||||
std::string make = mf->GetRequiredDefinition("CMAKE_MAKE_PROGRAM");
|
std::string make = mf->GetRequiredDefinition("CMAKE_MAKE_PROGRAM");
|
||||||
const std::string makeArgs = mf->GetSafeDefinition(
|
const std::string makeArgs = mf->GetSafeDefinition(
|
||||||
"CMAKE_CODEBLOCKS_MAKE_ARGUMENTS");
|
"CMAKE_CODEBLOCKS_MAKE_ARGUMENTS");
|
||||||
|
|
||||||
fout<<"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\" ?>\n"
|
cmXMLWriter xml(fout);
|
||||||
"<CodeBlocks_project_file>\n"
|
xml.StartDocument();
|
||||||
" <FileVersion major=\"1\" minor=\"6\" />\n"
|
xml.StartElement("CodeBlocks_project_file");
|
||||||
" <Project>\n"
|
|
||||||
" <Option title=\"" << lgs[0]->GetProjectName()<<"\" />\n"
|
|
||||||
" <Option makefile_is_custom=\"1\" />\n"
|
|
||||||
" <Option compiler=\"" << compiler << "\" />\n"
|
|
||||||
" "<<virtualFolders<<"\n"
|
|
||||||
" <Build>\n";
|
|
||||||
|
|
||||||
this->AppendTarget(fout, "all", 0, make.c_str(), lgs[0], compiler.c_str(),
|
xml.StartElement("FileVersion");
|
||||||
|
xml.Attribute("major", 1);
|
||||||
|
xml.Attribute("minor", 6);
|
||||||
|
xml.EndElement();
|
||||||
|
|
||||||
|
xml.StartElement("Project");
|
||||||
|
|
||||||
|
xml.StartElement("Option");
|
||||||
|
xml.Attribute("title", lgs[0]->GetProjectName());
|
||||||
|
xml.EndElement();
|
||||||
|
|
||||||
|
xml.StartElement("Option");
|
||||||
|
xml.Attribute("makefile_is_custom", 1);
|
||||||
|
xml.EndElement();
|
||||||
|
|
||||||
|
xml.StartElement("Option");
|
||||||
|
xml.Attribute("compiler", compiler);
|
||||||
|
xml.EndElement();
|
||||||
|
|
||||||
|
// Now build a virtual tree
|
||||||
|
tree.BuildVirtualFolder(xml);
|
||||||
|
|
||||||
|
xml.StartElement("Build");
|
||||||
|
|
||||||
|
this->AppendTarget(xml, "all", 0, make.c_str(), lgs[0], compiler.c_str(),
|
||||||
makeArgs);
|
makeArgs);
|
||||||
|
|
||||||
// add all executable and library targets and some of the GLOBAL
|
// add all executable and library targets and some of the GLOBAL
|
||||||
|
@ -334,7 +357,7 @@ void cmExtraCodeBlocksGenerator
|
||||||
if (strcmp((*lg)->GetCurrentBinaryDirectory(),
|
if (strcmp((*lg)->GetCurrentBinaryDirectory(),
|
||||||
(*lg)->GetBinaryDirectory())==0)
|
(*lg)->GetBinaryDirectory())==0)
|
||||||
{
|
{
|
||||||
this->AppendTarget(fout, targetName, 0,
|
this->AppendTarget(xml, targetName, 0,
|
||||||
make.c_str(), *lg, compiler.c_str(),
|
make.c_str(), *lg, compiler.c_str(),
|
||||||
makeArgs);
|
makeArgs);
|
||||||
}
|
}
|
||||||
|
@ -352,7 +375,7 @@ void cmExtraCodeBlocksGenerator
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
this->AppendTarget(fout, targetName, 0,
|
this->AppendTarget(xml, targetName, 0,
|
||||||
make.c_str(), *lg, compiler.c_str(),makeArgs);
|
make.c_str(), *lg, compiler.c_str(),makeArgs);
|
||||||
break;
|
break;
|
||||||
case cmState::EXECUTABLE:
|
case cmState::EXECUTABLE:
|
||||||
|
@ -362,11 +385,11 @@ void cmExtraCodeBlocksGenerator
|
||||||
case cmState::OBJECT_LIBRARY:
|
case cmState::OBJECT_LIBRARY:
|
||||||
{
|
{
|
||||||
cmGeneratorTarget* gt = *ti;
|
cmGeneratorTarget* gt = *ti;
|
||||||
this->AppendTarget(fout, targetName, gt,
|
this->AppendTarget(xml, targetName, gt,
|
||||||
make.c_str(), *lg, compiler.c_str(), makeArgs);
|
make.c_str(), *lg, compiler.c_str(), makeArgs);
|
||||||
std::string fastTarget = targetName;
|
std::string fastTarget = targetName;
|
||||||
fastTarget += "/fast";
|
fastTarget += "/fast";
|
||||||
this->AppendTarget(fout, fastTarget, gt,
|
this->AppendTarget(xml, fastTarget, gt,
|
||||||
make.c_str(), *lg, compiler.c_str(), makeArgs);
|
make.c_str(), *lg, compiler.c_str(), makeArgs);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -376,8 +399,7 @@ void cmExtraCodeBlocksGenerator
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fout<<" </Build>\n";
|
xml.EndElement(); // Build
|
||||||
|
|
||||||
|
|
||||||
// Collect all used source files in the project.
|
// Collect all used source files in the project.
|
||||||
// Keep a list of C/C++ source files which might have an acompanying header
|
// Keep a list of C/C++ source files which might have an acompanying header
|
||||||
|
@ -505,24 +527,27 @@ void cmExtraCodeBlocksGenerator
|
||||||
std::string const& unitFilename = sit->first;
|
std::string const& unitFilename = sit->first;
|
||||||
CbpUnit const& unit = sit->second;
|
CbpUnit const& unit = sit->second;
|
||||||
|
|
||||||
fout<<" <Unit filename=\""<< cmXMLSafe(unitFilename) <<"\">\n";
|
xml.StartElement("Unit");
|
||||||
|
xml.Attribute("filename", unitFilename);
|
||||||
|
|
||||||
for(std::vector<const cmGeneratorTarget*>::const_iterator ti =
|
for(std::vector<const cmGeneratorTarget*>::const_iterator ti =
|
||||||
unit.Targets.begin();
|
unit.Targets.begin();
|
||||||
ti != unit.Targets.end(); ++ti)
|
ti != unit.Targets.end(); ++ti)
|
||||||
{
|
{
|
||||||
std::string const& targetName = (*ti)->GetName();
|
xml.StartElement("Option");
|
||||||
fout<<" <Option target=\""<< cmXMLSafe(targetName) <<"\"/>\n";
|
xml.Attribute("target", (*ti)->GetName());
|
||||||
|
xml.EndElement();
|
||||||
}
|
}
|
||||||
|
|
||||||
fout<<" </Unit>\n";
|
xml.EndElement();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add CMakeLists.txt
|
// Add CMakeLists.txt
|
||||||
fout<<unitFiles;
|
tree.BuildUnit(xml, std::string(mf->GetHomeDirectory()) + "/");
|
||||||
|
|
||||||
fout<<" </Project>\n"
|
xml.EndElement(); // Project
|
||||||
"</CodeBlocks_project_file>\n";
|
xml.EndElement(); // CodeBlocks_project_file
|
||||||
|
xml.EndDocument();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -553,7 +578,7 @@ std::string cmExtraCodeBlocksGenerator::CreateDummyTargetFile(
|
||||||
|
|
||||||
|
|
||||||
// Generate the xml code for one target.
|
// Generate the xml code for one target.
|
||||||
void cmExtraCodeBlocksGenerator::AppendTarget(cmGeneratedFileStream& fout,
|
void cmExtraCodeBlocksGenerator::AppendTarget(cmXMLWriter& xml,
|
||||||
const std::string& targetName,
|
const std::string& targetName,
|
||||||
cmGeneratorTarget* target,
|
cmGeneratorTarget* target,
|
||||||
const char* make,
|
const char* make,
|
||||||
|
@ -565,7 +590,9 @@ void cmExtraCodeBlocksGenerator::AppendTarget(cmGeneratedFileStream& fout,
|
||||||
std::string makefileName = lg->GetCurrentBinaryDirectory();
|
std::string makefileName = lg->GetCurrentBinaryDirectory();
|
||||||
makefileName += "/Makefile";
|
makefileName += "/Makefile";
|
||||||
|
|
||||||
fout<<" <Target title=\"" << targetName << "\">\n";
|
xml.StartElement("Target");
|
||||||
|
xml.Attribute("title", targetName);
|
||||||
|
|
||||||
if (target!=0)
|
if (target!=0)
|
||||||
{
|
{
|
||||||
int cbTargetType = this->GetCBTargetType(target);
|
int cbTargetType = this->GetCBTargetType(target);
|
||||||
|
@ -603,13 +630,29 @@ void cmExtraCodeBlocksGenerator::AppendTarget(cmGeneratedFileStream& fout,
|
||||||
location = target->GetLocation(buildType);
|
location = target->GetLocation(buildType);
|
||||||
}
|
}
|
||||||
|
|
||||||
fout<<" <Option output=\"" << location
|
xml.StartElement("Option");
|
||||||
<< "\" prefix_auto=\"0\" extension_auto=\"0\" />\n"
|
xml.Attribute("output", location);
|
||||||
" <Option working_dir=\"" << workingDir << "\" />\n"
|
xml.Attribute("prefix_auto", 0);
|
||||||
" <Option object_output=\"./\" />\n"
|
xml.Attribute("extension_auto", 0);
|
||||||
" <Option type=\"" << cbTargetType << "\" />\n"
|
xml.EndElement();
|
||||||
" <Option compiler=\"" << compiler << "\" />\n"
|
|
||||||
" <Compiler>\n";
|
xml.StartElement("Option");
|
||||||
|
xml.Attribute("working_dir", workingDir);
|
||||||
|
xml.EndElement();
|
||||||
|
|
||||||
|
xml.StartElement("Option");
|
||||||
|
xml.Attribute("object_output", "./");
|
||||||
|
xml.EndElement();
|
||||||
|
|
||||||
|
xml.StartElement("Option");
|
||||||
|
xml.Attribute("type", cbTargetType);
|
||||||
|
xml.EndElement();
|
||||||
|
|
||||||
|
xml.StartElement("Option");
|
||||||
|
xml.Attribute("compiler", compiler);
|
||||||
|
xml.EndElement();
|
||||||
|
|
||||||
|
xml.StartElement("Compiler");
|
||||||
|
|
||||||
// the compilerdefines for this target
|
// the compilerdefines for this target
|
||||||
std::vector<std::string> cdefs;
|
std::vector<std::string> cdefs;
|
||||||
|
@ -619,8 +662,9 @@ void cmExtraCodeBlocksGenerator::AppendTarget(cmGeneratedFileStream& fout,
|
||||||
for(std::vector<std::string>::const_iterator di = cdefs.begin();
|
for(std::vector<std::string>::const_iterator di = cdefs.begin();
|
||||||
di != cdefs.end(); ++di)
|
di != cdefs.end(); ++di)
|
||||||
{
|
{
|
||||||
cmXMLSafe safedef(di->c_str());
|
xml.StartElement("Add");
|
||||||
fout <<" <Add option=\"-D" << safedef.str() << "\" />\n";
|
xml.Attribute("option", "-D" + *di);
|
||||||
|
xml.EndElement();
|
||||||
}
|
}
|
||||||
|
|
||||||
// the include directories for this target
|
// the include directories for this target
|
||||||
|
@ -653,36 +697,48 @@ void cmExtraCodeBlocksGenerator::AppendTarget(cmGeneratedFileStream& fout,
|
||||||
dirIt != uniqIncludeDirs.end();
|
dirIt != uniqIncludeDirs.end();
|
||||||
++dirIt)
|
++dirIt)
|
||||||
{
|
{
|
||||||
fout <<" <Add directory=\"" << *dirIt << "\" />\n";
|
xml.StartElement("Add");
|
||||||
|
xml.Attribute("directory", *dirIt);
|
||||||
|
xml.EndElement();
|
||||||
}
|
}
|
||||||
|
|
||||||
fout<<" </Compiler>\n";
|
xml.EndElement(); // Compiler
|
||||||
}
|
}
|
||||||
else // e.g. all and the GLOBAL and UTILITY targets
|
else // e.g. all and the GLOBAL and UTILITY targets
|
||||||
{
|
{
|
||||||
fout<<" <Option working_dir=\""
|
xml.StartElement("Option");
|
||||||
<< lg->GetCurrentBinaryDirectory() << "\" />\n"
|
xml.Attribute("working_dir", lg->GetCurrentBinaryDirectory());
|
||||||
<<" <Option type=\"" << 4 << "\" />\n";
|
xml.EndElement();
|
||||||
|
|
||||||
|
xml.StartElement("Option");
|
||||||
|
xml.Attribute("type", 4);
|
||||||
|
xml.EndElement();
|
||||||
}
|
}
|
||||||
|
|
||||||
fout<<" <MakeCommands>\n"
|
xml.StartElement("MakeCommands");
|
||||||
" <Build command=\""
|
|
||||||
<< this->BuildMakeCommand(make, makefileName.c_str(), targetName,
|
|
||||||
makeFlags)
|
|
||||||
<< "\" />\n"
|
|
||||||
" <CompileFile command=\""
|
|
||||||
<< this->BuildMakeCommand(make, makefileName.c_str(),""$file"",
|
|
||||||
makeFlags)
|
|
||||||
<< "\" />\n"
|
|
||||||
" <Clean command=\""
|
|
||||||
<< this->BuildMakeCommand(make, makefileName.c_str(), "clean", makeFlags)
|
|
||||||
<< "\" />\n"
|
|
||||||
" <DistClean command=\""
|
|
||||||
<< this->BuildMakeCommand(make, makefileName.c_str(), "clean", makeFlags)
|
|
||||||
<< "\" />\n"
|
|
||||||
" </MakeCommands>\n"
|
|
||||||
" </Target>\n";
|
|
||||||
|
|
||||||
|
xml.StartElement("Build");
|
||||||
|
xml.Attribute("command",
|
||||||
|
this->BuildMakeCommand(make, makefileName.c_str(), targetName, makeFlags));
|
||||||
|
xml.EndElement();
|
||||||
|
|
||||||
|
xml.StartElement("CompileFile");
|
||||||
|
xml.Attribute("command",
|
||||||
|
this->BuildMakeCommand(make, makefileName.c_str(),"\"$file\"", makeFlags));
|
||||||
|
xml.EndElement();
|
||||||
|
|
||||||
|
xml.StartElement("Clean");
|
||||||
|
xml.Attribute("command",
|
||||||
|
this->BuildMakeCommand(make, makefileName.c_str(), "clean", makeFlags));
|
||||||
|
xml.EndElement();
|
||||||
|
|
||||||
|
xml.StartElement("DistClean");
|
||||||
|
xml.Attribute("command",
|
||||||
|
this->BuildMakeCommand(make, makefileName.c_str(), "clean", makeFlags));
|
||||||
|
xml.EndElement();
|
||||||
|
|
||||||
|
xml.EndElement(); //MakeCommands
|
||||||
|
xml.EndElement(); //Target
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -825,7 +881,7 @@ std::string cmExtraCodeBlocksGenerator::BuildMakeCommand(
|
||||||
// http://public.kitware.com/Bug/view.php?id=13952
|
// http://public.kitware.com/Bug/view.php?id=13952
|
||||||
std::string makefileName = cmSystemTools::ConvertToOutputPath(makefile);
|
std::string makefileName = cmSystemTools::ConvertToOutputPath(makefile);
|
||||||
command += " /NOLOGO /f ";
|
command += " /NOLOGO /f ";
|
||||||
command += cmXMLSafe(makefileName).str();
|
command += makefileName;
|
||||||
command += " VERBOSE=1 ";
|
command += " VERBOSE=1 ";
|
||||||
command += target;
|
command += target;
|
||||||
}
|
}
|
||||||
|
@ -834,9 +890,9 @@ std::string cmExtraCodeBlocksGenerator::BuildMakeCommand(
|
||||||
// no escaping of spaces in this case, see
|
// no escaping of spaces in this case, see
|
||||||
// http://public.kitware.com/Bug/view.php?id=10014
|
// http://public.kitware.com/Bug/view.php?id=10014
|
||||||
std::string makefileName = makefile;
|
std::string makefileName = makefile;
|
||||||
command += " -f "";
|
command += " -f \"";
|
||||||
command += makefileName;
|
command += makefileName;
|
||||||
command += "" ";
|
command += "\" ";
|
||||||
command += " VERBOSE=1 ";
|
command += " VERBOSE=1 ";
|
||||||
command += target;
|
command += target;
|
||||||
}
|
}
|
||||||
|
@ -848,9 +904,9 @@ std::string cmExtraCodeBlocksGenerator::BuildMakeCommand(
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
std::string makefileName = cmSystemTools::ConvertToOutputPath(makefile);
|
std::string makefileName = cmSystemTools::ConvertToOutputPath(makefile);
|
||||||
command += " -f "";
|
command += " -f \"";
|
||||||
command += makefileName;
|
command += makefileName;
|
||||||
command += "" ";
|
command += "\" ";
|
||||||
command += " VERBOSE=1 ";
|
command += " VERBOSE=1 ";
|
||||||
command += target;
|
command += target;
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
class cmLocalGenerator;
|
class cmLocalGenerator;
|
||||||
class cmMakefile;
|
class cmMakefile;
|
||||||
class cmGeneratorTarget;
|
class cmGeneratorTarget;
|
||||||
class cmGeneratedFileStream;
|
class cmXMLWriter;
|
||||||
|
|
||||||
/** \class cmExtraCodeBlocksGenerator
|
/** \class cmExtraCodeBlocksGenerator
|
||||||
* \brief Write CodeBlocks project files for Makefile based projects
|
* \brief Write CodeBlocks project files for Makefile based projects
|
||||||
|
@ -56,7 +56,7 @@ private:
|
||||||
std::string BuildMakeCommand(const std::string& make, const char* makefile,
|
std::string BuildMakeCommand(const std::string& make, const char* makefile,
|
||||||
const std::string& target,
|
const std::string& target,
|
||||||
const std::string& makeFlags);
|
const std::string& makeFlags);
|
||||||
void AppendTarget(cmGeneratedFileStream& fout,
|
void AppendTarget(cmXMLWriter& xml,
|
||||||
const std::string& targetName,
|
const std::string& targetName,
|
||||||
cmGeneratorTarget* target,
|
cmGeneratorTarget* target,
|
||||||
const char* make,
|
const char* make,
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
#include <cmsys/SystemInformation.hxx>
|
#include <cmsys/SystemInformation.hxx>
|
||||||
#include <cmsys/Directory.hxx>
|
#include <cmsys/Directory.hxx>
|
||||||
#include "cmStandardIncludes.h"
|
#include "cmStandardIncludes.h"
|
||||||
#include "cmXMLSafe.h"
|
#include "cmXMLWriter.h"
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
void cmExtraCodeLiteGenerator::GetDocumentation(cmDocumentationEntry& entry,
|
void cmExtraCodeLiteGenerator::GetDocumentation(cmDocumentationEntry& entry,
|
||||||
|
@ -54,16 +54,14 @@ void cmExtraCodeLiteGenerator::Generate()
|
||||||
std::string workspaceOutputDir;
|
std::string workspaceOutputDir;
|
||||||
std::string workspaceFileName;
|
std::string workspaceFileName;
|
||||||
std::string workspaceSourcePath;
|
std::string workspaceSourcePath;
|
||||||
std::string lprjdebug;
|
|
||||||
|
|
||||||
cmGeneratedFileStream fout;
|
const std::map<std::string, std::vector<cmLocalGenerator*> >& projectMap =
|
||||||
|
this->GlobalGenerator->GetProjectMap();
|
||||||
|
|
||||||
// loop projects and locate the root project.
|
// loop projects and locate the root project.
|
||||||
// and extract the information for creating the worspace
|
// and extract the information for creating the worspace
|
||||||
for (std::map<std::string, std::vector<cmLocalGenerator*> >::const_iterator
|
for (std::map<std::string, std::vector<cmLocalGenerator*> >::const_iterator
|
||||||
it = this->GlobalGenerator->GetProjectMap().begin();
|
it = projectMap.begin(); it!= projectMap.end(); ++it)
|
||||||
it!= this->GlobalGenerator->GetProjectMap().end();
|
|
||||||
++it)
|
|
||||||
{
|
{
|
||||||
const cmMakefile* mf =it->second[0]->GetMakefile();
|
const cmMakefile* mf =it->second[0]->GetMakefile();
|
||||||
this->ConfigName = GetConfigurationName( mf );
|
this->ConfigName = GetConfigurationName( mf );
|
||||||
|
@ -77,18 +75,20 @@ void cmExtraCodeLiteGenerator::Generate()
|
||||||
workspaceFileName = workspaceOutputDir+"/";
|
workspaceFileName = workspaceOutputDir+"/";
|
||||||
workspaceFileName += workspaceProjectName + ".workspace";
|
workspaceFileName += workspaceProjectName + ".workspace";
|
||||||
this->WorkspacePath = it->second[0]->GetCurrentBinaryDirectory();;
|
this->WorkspacePath = it->second[0]->GetCurrentBinaryDirectory();;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fout.Open(workspaceFileName.c_str(), false, false);
|
cmGeneratedFileStream fout(workspaceFileName.c_str());
|
||||||
fout << "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"
|
cmXMLWriter xml(fout);
|
||||||
"<CodeLite_Workspace Name=\"" << workspaceProjectName << "\" >\n";
|
|
||||||
}
|
xml.StartDocument("utf-8");
|
||||||
}
|
xml.StartElement("CodeLite_Workspace");
|
||||||
|
xml.Attribute("Name", workspaceProjectName);
|
||||||
|
|
||||||
// for each sub project in the workspace create a codelite project
|
// for each sub project in the workspace create a codelite project
|
||||||
for (std::map<std::string, std::vector<cmLocalGenerator*> >::const_iterator
|
for (std::map<std::string, std::vector<cmLocalGenerator*> >::const_iterator
|
||||||
it = this->GlobalGenerator->GetProjectMap().begin();
|
it = projectMap.begin(); it!= projectMap.end(); ++it)
|
||||||
it!= this->GlobalGenerator->GetProjectMap().end();
|
|
||||||
++it)
|
|
||||||
{
|
{
|
||||||
// retrive project information
|
// retrive project information
|
||||||
std::string outputDir = it->second[0]->GetCurrentBinaryDirectory();
|
std::string outputDir = it->second[0]->GetCurrentBinaryDirectory();
|
||||||
|
@ -101,19 +101,33 @@ void cmExtraCodeLiteGenerator::Generate()
|
||||||
|
|
||||||
// create a project file
|
// create a project file
|
||||||
this->CreateProjectFile(it->second);
|
this->CreateProjectFile(it->second);
|
||||||
fout << " <Project Name=\"" << projectName << "\" Path=\""
|
xml.StartElement("Project");
|
||||||
<< filename << "\" Active=\"No\"/>\n";
|
xml.Attribute("Name", projectName);
|
||||||
lprjdebug += "<Project Name=\"" + projectName
|
xml.Attribute("Path", filename);
|
||||||
+ "\" ConfigName=\"" + this->ConfigName + "\"/>\n";
|
xml.Attribute("Active", "No");
|
||||||
|
xml.EndElement();
|
||||||
}
|
}
|
||||||
|
|
||||||
fout << " <BuildMatrix>\n"
|
xml.StartElement("BuildMatrix");
|
||||||
" <WorkspaceConfiguration Name=\""
|
xml.StartElement("WorkspaceConfiguration");
|
||||||
<< this->ConfigName << "\" Selected=\"yes\">\n"
|
xml.Attribute("Name", this->ConfigName);
|
||||||
" " << lprjdebug << ""
|
xml.Attribute("Selected", "yes");
|
||||||
" </WorkspaceConfiguration>\n"
|
|
||||||
" </BuildMatrix>\n"
|
for (std::map<std::string, std::vector<cmLocalGenerator*> >::const_iterator
|
||||||
"</CodeLite_Workspace>\n";
|
it = projectMap.begin(); it!= projectMap.end(); ++it)
|
||||||
|
{
|
||||||
|
// retrive project information
|
||||||
|
std::string projectName = it->second[0]->GetProjectName();
|
||||||
|
|
||||||
|
xml.StartElement("Project");
|
||||||
|
xml.Attribute("Name", projectName);
|
||||||
|
xml.Attribute("ConfigName", this->ConfigName);
|
||||||
|
xml.EndElement();
|
||||||
|
}
|
||||||
|
|
||||||
|
xml.EndElement(); // WorkspaceConfiguration
|
||||||
|
xml.EndElement(); // BuildMatrix
|
||||||
|
xml.EndElement(); // CodeLite_Workspace
|
||||||
}
|
}
|
||||||
|
|
||||||
/* create the project file */
|
/* create the project file */
|
||||||
|
@ -138,11 +152,13 @@ void cmExtraCodeLiteGenerator
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
cmXMLWriter xml(fout);
|
||||||
|
|
||||||
////////////////////////////////////
|
////////////////////////////////////
|
||||||
fout << "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"
|
xml.StartDocument("utf-8");
|
||||||
"<CodeLite_Project Name=\"" << lgs[0]->GetProjectName()
|
xml.StartElement("CodeLite_Project");
|
||||||
<< "\" InternalType=\"\">\n";
|
xml.Attribute("Name", lgs[0]->GetProjectName());
|
||||||
|
xml.Attribute("InternalType", "");
|
||||||
|
|
||||||
// Collect all used source files in the project
|
// Collect all used source files in the project
|
||||||
// Sort them into two containers, one for C/C++ implementation files
|
// Sort them into two containers, one for C/C++ implementation files
|
||||||
|
@ -285,7 +301,8 @@ void cmExtraCodeLiteGenerator
|
||||||
// Create 2 virtual folders: src and include
|
// Create 2 virtual folders: src and include
|
||||||
// and place all the implementation files into the src
|
// and place all the implementation files into the src
|
||||||
// folder, the rest goes to the include folder
|
// folder, the rest goes to the include folder
|
||||||
fout<< " <VirtualDirectory Name=\"src\">\n";
|
xml.StartElement("VirtualDirectory");
|
||||||
|
xml.Attribute("Name", "src");
|
||||||
|
|
||||||
// insert all source files in the codelite project
|
// insert all source files in the codelite project
|
||||||
// first the C/C++ implementation files, then all others
|
// first the C/C++ implementation files, then all others
|
||||||
|
@ -294,22 +311,25 @@ void cmExtraCodeLiteGenerator
|
||||||
sit!=cFiles.end();
|
sit!=cFiles.end();
|
||||||
++sit)
|
++sit)
|
||||||
{
|
{
|
||||||
std::string relativePath =
|
xml.StartElement("File");
|
||||||
cmSystemTools::RelativePath(projectPath.c_str(), sit->first.c_str());
|
xml.Attribute("Name",
|
||||||
fout<< " <File Name=\"" << relativePath << "\"/>\n";
|
cmSystemTools::RelativePath(projectPath.c_str(), sit->first.c_str()));
|
||||||
|
xml.EndElement();
|
||||||
}
|
}
|
||||||
fout<< " </VirtualDirectory>\n";
|
xml.EndElement(); // VirtualDirectory
|
||||||
fout<< " <VirtualDirectory Name=\"include\">\n";
|
xml.StartElement("VirtualDirectory");
|
||||||
|
xml.Attribute("Name", "include");
|
||||||
for (std::set<std::string>::const_iterator
|
for (std::set<std::string>::const_iterator
|
||||||
sit=otherFiles.begin();
|
sit=otherFiles.begin();
|
||||||
sit!=otherFiles.end();
|
sit!=otherFiles.end();
|
||||||
++sit)
|
++sit)
|
||||||
{
|
{
|
||||||
std::string relativePath =
|
xml.StartElement("File");
|
||||||
cmSystemTools::RelativePath(projectPath.c_str(), sit->c_str());
|
xml.Attribute("Name",
|
||||||
fout << " <File Name=\"" << relativePath << "\"/>\n";
|
cmSystemTools::RelativePath(projectPath.c_str(), sit->c_str()));
|
||||||
|
xml.EndElement();
|
||||||
}
|
}
|
||||||
fout << " </VirtualDirectory>\n";
|
xml.EndElement(); // VirtualDirectory
|
||||||
|
|
||||||
// Get the number of CPUs. We use this information for the make -jN
|
// Get the number of CPUs. We use this information for the make -jN
|
||||||
// command
|
// command
|
||||||
|
@ -319,63 +339,99 @@ void cmExtraCodeLiteGenerator
|
||||||
this->CpuCount = info.GetNumberOfLogicalCPU() *
|
this->CpuCount = info.GetNumberOfLogicalCPU() *
|
||||||
info.GetNumberOfPhysicalCPU();
|
info.GetNumberOfPhysicalCPU();
|
||||||
|
|
||||||
std::string cleanCommand = GetCleanCommand(mf);
|
|
||||||
std::string buildCommand = GetBuildCommand(mf);
|
|
||||||
std::string rebuildCommand = GetRebuildCommand(mf);
|
|
||||||
std::string singleFileCommand = GetSingleFileBuildCommand(mf);
|
|
||||||
|
|
||||||
std::string codeliteCompilerName = this->GetCodeLiteCompilerName(mf);
|
std::string codeliteCompilerName = this->GetCodeLiteCompilerName(mf);
|
||||||
|
|
||||||
fout << "\n"
|
xml.StartElement("Settings");
|
||||||
" <Settings Type=\"" << projectType << "\">\n"
|
xml.Attribute("Type", projectType);
|
||||||
" <Configuration Name=\"" << this->ConfigName << "\" CompilerType=\""
|
|
||||||
<< codeliteCompilerName << "\" DebuggerType=\"GNU gdb debugger\" "
|
xml.StartElement("Configuration");
|
||||||
"Type=\""
|
xml.Attribute("Name", this->ConfigName);
|
||||||
<< projectType << "\" BuildCmpWithGlobalSettings=\"append\" "
|
xml.Attribute("CompilerType", this->GetCodeLiteCompilerName(mf));
|
||||||
"BuildLnkWithGlobalSettings=\"append\" "
|
xml.Attribute("DebuggerType", "GNU gdb debugger");
|
||||||
"BuildResWithGlobalSettings=\"append\">\n"
|
xml.Attribute("Type", projectType);
|
||||||
" <Compiler Options=\"-g\" "
|
xml.Attribute("BuildCmpWithGlobalSettings", "append");
|
||||||
"Required=\"yes\" PreCompiledHeader=\"\">\n"
|
xml.Attribute("BuildLnkWithGlobalSettings", "append");
|
||||||
" <IncludePath Value=\".\"/>\n"
|
xml.Attribute("BuildResWithGlobalSettings", "append");
|
||||||
" </Compiler>\n"
|
|
||||||
" <Linker Options=\"\" Required=\"yes\"/>\n"
|
xml.StartElement("Compiler");
|
||||||
" <ResourceCompiler Options=\"\" Required=\"no\"/>\n"
|
xml.Attribute("Options", "-g");
|
||||||
" <General OutputFile=\"$(IntermediateDirectory)/$(ProjectName)\" "
|
xml.Attribute("Required", "yes");
|
||||||
"IntermediateDirectory=\"./\" Command=\"./$(ProjectName)\" "
|
xml.Attribute("PreCompiledHeader", "");
|
||||||
"CommandArguments=\"\" WorkingDirectory=\"$(IntermediateDirectory)\" "
|
xml.StartElement("IncludePath");
|
||||||
"PauseExecWhenProcTerminates=\"yes\"/>\n"
|
xml.Attribute("Value", ".");
|
||||||
" <Debugger IsRemote=\"no\" RemoteHostName=\"\" "
|
xml.EndElement(); // IncludePath
|
||||||
"RemoteHostPort=\"\" DebuggerPath=\"\">\n"
|
xml.EndElement(); // Compiler
|
||||||
" <PostConnectCommands/>\n"
|
|
||||||
" <StartupCommands/>\n"
|
xml.StartElement("Linker");
|
||||||
" </Debugger>\n"
|
xml.Attribute("Options", "");
|
||||||
" <PreBuild/>\n"
|
xml.Attribute("Required", "yes");
|
||||||
" <PostBuild/>\n"
|
xml.EndElement(); // Linker
|
||||||
" <CustomBuild Enabled=\"yes\">\n"
|
|
||||||
" <RebuildCommand>" << rebuildCommand << "</RebuildCommand>\n"
|
xml.StartElement("ResourceCompiler");
|
||||||
" <CleanCommand>" << cleanCommand << "</CleanCommand>\n"
|
xml.Attribute("Options", "");
|
||||||
" <BuildCommand>" << buildCommand << "</BuildCommand>\n"
|
xml.Attribute("Required", "no");
|
||||||
" <SingleFileCommand>" << singleFileCommand
|
xml.EndElement(); // ResourceCompiler
|
||||||
<< "</SingleFileCommand>\n"
|
|
||||||
" <PreprocessFileCommand/>\n"
|
xml.StartElement("General");
|
||||||
" <WorkingDirectory>$(WorkspacePath)</WorkingDirectory>\n"
|
xml.Attribute("OutputFile", "$(IntermediateDirectory)/$(ProjectName)");
|
||||||
" </CustomBuild>\n"
|
xml.Attribute("IntermediateDirectory", "./");
|
||||||
" <AdditionalRules>\n"
|
xml.Attribute("Command", "./$(ProjectName)");
|
||||||
" <CustomPostBuild/>\n"
|
xml.Attribute("CommandArguments", "");
|
||||||
" <CustomPreBuild/>\n"
|
xml.Attribute("WorkingDirectory", "$(IntermediateDirectory)");
|
||||||
" </AdditionalRules>\n"
|
xml.Attribute("PauseExecWhenProcTerminates", "yes");
|
||||||
" </Configuration>\n"
|
xml.EndElement(); // General
|
||||||
" <GlobalSettings>\n"
|
|
||||||
" <Compiler Options=\"\">\n"
|
xml.StartElement("Debugger");
|
||||||
" <IncludePath Value=\".\"/>\n"
|
xml.Attribute("IsRemote", "no");
|
||||||
" </Compiler>\n"
|
xml.Attribute("RemoteHostName", "");
|
||||||
" <Linker Options=\"\">\n"
|
xml.Attribute("RemoteHostPort", "");
|
||||||
" <LibraryPath Value=\".\"/>\n"
|
xml.Attribute("DebuggerPath", "");
|
||||||
" </Linker>\n"
|
xml.Element("PostConnectCommands");
|
||||||
" <ResourceCompiler Options=\"\"/>\n"
|
xml.Element("StartupCommands");
|
||||||
" </GlobalSettings>\n"
|
xml.EndElement(); // Debugger
|
||||||
" </Settings>\n"
|
|
||||||
"</CodeLite_Project>\n";
|
xml.Element("PreBuild");
|
||||||
|
xml.Element("PostBuild");
|
||||||
|
|
||||||
|
xml.StartElement("CustomBuild");
|
||||||
|
xml.Attribute("Enabled", "yes");
|
||||||
|
xml.Element("RebuildCommand", GetRebuildCommand(mf));
|
||||||
|
xml.Element("CleanCommand", GetCleanCommand(mf));
|
||||||
|
xml.Element("BuildCommand", GetBuildCommand(mf));
|
||||||
|
xml.Element("SingleFileCommand", GetSingleFileBuildCommand(mf));
|
||||||
|
xml.Element("PreprocessFileCommand");
|
||||||
|
xml.Element("WorkingDirectory", "$(WorkspacePath)");
|
||||||
|
xml.EndElement(); // CustomBuild
|
||||||
|
|
||||||
|
xml.StartElement("AdditionalRules");
|
||||||
|
xml.Element("CustomPostBuild");
|
||||||
|
xml.Element("CustomPreBuild");
|
||||||
|
xml.EndElement(); // AdditionalRules
|
||||||
|
|
||||||
|
xml.EndElement(); // Configuration
|
||||||
|
xml.StartElement("GlobalSettings");
|
||||||
|
|
||||||
|
xml.StartElement("Compiler");
|
||||||
|
xml.Attribute("Options", "");
|
||||||
|
xml.StartElement("IncludePath");
|
||||||
|
xml.Attribute("Value", ".");
|
||||||
|
xml.EndElement(); // IncludePath
|
||||||
|
xml.EndElement(); // Compiler
|
||||||
|
|
||||||
|
xml.StartElement("Linker");
|
||||||
|
xml.Attribute("Options", "");
|
||||||
|
xml.StartElement("LibraryPath");
|
||||||
|
xml.Attribute("Value", ".");
|
||||||
|
xml.EndElement(); // LibraryPath
|
||||||
|
xml.EndElement(); // Linker
|
||||||
|
|
||||||
|
xml.StartElement("ResourceCompiler");
|
||||||
|
xml.Attribute("Options", "");
|
||||||
|
xml.EndElement(); // ResourceCompiler
|
||||||
|
|
||||||
|
xml.EndElement(); // GlobalSettings
|
||||||
|
xml.EndElement(); // Settings
|
||||||
|
xml.EndElement(); // CodeLite_Project
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string
|
std::string
|
||||||
|
@ -454,7 +510,7 @@ cmExtraCodeLiteGenerator::GetCleanCommand(const cmMakefile* mf) const
|
||||||
std::string
|
std::string
|
||||||
cmExtraCodeLiteGenerator::GetRebuildCommand(const cmMakefile* mf) const
|
cmExtraCodeLiteGenerator::GetRebuildCommand(const cmMakefile* mf) const
|
||||||
{
|
{
|
||||||
return GetCleanCommand(mf) + cmXMLSafe(" && ").str() + GetBuildCommand(mf);
|
return GetCleanCommand(mf) + " && " + GetBuildCommand(mf);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string
|
std::string
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -17,7 +17,7 @@
|
||||||
#include "cmExternalMakefileProjectGenerator.h"
|
#include "cmExternalMakefileProjectGenerator.h"
|
||||||
|
|
||||||
class cmMakefile;
|
class cmMakefile;
|
||||||
class cmGeneratedFileStream;
|
class cmXMLWriter;
|
||||||
|
|
||||||
/** \class cmExtraEclipseCDT4Generator
|
/** \class cmExtraEclipseCDT4Generator
|
||||||
* \brief Write Eclipse project files for Makefile based projects
|
* \brief Write Eclipse project files for Makefile based projects
|
||||||
|
@ -67,19 +67,17 @@ private:
|
||||||
const std::string& type,
|
const std::string& type,
|
||||||
const std::string& path);
|
const std::string& path);
|
||||||
|
|
||||||
static std::string EscapeForXML(const std::string& value);
|
|
||||||
|
|
||||||
// Helper functions
|
// Helper functions
|
||||||
static void AppendStorageScanners(cmGeneratedFileStream& fout,
|
static void AppendStorageScanners(cmXMLWriter& xml,
|
||||||
const cmMakefile& makefile);
|
const cmMakefile& makefile);
|
||||||
static void AppendTarget (cmGeneratedFileStream& fout,
|
static void AppendTarget (cmXMLWriter& xml,
|
||||||
const std::string& target,
|
const std::string& target,
|
||||||
const std::string& make,
|
const std::string& make,
|
||||||
const std::string& makeArguments,
|
const std::string& makeArguments,
|
||||||
const std::string& path,
|
const std::string& path,
|
||||||
const char* prefix = "",
|
const char* prefix = "",
|
||||||
const char* makeTarget = NULL);
|
const char* makeTarget = NULL);
|
||||||
static void AppendScannerProfile (cmGeneratedFileStream& fout,
|
static void AppendScannerProfile (cmXMLWriter& xml,
|
||||||
const std::string& profileID,
|
const std::string& profileID,
|
||||||
bool openActionEnabled,
|
bool openActionEnabled,
|
||||||
const std::string& openActionFilePath,
|
const std::string& openActionFilePath,
|
||||||
|
@ -90,21 +88,20 @@ private:
|
||||||
bool runActionUseDefault,
|
bool runActionUseDefault,
|
||||||
bool sipParserEnabled);
|
bool sipParserEnabled);
|
||||||
|
|
||||||
static void AppendLinkedResource (cmGeneratedFileStream& fout,
|
static void AppendLinkedResource (cmXMLWriter& xml,
|
||||||
const std::string& name,
|
const std::string& name,
|
||||||
const std::string& path,
|
const std::string& path,
|
||||||
LinkType linkType);
|
LinkType linkType);
|
||||||
|
|
||||||
static void AppendIncludeDirectories(cmGeneratedFileStream& fout,
|
static void AppendIncludeDirectories(cmXMLWriter& xml,
|
||||||
const std::vector<std::string>& includeDirs,
|
const std::vector<std::string>& includeDirs,
|
||||||
std::set<std::string>& emittedDirs);
|
std::set<std::string>& emittedDirs);
|
||||||
|
|
||||||
static void AddEnvVar(cmGeneratedFileStream& fout, const char* envVar,
|
static void AddEnvVar(std::ostream& out, const char* envVar,
|
||||||
cmLocalGenerator* lg);
|
cmLocalGenerator* lg);
|
||||||
|
|
||||||
void CreateLinksToSubprojects(cmGeneratedFileStream& fout,
|
void CreateLinksToSubprojects(cmXMLWriter& xml, const std::string& baseDir);
|
||||||
const std::string& baseDir);
|
void CreateLinksForTargets(cmXMLWriter& xml);
|
||||||
void CreateLinksForTargets(cmGeneratedFileStream& fout);
|
|
||||||
|
|
||||||
std::vector<std::string> SrcLinkedResources;
|
std::vector<std::string> SrcLinkedResources;
|
||||||
std::set<std::string> Natures;
|
std::set<std::string> Natures;
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
#include "cmSourceFile.h"
|
#include "cmSourceFile.h"
|
||||||
#include "cmGeneratedFileStream.h"
|
#include "cmGeneratedFileStream.h"
|
||||||
#include "cmSystemTools.h"
|
#include "cmSystemTools.h"
|
||||||
|
#include "cmXMLWriter.h"
|
||||||
|
|
||||||
#include <cmsys/SystemTools.hxx>
|
#include <cmsys/SystemTools.hxx>
|
||||||
#include <cmsys/Directory.hxx>
|
#include <cmsys/Directory.hxx>
|
||||||
|
@ -397,6 +398,7 @@ void cmGlobalKdevelopGenerator
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
cmXMLWriter xml(fout);
|
||||||
|
|
||||||
// check for a version control system
|
// check for a version control system
|
||||||
bool hasSvn = cmSystemTools::FileExists((projectDir + "/.svn").c_str());
|
bool hasSvn = cmSystemTools::FileExists((projectDir + "/.svn").c_str());
|
||||||
|
@ -411,182 +413,230 @@ void cmGlobalKdevelopGenerator
|
||||||
primaryLanguage="Fortran77";
|
primaryLanguage="Fortran77";
|
||||||
}
|
}
|
||||||
|
|
||||||
fout<<"<?xml version = '1.0'?>\n"
|
xml.StartDocument();
|
||||||
"<kdevelop>\n"
|
xml.StartElement("kdevelop");
|
||||||
" <general>\n"
|
xml.StartElement("general");
|
||||||
" <author></author>\n"
|
|
||||||
" <email></email>\n"
|
xml.Element("author", "");
|
||||||
" <version>$VERSION$</version>\n"
|
xml.Element("email", "");
|
||||||
" <projectmanagement>KDevCustomProject</projectmanagement>\n"
|
xml.Element("version", "$VERSION$");
|
||||||
" <primarylanguage>" << primaryLanguage << "</primarylanguage>\n"
|
xml.Element("projectmanagement", "KDevCustomProject");
|
||||||
" <ignoreparts/>\n"
|
xml.Element("primarylanguage", primaryLanguage);
|
||||||
" <projectdirectory>" << projectDir <<
|
xml.Element("ignoreparts");
|
||||||
"</projectdirectory>\n"; //this one is important
|
xml.Element("projectdirectory", projectDir); // this one is important
|
||||||
fout<<" <absoluteprojectpath>true</absoluteprojectpath>\n"; //and this one
|
xml.Element("absoluteprojectpath", "true"); // and this one
|
||||||
|
|
||||||
// setup additional languages
|
// setup additional languages
|
||||||
fout<<" <secondaryLanguages>\n";
|
xml.StartElement("secondaryLanguages");
|
||||||
if (enableFortran && enableCxx)
|
if (enableFortran && enableCxx)
|
||||||
{
|
{
|
||||||
fout<<" <language>Fortran</language>\n";
|
xml.Element("language", "Fortran");
|
||||||
}
|
}
|
||||||
if (enableCxx)
|
if (enableCxx)
|
||||||
{
|
{
|
||||||
fout<<" <language>C</language>\n";
|
xml.Element("language", "C");
|
||||||
}
|
}
|
||||||
fout<<" </secondaryLanguages>\n";
|
xml.EndElement();
|
||||||
|
|
||||||
if (hasSvn)
|
if (hasSvn)
|
||||||
{
|
{
|
||||||
fout << " <versioncontrol>kdevsubversion</versioncontrol>\n";
|
xml.Element("versioncontrol", "kdevsubversion");
|
||||||
}
|
}
|
||||||
else if (hasCvs)
|
else if (hasCvs)
|
||||||
{
|
{
|
||||||
fout << " <versioncontrol>kdevcvsservice</versioncontrol>\n";
|
xml.Element("versioncontrol", "kdevcvsservice");
|
||||||
}
|
}
|
||||||
|
|
||||||
fout<<" </general>\n"
|
xml.EndElement(); // general
|
||||||
" <kdevcustomproject>\n"
|
xml.StartElement("kdevcustomproject");
|
||||||
" <filelistdirectory>" << outputDir <<
|
|
||||||
"</filelistdirectory>\n"
|
|
||||||
" <run>\n"
|
|
||||||
" <mainprogram>" << executable << "</mainprogram>\n"
|
|
||||||
" <directoryradio>custom</directoryradio>\n"
|
|
||||||
" <customdirectory>"<<outputDir<<"</customdirectory>\n"
|
|
||||||
" <programargs></programargs>\n"
|
|
||||||
" <terminal>false</terminal>\n"
|
|
||||||
" <autocompile>true</autocompile>\n"
|
|
||||||
" <envvars/>\n"
|
|
||||||
" </run>\n"
|
|
||||||
" <build>\n"
|
|
||||||
" <buildtool>make</buildtool>\n"; //this one is important
|
|
||||||
fout<<" <builddir>"<<outputDir<<"</builddir>\n"; //and this one
|
|
||||||
fout<<" </build>\n"
|
|
||||||
" <make>\n"
|
|
||||||
" <abortonerror>false</abortonerror>\n"
|
|
||||||
" <numberofjobs>1</numberofjobs>\n"
|
|
||||||
" <dontact>false</dontact>\n"
|
|
||||||
" <makebin>" << this->GlobalGenerator->GetLocalGenerators()[0]->
|
|
||||||
GetMakefile()->GetRequiredDefinition("CMAKE_MAKE_PROGRAM")
|
|
||||||
<< " </makebin>\n"
|
|
||||||
" <selectedenvironment>default</selectedenvironment>\n"
|
|
||||||
" <environments>\n"
|
|
||||||
" <default>\n"
|
|
||||||
" <envvar value=\"1\" name=\"VERBOSE\" />\n"
|
|
||||||
" <envvar value=\"1\" name=\"CMAKE_NO_VERBOSE\" />\n"
|
|
||||||
" </default>\n"
|
|
||||||
" </environments>\n"
|
|
||||||
" </make>\n";
|
|
||||||
|
|
||||||
fout<<" <blacklist>\n";
|
xml.Element("filelistdirectory", outputDir);
|
||||||
|
|
||||||
|
xml.StartElement("run");
|
||||||
|
xml.Element("mainprogram", executable);
|
||||||
|
xml.Element("directoryradio", "custom");
|
||||||
|
xml.Element("customdirectory", outputDir);
|
||||||
|
xml.Element("programargs", "");
|
||||||
|
xml.Element("terminal", "false");
|
||||||
|
xml.Element("autocompile", "true");
|
||||||
|
xml.Element("envvars");
|
||||||
|
xml.EndElement();
|
||||||
|
|
||||||
|
xml.StartElement("build");
|
||||||
|
xml.Element("buildtool", "make"); // this one is important
|
||||||
|
xml.Element("builddir", outputDir); // and this one
|
||||||
|
xml.EndElement();
|
||||||
|
|
||||||
|
xml.StartElement("make");
|
||||||
|
xml.Element("abortonerror", "false");
|
||||||
|
xml.Element("numberofjobs", 1);
|
||||||
|
xml.Element("dontact", "false");
|
||||||
|
xml.Element("makebin", this->GlobalGenerator->GetLocalGenerators()[0]->
|
||||||
|
GetMakefile()->GetRequiredDefinition("CMAKE_MAKE_PROGRAM"));
|
||||||
|
xml.Element("selectedenvironment", "default");
|
||||||
|
|
||||||
|
xml.StartElement("environments");
|
||||||
|
xml.StartElement("default");
|
||||||
|
|
||||||
|
xml.StartElement("envvar");
|
||||||
|
xml.Attribute("value", 1);
|
||||||
|
xml.Attribute("name", "VERBOSE");
|
||||||
|
xml.EndElement();
|
||||||
|
|
||||||
|
xml.StartElement("envvar");
|
||||||
|
xml.Attribute("value", 1);
|
||||||
|
xml.Attribute("name", "CMAKE_NO_VERBOSE");
|
||||||
|
xml.EndElement();
|
||||||
|
|
||||||
|
xml.EndElement(); // default
|
||||||
|
xml.EndElement(); // environments
|
||||||
|
xml.EndElement(); // make
|
||||||
|
|
||||||
|
xml.StartElement("blacklist");
|
||||||
for(std::vector<std::string>::const_iterator dirIt=this->Blacklist.begin();
|
for(std::vector<std::string>::const_iterator dirIt=this->Blacklist.begin();
|
||||||
dirIt != this->Blacklist.end();
|
dirIt != this->Blacklist.end();
|
||||||
++dirIt)
|
++dirIt)
|
||||||
{
|
{
|
||||||
fout<<" <path>" << *dirIt << "</path>\n";
|
xml.Element("path", *dirIt);
|
||||||
}
|
}
|
||||||
fout<<" </blacklist>\n";
|
xml.EndElement();
|
||||||
|
|
||||||
fout<<" </kdevcustomproject>\n"
|
xml.EndElement(); // kdevcustomproject
|
||||||
" <kdevfilecreate>\n"
|
|
||||||
" <filetypes/>\n"
|
xml.StartElement("kdevfilecreate");
|
||||||
" <useglobaltypes>\n"
|
xml.Element("filetypes");
|
||||||
" <type ext=\"ui\" />\n"
|
xml.StartElement("useglobaltypes");
|
||||||
" <type ext=\"cpp\" />\n"
|
|
||||||
" <type ext=\"h\" />\n"
|
xml.StartElement("type");
|
||||||
" </useglobaltypes>\n"
|
xml.Attribute("ext", "ui");
|
||||||
" </kdevfilecreate>\n"
|
xml.EndElement();
|
||||||
" <kdevdoctreeview>\n"
|
|
||||||
" <projectdoc>\n"
|
xml.StartElement("type");
|
||||||
" <userdocDir>html/</userdocDir>\n"
|
xml.Attribute("ext", "cpp");
|
||||||
" <apidocDir>html/</apidocDir>\n"
|
xml.EndElement();
|
||||||
" </projectdoc>\n"
|
|
||||||
" <ignoreqt_xml/>\n"
|
xml.StartElement("type");
|
||||||
" <ignoredoxygen/>\n"
|
xml.Attribute("ext", "h");
|
||||||
" <ignorekdocs/>\n"
|
xml.EndElement();
|
||||||
" <ignoretocs/>\n"
|
|
||||||
" <ignoredevhelp/>\n"
|
xml.EndElement(); // useglobaltypes
|
||||||
" </kdevdoctreeview>\n";
|
xml.EndElement(); // kdevfilecreate
|
||||||
|
|
||||||
|
xml.StartElement("kdevdoctreeview");
|
||||||
|
xml.StartElement("projectdoc");
|
||||||
|
xml.Element("userdocDir", "html/");
|
||||||
|
xml.Element("apidocDir", "html/");
|
||||||
|
xml.EndElement(); // projectdoc
|
||||||
|
xml.Element("ignoreqt_xml");
|
||||||
|
xml.Element("ignoredoxygen");
|
||||||
|
xml.Element("ignorekdocs");
|
||||||
|
xml.Element("ignoretocs");
|
||||||
|
xml.Element("ignoredevhelp");
|
||||||
|
xml.EndElement(); // kdevdoctreeview;
|
||||||
|
|
||||||
if (enableCxx)
|
if (enableCxx)
|
||||||
{
|
{
|
||||||
fout<<" <cppsupportpart>\n"
|
xml.StartElement("cppsupportpart");
|
||||||
" <filetemplates>\n"
|
xml.StartElement("filetemplates");
|
||||||
" <interfacesuffix>.h</interfacesuffix>\n"
|
xml.Element("interfacesuffix", ".h");
|
||||||
" <implementationsuffix>.cpp</implementationsuffix>\n"
|
xml.Element("implementationsuffix", ".cpp");
|
||||||
" </filetemplates>\n"
|
xml.EndElement(); // filetemplates
|
||||||
" </cppsupportpart>\n"
|
xml.EndElement(); // cppsupportpart
|
||||||
" <kdevcppsupport>\n"
|
|
||||||
" <codecompletion>\n"
|
xml.StartElement("kdevcppsupport");
|
||||||
" <includeGlobalFunctions>true</includeGlobalFunctions>\n"
|
xml.StartElement("codecompletion");
|
||||||
" <includeTypes>true</includeTypes>\n"
|
xml.Element("includeGlobalFunctions", "true");
|
||||||
" <includeEnums>true</includeEnums>\n"
|
xml.Element("includeTypes", "true");
|
||||||
" <includeTypedefs>false</includeTypedefs>\n"
|
xml.Element("includeEnums", "true");
|
||||||
" <automaticCodeCompletion>true</automaticCodeCompletion>\n"
|
xml.Element("includeTypedefs", "false");
|
||||||
" <automaticArgumentsHint>true</automaticArgumentsHint>\n"
|
xml.Element("automaticCodeCompletion", "true");
|
||||||
" <automaticHeaderCompletion>true</automaticHeaderCompletion>\n"
|
xml.Element("automaticArgumentsHint", "true");
|
||||||
" <codeCompletionDelay>250</codeCompletionDelay>\n"
|
xml.Element("automaticHeaderCompletion", "true");
|
||||||
" <argumentsHintDelay>400</argumentsHintDelay>\n"
|
xml.Element("codeCompletionDelay", 250);
|
||||||
" <headerCompletionDelay>250</headerCompletionDelay>\n"
|
xml.Element("argumentsHintDelay", 400);
|
||||||
" </codecompletion>\n"
|
xml.Element("headerCompletionDelay", 250);
|
||||||
" <references/>\n"
|
xml.EndElement(); // codecompletion
|
||||||
" </kdevcppsupport>\n";
|
xml.Element("references");
|
||||||
|
xml.EndElement(); // kdevcppsupport;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (enableFortran)
|
if (enableFortran)
|
||||||
{
|
{
|
||||||
fout<<" <kdevfortransupport>\n"
|
xml.StartElement("kdevfortransupport");
|
||||||
" <ftnchek>\n"
|
xml.StartElement("ftnchek");
|
||||||
" <division>false</division>\n"
|
xml.Element("division", "false");
|
||||||
" <extern>false</extern>\n"
|
xml.Element("extern", "false");
|
||||||
" <declare>false</declare>\n"
|
xml.Element("declare", "false");
|
||||||
" <pure>false</pure>\n"
|
xml.Element("pure", "false");
|
||||||
" <argumentsall>false</argumentsall>\n"
|
xml.Element("argumentsall", "false");
|
||||||
" <commonall>false</commonall>\n"
|
xml.Element("commonall", "false");
|
||||||
" <truncationall>false</truncationall>\n"
|
xml.Element("truncationall", "false");
|
||||||
" <usageall>false</usageall>\n"
|
xml.Element("usageall", "false");
|
||||||
" <f77all>false</f77all>\n"
|
xml.Element("f77all", "false");
|
||||||
" <portabilityall>false</portabilityall>\n"
|
xml.Element("portabilityall", "false");
|
||||||
" <argumentsonly/>\n"
|
xml.Element("argumentsonly");
|
||||||
" <commononly/>\n"
|
xml.Element("commononly");
|
||||||
" <truncationonly/>\n"
|
xml.Element("truncationonly");
|
||||||
" <usageonly/>\n"
|
xml.Element("usageonly");
|
||||||
" <f77only/>\n"
|
xml.Element("f77only");
|
||||||
" <portabilityonly/>\n"
|
xml.Element("portabilityonly");
|
||||||
" </ftnchek>\n"
|
xml.EndElement(); // ftnchek
|
||||||
" </kdevfortransupport>\n";
|
xml.EndElement(); // kdevfortransupport;
|
||||||
}
|
}
|
||||||
|
|
||||||
// set up file groups. maybe this can be used with the CMake SOURCE_GROUP()
|
// set up file groups. maybe this can be used with the CMake SOURCE_GROUP()
|
||||||
// command
|
// command
|
||||||
fout<<" <kdevfileview>\n"
|
xml.StartElement("kdevfileview");
|
||||||
" <groups>\n"
|
xml.StartElement("groups");
|
||||||
" <group pattern=\"" << cmakeFilePattern <<
|
|
||||||
"\" name=\"CMake\" />\n";
|
xml.StartElement("group");
|
||||||
|
xml.Attribute("pattern", cmakeFilePattern);
|
||||||
|
xml.Attribute("name", "CMake");
|
||||||
|
xml.EndElement();
|
||||||
|
|
||||||
if (enableCxx)
|
if (enableCxx)
|
||||||
{
|
{
|
||||||
fout<<" <group pattern=\"*.h;*.hxx;*.hpp\" name=\"Header\" />\n"
|
xml.StartElement("group");
|
||||||
" <group pattern=\"*.c\" name=\"C Sources\" />\n"
|
xml.Attribute("pattern", "*.h;*.hxx;*.hpp");
|
||||||
" <group pattern=\"*.cpp;*.C;*.cxx;*.cc\" name=\"C++ Sources\""
|
xml.Attribute("name", "Header");
|
||||||
"/>\n";
|
xml.EndElement();
|
||||||
|
|
||||||
|
xml.StartElement("group");
|
||||||
|
xml.Attribute("pattern", "*.c");
|
||||||
|
xml.Attribute("name", "C Sources");
|
||||||
|
xml.EndElement();
|
||||||
|
|
||||||
|
xml.StartElement("group");
|
||||||
|
xml.Attribute("pattern", "*.cpp;*.C;*.cxx;*.cc");
|
||||||
|
xml.Attribute("name", "C++ Sources");
|
||||||
|
xml.EndElement();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (enableFortran)
|
if (enableFortran)
|
||||||
{
|
{
|
||||||
fout<<" <group pattern=\"*.f;*.F;*.f77;*.F77;*.f90;*.F90;*.for;*.f95;"
|
xml.StartElement("group");
|
||||||
"*.F95\" name=\"Fortran Sources\" />\n";
|
xml.Attribute("pattern",
|
||||||
|
"*.f;*.F;*.f77;*.F77;*.f90;*.F90;*.for;*.f95;*.F95");
|
||||||
|
xml.Attribute("name", "Fortran Sources");
|
||||||
|
xml.EndElement();
|
||||||
}
|
}
|
||||||
|
|
||||||
fout<<" <group pattern=\"*.ui\" name=\"Qt Designer files\" />\n"
|
xml.StartElement("group");
|
||||||
" <hidenonprojectfiles>true</hidenonprojectfiles>\n"
|
xml.Attribute("pattern", "*.ui");
|
||||||
" </groups>\n"
|
xml.Attribute("name", "Qt Designer files");
|
||||||
" <tree>\n"
|
xml.EndElement();
|
||||||
" <hidepatterns>*.o,*.lo,CVS,*~,cmake*</hidepatterns>\n"
|
|
||||||
" <hidenonprojectfiles>true</hidenonprojectfiles>\n"
|
xml.Element("hidenonprojectfiles", "true");
|
||||||
" </tree>\n"
|
xml.EndElement(); // groups
|
||||||
" </kdevfileview>\n"
|
|
||||||
"</kdevelop>\n";
|
xml.StartElement("tree");
|
||||||
|
xml.Element("hidepatterns", "*.o,*.lo,CVS,*~,cmake*");
|
||||||
|
xml.Element("hidenonprojectfiles", "true");
|
||||||
|
xml.EndElement(); // tree
|
||||||
|
|
||||||
|
xml.EndElement(); // kdevfileview
|
||||||
|
xml.EndElement(); // kdevelop;
|
||||||
|
xml.EndDocument();
|
||||||
|
|
||||||
if (sessionFilename.empty())
|
if (sessionFilename.empty())
|
||||||
{
|
{
|
||||||
|
@ -600,15 +650,24 @@ void cmGlobalKdevelopGenerator
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
devses<<"<?xml version = '1.0' encoding = \'UTF-8\'?>\n"
|
cmXMLWriter sesxml(devses);
|
||||||
"<!DOCTYPE KDevPrjSession>\n"
|
sesxml.StartDocument("UTF-8");
|
||||||
"<KDevPrjSession>\n"
|
sesxml.Doctype("KDevPrjSession");
|
||||||
" <DocsAndViews NumberOfDocuments=\"1\" >\n"
|
sesxml.StartElement("KDevPrjSession");
|
||||||
" <Doc0 NumberOfViews=\"1\" URL=\"file://" << fileToOpen <<
|
|
||||||
"\" >\n"
|
|
||||||
" <View0 line=\"0\" Type=\"Source\" />\n"
|
|
||||||
" </Doc0>\n"
|
|
||||||
" </DocsAndViews>\n"
|
|
||||||
"</KDevPrjSession>\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
|
sesxml.StartElement("DocsAndViews");
|
||||||
|
sesxml.Attribute("NumberOfDocuments", 1);
|
||||||
|
|
||||||
|
sesxml.StartElement("Doc0");
|
||||||
|
sesxml.Attribute("NumberOfViews", 1);
|
||||||
|
sesxml.Attribute("URL", "file://" + fileToOpen);
|
||||||
|
|
||||||
|
sesxml.StartElement("View0");
|
||||||
|
sesxml.Attribute("line", 0);
|
||||||
|
sesxml.Attribute("Type", "Source");
|
||||||
|
sesxml.EndElement(); // View0
|
||||||
|
|
||||||
|
sesxml.EndElement(); // Doc0
|
||||||
|
sesxml.EndElement(); // DocsAndViews
|
||||||
|
sesxml.EndElement(); // KDevPrjSession;
|
||||||
|
}
|
||||||
|
|
|
@ -67,6 +67,13 @@ void cmXMLWriter::EndElement()
|
||||||
this->ElementOpen = false;
|
this->ElementOpen = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void cmXMLWriter::Element(const char* name)
|
||||||
|
{
|
||||||
|
this->CloseStartElement();
|
||||||
|
this->ConditionalLineBreak(!this->IsContent, this->Elements.size());
|
||||||
|
this->Output << '<' << name << "/>";
|
||||||
|
}
|
||||||
|
|
||||||
void cmXMLWriter::BreakAttributes()
|
void cmXMLWriter::BreakAttributes()
|
||||||
{
|
{
|
||||||
this->BreakAttrib = true;
|
this->BreakAttrib = true;
|
||||||
|
@ -85,6 +92,13 @@ void cmXMLWriter::CData(std::string const& data)
|
||||||
this->Output << "<![CDATA[" << data << "]]>";
|
this->Output << "<![CDATA[" << data << "]]>";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void cmXMLWriter::Doctype(const char* doctype)
|
||||||
|
{
|
||||||
|
this->CloseStartElement();
|
||||||
|
this->ConditionalLineBreak(!this->IsContent, this->Elements.size());
|
||||||
|
this->Output << "<!DOCTYPE " << doctype << ">";
|
||||||
|
}
|
||||||
|
|
||||||
void cmXMLWriter::ProcessingInstruction(const char* target, const char* data)
|
void cmXMLWriter::ProcessingInstruction(const char* target, const char* data)
|
||||||
{
|
{
|
||||||
this->CloseStartElement();
|
this->CloseStartElement();
|
||||||
|
|
|
@ -41,6 +41,8 @@ public:
|
||||||
this->Output << name << "=\"" << SafeAttribute(value) << '"';
|
this->Output << name << "=\"" << SafeAttribute(value) << '"';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Element(const char* name);
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
void Element(std::string const& name, T const& value)
|
void Element(std::string const& name, T const& value)
|
||||||
{
|
{
|
||||||
|
@ -60,6 +62,8 @@ public:
|
||||||
|
|
||||||
void CData(std::string const& data);
|
void CData(std::string const& data);
|
||||||
|
|
||||||
|
void Doctype(const char* doctype);
|
||||||
|
|
||||||
void ProcessingInstruction(const char* target, const char* data);
|
void ProcessingInstruction(const char* target, const char* data);
|
||||||
|
|
||||||
void FragmentFile(const char* fname);
|
void FragmentFile(const char* fname);
|
||||||
|
|
Loading…
Reference in New Issue