summaryrefslogtreecommitdiffstats
path: root/Source/CPack/IFW/cmCPackIFWInstaller.cxx
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/CPack/IFW/cmCPackIFWInstaller.cxx
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/CPack/IFW/cmCPackIFWInstaller.cxx')
-rw-r--r--Source/CPack/IFW/cmCPackIFWInstaller.cxx151
1 files changed, 143 insertions, 8 deletions
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);
}