summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorKonstantin Podsvirov <konstantin@podsvirov.pro>2015-04-27 14:02:49 (GMT)
committerBrad King <brad.king@kitware.com>2015-05-15 15:02:49 (GMT)
commit9a0ba4d24ae73cf225a07dff2cf4fc2096fb9751 (patch)
tree2d5db72270f1598daa5598a1f372f56009b3d4f5 /Source
parentf6a41a441408cb32fcc5fee1a758627cdf4f9031 (diff)
downloadCMake-9a0ba4d24ae73cf225a07dff2cf4fc2096fb9751.zip
CMake-9a0ba4d24ae73cf225a07dff2cf4fc2096fb9751.tar.gz
CMake-9a0ba4d24ae73cf225a07dff2cf4fc2096fb9751.tar.bz2
CPackIFW: Add QtIFW 2.0 support
Add variables: - CPACK_IFW_FRAMEWORK_VERSION - CPACK_IFW_PACKAGE_ALLOW_NON_ASCII_CHARACTERS - CPACK_IFW_PACKAGE_ALLOW_SPACE_IN_PATH - CPACK_IFW_PACKAGE_CONTROL_SCRIPT - CPACK_IFW_PACKAGE_MAINTENANCE_TOOL_INI_FILE - CPACK_IFW_PACKAGE_MAINTENANCE_TOOL_NAME - CPACK_IFW_PACKAGE_START_MENU_DIRECTORY - CPACK_IFW_VERBOSE
Diffstat (limited to 'Source')
-rw-r--r--Source/CPack/IFW/cmCPackIFWGenerator.cxx79
-rw-r--r--Source/CPack/IFW/cmCPackIFWGenerator.h20
-rw-r--r--Source/CPack/IFW/cmCPackIFWInstaller.cxx151
-rw-r--r--Source/CPack/IFW/cmCPackIFWInstaller.h26
-rw-r--r--Source/CPack/IFW/cmCPackIFWPackage.cxx26
-rw-r--r--Source/CPack/IFW/cmCPackIFWPackage.h8
6 files changed, 299 insertions, 11 deletions
diff --git a/Source/CPack/IFW/cmCPackIFWGenerator.cxx b/Source/CPack/IFW/cmCPackIFWGenerator.cxx
index 0439ff6..80ba068 100644
--- a/Source/CPack/IFW/cmCPackIFWGenerator.cxx
+++ b/Source/CPack/IFW/cmCPackIFWGenerator.cxx
@@ -29,6 +29,8 @@
#include <cmMakefile.h>
#include <cmGeneratedFileStream.h>
#include <cmXMLSafe.h>
+#include <cmVersionConfig.h>
+#include <cmTimestamp.h>
//----------------------------------------------------------------------------
cmCPackIFWGenerator::cmCPackIFWGenerator()
@@ -41,6 +43,27 @@ cmCPackIFWGenerator::~cmCPackIFWGenerator()
}
//----------------------------------------------------------------------------
+bool cmCPackIFWGenerator::IsVersionLess(const char *version)
+{
+ return cmSystemTools::VersionCompare(cmSystemTools::OP_LESS,
+ FrameworkVersion.data(), version);
+}
+
+//----------------------------------------------------------------------------
+bool cmCPackIFWGenerator::IsVersionGreater(const char *version)
+{
+ return cmSystemTools::VersionCompare(cmSystemTools::OP_GREATER,
+ FrameworkVersion.data(), version);
+}
+
+//----------------------------------------------------------------------------
+bool cmCPackIFWGenerator::IsVersionEqual(const char *version)
+{
+ return cmSystemTools::VersionCompare(cmSystemTools::OP_EQUAL,
+ FrameworkVersion.data(), version);
+}
+
+//----------------------------------------------------------------------------
int cmCPackIFWGenerator::PackageFiles()
{
cmCPackLogger(cmCPackLog::LOG_OUTPUT, "- Configuration" << std::endl);
@@ -59,7 +82,12 @@ int cmCPackIFWGenerator::PackageFiles()
if (!Installer.Repositories.empty())
{
std::string ifwCmd = RepoGen;
- ifwCmd += " -c " + this->toplevel + "/config/config.xml";
+
+ if(IsVersionLess("2.0.0"))
+ {
+ ifwCmd += " -c " + this->toplevel + "/config/config.xml";
+ }
+
ifwCmd += " -p " + this->toplevel + "/packages";
if(!PkgsDirsVector.empty())
@@ -216,8 +244,7 @@ const char *cmCPackIFWGenerator::GetPackagingInstallPrefix()
//----------------------------------------------------------------------------
const char *cmCPackIFWGenerator::GetOutputExtension()
{
- const char *suffix = this->GetOption("CMAKE_EXECUTABLE_SUFFIX");
- return suffix ? suffix : cmCPackGenerator::GetOutputExtension();
+ return ExecutableSuffix.c_str();
}
//----------------------------------------------------------------------------
@@ -267,6 +294,17 @@ int cmCPackIFWGenerator::InitializeInternal()
RepoGen = RepoGenStr;
}
+ // Framework version
+ if(const char* FrameworkVersionSrt =
+ this->GetOption("CPACK_IFW_FRAMEWORK_VERSION"))
+ {
+ FrameworkVersion = FrameworkVersionSrt;
+ }
+ else
+ {
+ FrameworkVersion = "1.9.9";
+ }
+
// Variables that Change Behavior
// Resolve duplicate names
@@ -307,6 +345,24 @@ int cmCPackIFWGenerator::InitializeInternal()
return 0;
}
+ // Executable suffix
+ if(const char *optExeSuffix = this->GetOption("CMAKE_EXECUTABLE_SUFFIX"))
+ {
+ ExecutableSuffix = optExeSuffix;
+ if(ExecutableSuffix.empty())
+ {
+ std::string sysName(this->GetOption("CMAKE_SYSTEM_NAME"));
+ if(sysName == "Linux")
+ {
+ ExecutableSuffix = ".run";
+ }
+ }
+ }
+ else
+ {
+ ExecutableSuffix = cmCPackGenerator::GetOutputExtension();
+ }
+
return this->Superclass::InitializeInternal();
}
@@ -552,3 +608,20 @@ cmCPackIFWPackage* cmCPackIFWGenerator::GetComponentPackage(
= ComponentPackages.find(component);
return pit != ComponentPackages.end() ? pit->second : 0;
}
+
+//----------------------------------------------------------------------------
+void cmCPackIFWGenerator::WriteGeneratedByToStrim(cmGeneratedFileStream &xout)
+{
+ xout << "<!-- Generated by CPack " << CMake_VERSION << " IFW generator "
+ << "for QtIFW ";
+ if(IsVersionLess("2.0"))
+ {
+ xout << "less 2.0";
+ }
+ else
+ {
+ xout << FrameworkVersion;
+ }
+ xout << " tools at " << cmTimestamp().CurrentTime("", true) << " -->"
+ << std::endl;
+}
diff --git a/Source/CPack/IFW/cmCPackIFWGenerator.h b/Source/CPack/IFW/cmCPackIFWGenerator.h
index 1d4d67b..3246861 100644
--- a/Source/CPack/IFW/cmCPackIFWGenerator.h
+++ b/Source/CPack/IFW/cmCPackIFWGenerator.h
@@ -13,6 +13,7 @@
#ifndef cmCPackIFWGenerator_h
#define cmCPackIFWGenerator_h
+#include <cmGeneratedFileStream.h>
#include <CPack/cmCPackGenerator.h>
#include "cmCPackIFWPackage.h"
@@ -44,6 +45,21 @@ public:
*/
virtual ~cmCPackIFWGenerator();
+ /**
+ * Compare \a version with QtIFW framework version
+ */
+ bool IsVersionLess(const char *version);
+
+ /**
+ * Compare \a version with QtIFW framework version
+ */
+ bool IsVersionGreater(const char *version);
+
+ /**
+ * Compare \a version with QtIFW framework version
+ */
+ bool IsVersionEqual(const char *version);
+
protected: // cmCPackGenerator reimplementation
/**
@@ -105,6 +121,8 @@ protected: // Methods
cmCPackIFWPackage* GetGroupPackage(cmCPackComponentGroup *group) const;
cmCPackIFWPackage* GetComponentPackage(cmCPackComponent *component) const;
+ void WriteGeneratedByToStrim(cmGeneratedFileStream& xout);
+
protected: // Data
friend class cmCPackIFWPackage;
@@ -126,6 +144,8 @@ protected: // Data
private:
std::string RepoGen;
std::string BinCreator;
+ std::string FrameworkVersion;
+ std::string ExecutableSuffix;
bool OnlineOnly;
bool ResolveDuplicateNames;
diff --git a/Source/CPack/IFW/cmCPackIFWInstaller.cxx b/Source/CPack/IFW/cmCPackIFWInstaller.cxx
index 4a99e50..8c77a2c 100644
--- a/Source/CPack/IFW/cmCPackIFWInstaller.cxx
+++ b/Source/CPack/IFW/cmCPackIFWInstaller.cxx
@@ -51,6 +51,25 @@ bool cmCPackIFWInstaller::IsOn(const std::string &op) const
}
//----------------------------------------------------------------------------
+bool cmCPackIFWInstaller::IsVersionLess(const char *version)
+{
+ return Generator ? Generator->IsVersionLess(version) : false;
+}
+
+//----------------------------------------------------------------------------
+bool cmCPackIFWInstaller::IsVersionGreater(const char *version)
+{
+ return Generator ? Generator->IsVersionGreater(version) : false;
+}
+
+//----------------------------------------------------------------------------
+bool cmCPackIFWInstaller::IsVersionEqual(const char *version)
+{
+ return Generator ? Generator->IsVersionEqual(version) : false;
+}
+
+
+//----------------------------------------------------------------------------
void cmCPackIFWInstaller::ConfigureFromOptions()
{
// Name;
@@ -151,6 +170,17 @@ void cmCPackIFWInstaller::ConfigureFromOptions()
}
}
+ // Start menu
+ if (const char* optIFW_START_MENU_DIR =
+ this->GetOption("CPACK_IFW_PACKAGE_START_MENU_DIRECTORY"))
+ {
+ StartMenuDir = optIFW_START_MENU_DIR;
+ }
+ else
+ {
+ StartMenuDir = Name;
+ }
+
// Default target directory for installation
if (const char* optIFW_TARGET_DIRECTORY =
GetOption("CPACK_IFW_TARGET_DIRECTORY"))
@@ -177,7 +207,7 @@ void cmCPackIFWInstaller::ConfigureFromOptions()
// Repositories
Repositories.clear();
RepositoryStruct Repo;
- if (const char *site = this->GetOption("CPACK_DOWNLOAD_SITE"))
+ if(const char *site = this->GetOption("CPACK_DOWNLOAD_SITE"))
{
Repo.Url = site;
Repositories.push_back(Repo);
@@ -245,6 +275,53 @@ void cmCPackIFWInstaller::ConfigureFromOptions()
}
}
}
+
+ // Maintenance tool
+ if(const char* optIFW_MAINTENANCE_TOOL =
+ this->GetOption("CPACK_IFW_PACKAGE_MAINTENANCE_TOOL_NAME"))
+ {
+ MaintenanceToolName = optIFW_MAINTENANCE_TOOL;
+ }
+
+ // Maintenance tool ini file
+ if(const char* optIFW_MAINTENANCE_TOOL_INI =
+ this->GetOption("CPACK_IFW_PACKAGE_MAINTENANCE_TOOL_INI_FILE"))
+ {
+ MaintenanceToolIniFile = optIFW_MAINTENANCE_TOOL_INI;
+ }
+
+ // Allow non-ASCII characters
+ if(this->GetOption("CPACK_IFW_PACKAGE_ALLOW_NON_ASCII_CHARACTERS"))
+ {
+ if(IsOn("CPACK_IFW_PACKAGE_ALLOW_NON_ASCII_CHARACTERS"))
+ {
+ AllowNonAsciiCharacters = "true";
+ }
+ else
+ {
+ AllowNonAsciiCharacters = "false";
+ }
+ }
+
+ // Space in path
+ if(this->GetOption("CPACK_IFW_PACKAGE_ALLOW_SPACE_IN_PATH"))
+ {
+ if(IsOn("CPACK_IFW_PACKAGE_ALLOW_SPACE_IN_PATH"))
+ {
+ AllowSpaceInPath = "true";
+ }
+ else
+ {
+ AllowSpaceInPath = "false";
+ }
+ }
+
+ // Control script
+ if(const char* optIFW_CONTROL_SCRIPT =
+ this->GetOption("CPACK_IFW_PACKAGE_CONTROL_SCRIPT"))
+ {
+ ControlScript = optIFW_CONTROL_SCRIPT;
+ }
}
//----------------------------------------------------------------------------
@@ -259,7 +336,10 @@ void cmCPackIFWInstaller::GenerateInstallerFile()
// Output stream
cmGeneratedFileStream xout((Directory + "/config/config.xml").data());
- xout << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" << std::endl;
+ xout << "<?xml version=\"1.0\"?>" << std::endl;
+
+ WriteGeneratedByToStrim(xout);
+
xout << "<Installer>" << std::endl;
xout << " <Name>" << cmXMLSafe(Name).str() << "</Name>" << std::endl;
@@ -313,11 +393,20 @@ void cmCPackIFWInstaller::GenerateInstallerFile()
xout << " <Logo>" << name << "</Logo>" << std::endl;
}
+ // Start menu
+ if(!IsVersionLess("2.0"))
+ {
+ xout << " <StartMenuDir>" << StartMenuDir
+ << "</StartMenuDir>" << std::endl;
+ }
+
+ // Target dir
if(!TargetDir.empty())
{
xout << " <TargetDir>" << TargetDir << "</TargetDir>" << std::endl;
}
+ // Admin target dir
if(!AdminTargetDir.empty())
{
xout << " <AdminTargetDir>" << AdminTargetDir
@@ -364,11 +453,52 @@ void cmCPackIFWInstaller::GenerateInstallerFile()
xout << " </RemoteRepositories>" << std::endl;
}
- // CPack IFW default policy
- xout << " <!-- CPack IFW default policy -->" << std::endl;
- xout << " <AllowNonAsciiCharacters>true</AllowNonAsciiCharacters>"
- << std::endl;
- xout << " <AllowSpaceInPath>true</AllowSpaceInPath>" << std::endl;
+ // Maintenance tool
+ if(!IsVersionLess("2.0") && !MaintenanceToolName.empty())
+ {
+ xout << " <MaintenanceToolName>" << MaintenanceToolName
+ << "</MaintenanceToolName>" << std::endl;
+ }
+
+ // Maintenance tool ini file
+ if(!IsVersionLess("2.0") && !MaintenanceToolIniFile.empty())
+ {
+ xout << " <MaintenanceToolIniFile>" << MaintenanceToolIniFile
+ << "</MaintenanceToolIniFile>" << std::endl;
+ }
+
+ // Different allows
+ if(IsVersionLess("2.0"))
+ {
+ // CPack IFW default policy
+ xout << " <!-- CPack IFW default policy for QtIFW less 2.0 -->"
+ << std::endl;
+ xout << " <AllowNonAsciiCharacters>true</AllowNonAsciiCharacters>"
+ << std::endl;
+ xout << " <AllowSpaceInPath>true</AllowSpaceInPath>" << std::endl;
+ }
+ else
+ {
+ if(!AllowNonAsciiCharacters.empty())
+ {
+ xout << " <AllowNonAsciiCharacters>" << AllowNonAsciiCharacters
+ << "</AllowNonAsciiCharacters>" << std::endl;
+ }
+ if(!AllowSpaceInPath.empty())
+ {
+ xout << " <AllowAllowSpaceInPath>" << AllowSpaceInPath
+ << "</AllowSpaceInPath>" << std::endl;
+ }
+ }
+
+ // Control script (copy to config dir)
+ if(!IsVersionLess("2.0") && !ControlScript.empty())
+ {
+ std::string name = cmSystemTools::GetFilenameName(ControlScript);
+ std::string path = Directory + "/config/" + name;
+ cmsys::SystemTools::CopyFileIfDifferent(ControlScript.data(), path.data());
+ xout << " <ControlScript>" << name << "</ControlScript>" << std::endl;
+ }
xout << "</Installer>" << std::endl;
}
@@ -402,5 +532,10 @@ void cmCPackIFWInstaller::GeneratePackageFiles()
{
cmCPackIFWPackage* package = pit->second;
package->GeneratePackageFile();
- }
+ }
+}
+
+void cmCPackIFWInstaller::WriteGeneratedByToStrim(cmGeneratedFileStream &xout)
+{
+ if(Generator) Generator->WriteGeneratedByToStrim(xout);
}
diff --git a/Source/CPack/IFW/cmCPackIFWInstaller.h b/Source/CPack/IFW/cmCPackIFWInstaller.h
index 5824d33..4cba5b2 100644
--- a/Source/CPack/IFW/cmCPackIFWInstaller.h
+++ b/Source/CPack/IFW/cmCPackIFWInstaller.h
@@ -13,6 +13,7 @@
#ifndef cmCPackIFWInstaller_h
#define cmCPackIFWInstaller_h
+#include <cmGeneratedFileStream.h>
#include <cmStandardIncludes.h>
class cmCPackIFWPackage;
@@ -69,17 +70,39 @@ public: // Configuration
/// Filename for a logo
std::string Logo;
+ /// Name of the default program group in the Windows Start menu
+ std::string StartMenuDir;
+
/// Default target directory for installation
std::string TargetDir;
/// Default target directory for installation with administrator rights
std::string AdminTargetDir;
+ /// Filename of the generated maintenance tool
+ std::string MaintenanceToolName;
+
+ /// Filename for the configuration of the generated maintenance tool
+ std::string MaintenanceToolIniFile;
+
+ /// Set to true if the installation path can contain non-ASCII characters
+ std::string AllowNonAsciiCharacters;
+
+ /// Set to false if the installation path cannot contain space characters
+ std::string AllowSpaceInPath;
+
+ /// Filename for a custom installer control script
+ std::string ControlScript;
+
public: // Internal implementation
const char* GetOption(const std::string& op) const;
bool IsOn(const std::string& op) const;
+ bool IsVersionLess(const char *version);
+ bool IsVersionGreater(const char *version);
+ bool IsVersionEqual(const char *version);
+
void ConfigureFromOptions();
void GenerateInstallerFile();
@@ -90,6 +113,9 @@ public: // Internal implementation
PackagesMap Packages;
std::vector<RepositoryStruct> Repositories;
std::string Directory;
+
+protected:
+ void WriteGeneratedByToStrim(cmGeneratedFileStream& xout);
};
#endif // cmCPackIFWInstaller_h
diff --git a/Source/CPack/IFW/cmCPackIFWPackage.cxx b/Source/CPack/IFW/cmCPackIFWPackage.cxx
index 38cef87..5474ad1b 100644
--- a/Source/CPack/IFW/cmCPackIFWPackage.cxx
+++ b/Source/CPack/IFW/cmCPackIFWPackage.cxx
@@ -132,6 +132,24 @@ bool cmCPackIFWPackage::IsOn(const std::string &op) const
}
//----------------------------------------------------------------------------
+bool cmCPackIFWPackage::IsVersionLess(const char *version)
+{
+ return Generator ? Generator->IsVersionLess(version) : false;
+}
+
+//----------------------------------------------------------------------------
+bool cmCPackIFWPackage::IsVersionGreater(const char *version)
+{
+ return Generator ? Generator->IsVersionGreater(version) : false;
+}
+
+//----------------------------------------------------------------------------
+bool cmCPackIFWPackage::IsVersionEqual(const char *version)
+{
+ return Generator ? Generator->IsVersionEqual(version) : false;
+}
+
+//----------------------------------------------------------------------------
std::string cmCPackIFWPackage::GetComponentName(cmCPackComponent *component)
{
if (!component) return "";
@@ -432,6 +450,9 @@ void cmCPackIFWPackage::GeneratePackageFile()
cmGeneratedFileStream xout((Directory + "/meta/package.xml").data());
xout << "<?xml version=\"1.0\"?>" << std::endl;
+
+ WriteGeneratedByToStrim(xout);
+
xout << "<Package>" << std::endl;
xout << " <DisplayName>" << DisplayName
@@ -538,3 +559,8 @@ void cmCPackIFWPackage::GeneratePackageFile()
xout << "</Package>" << std::endl;
}
+
+void cmCPackIFWPackage::WriteGeneratedByToStrim(cmGeneratedFileStream &xout)
+{
+ if(Generator) Generator->WriteGeneratedByToStrim(xout);
+}
diff --git a/Source/CPack/IFW/cmCPackIFWPackage.h b/Source/CPack/IFW/cmCPackIFWPackage.h
index 9fc9bd0..d2f7927 100644
--- a/Source/CPack/IFW/cmCPackIFWPackage.h
+++ b/Source/CPack/IFW/cmCPackIFWPackage.h
@@ -14,6 +14,7 @@
#define cmCPackIFWPackage_h
#include <cmStandardIncludes.h>
+#include <cmGeneratedFileStream.h>
class cmCPackComponent;
class cmCPackComponentGroup;
@@ -107,6 +108,10 @@ public: // Internal implementation
const char* GetOption(const std::string& op) const;
bool IsOn(const std::string& op) const;
+ bool IsVersionLess(const char *version);
+ bool IsVersionGreater(const char *version);
+ bool IsVersionEqual(const char *version);
+
std::string GetComponentName(cmCPackComponent *component);
void DefaultConfiguration();
@@ -128,6 +133,9 @@ public: // Internal implementation
std::set<DependenceStruct*> AlienDependencies;
// Patch to package directory
std::string Directory;
+
+protected:
+ void WriteGeneratedByToStrim(cmGeneratedFileStream& xout);
};
#endif // cmCPackIFWPackage_h