diff options
author | Konstantin Podsvirov <konstantin@podsvirov.pro> | 2014-08-12 18:44:02 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2014-08-12 19:20:59 (GMT) |
commit | e6496b6023a8f3c471e81b1938580d50b52d3222 (patch) | |
tree | dc8d3a9f32a93f6d883cfa5efe463f3479e5c2c2 /Source/CPack | |
parent | 1f8cfc3b5f4bd87216e48c6bf909b59f10b9065e (diff) | |
download | CMake-e6496b6023a8f3c471e81b1938580d50b52d3222.zip CMake-e6496b6023a8f3c471e81b1938580d50b52d3222.tar.gz CMake-e6496b6023a8f3c471e81b1938580d50b52d3222.tar.bz2 |
CPackIFW: Revise this generator
CPack IFW generator updates:
- Group now can have script;
- Root package (for monolithic or one package installers) can be
configured from group.
CMake updates:
- Native installation (no Unspecified component).
Diffstat (limited to 'Source/CPack')
-rw-r--r-- | Source/CPack/IFW/cmCPackIFWGenerator.cxx | 27 | ||||
-rw-r--r-- | Source/CPack/IFW/cmCPackIFWGenerator.h | 2 | ||||
-rw-r--r-- | Source/CPack/IFW/cmCPackIFWInstaller.cxx | 21 | ||||
-rw-r--r-- | Source/CPack/IFW/cmCPackIFWInstaller.h | 2 | ||||
-rw-r--r-- | Source/CPack/IFW/cmCPackIFWPackage.cxx | 60 | ||||
-rw-r--r-- | Source/CPack/IFW/cmCPackIFWPackage.h | 6 |
6 files changed, 98 insertions, 20 deletions
diff --git a/Source/CPack/IFW/cmCPackIFWGenerator.cxx b/Source/CPack/IFW/cmCPackIFWGenerator.cxx index e7c97c6..732938b 100644 --- a/Source/CPack/IFW/cmCPackIFWGenerator.cxx +++ b/Source/CPack/IFW/cmCPackIFWGenerator.cxx @@ -33,8 +33,6 @@ //---------------------------------------------------------------------------- cmCPackIFWGenerator::cmCPackIFWGenerator() { - // Change the default behavior - componentPackageMethod = ONE_PACKAGE_PER_COMPONENT; } //---------------------------------------------------------------------------- @@ -374,9 +372,6 @@ cmCPackComponentGroup* cmCPackIFWGenerator::GetComponentGroup(const std::string &projectName, const std::string &groupName) { - ComponentGoupsMap::iterator git = ComponentGroups.find(groupName); - if ( git != ComponentGroups.end() ) return &(git->second); - cmCPackComponentGroup* group = cmCPackGenerator::GetComponentGroup(projectName, groupName); if(!group) return group; @@ -388,7 +383,7 @@ cmCPackIFWGenerator::GetComponentGroup(const std::string &projectName, cmCPackIFWPackage *package = &Packages[name]; package->Name = name; package->Generator = this; - if(package->ConfigureFromComponentGroup(group)) + if(package->ConfigureFromGroup(group)) { package->Installer = &Installer; Installer.Packages.insert( @@ -436,17 +431,29 @@ bool cmCPackIFWGenerator::IsOnePackage() const } //---------------------------------------------------------------------------- -std::string cmCPackIFWGenerator::GetRootPackageName() const +std::string cmCPackIFWGenerator::GetRootPackageName() { + // Default value std::string name = "root"; - if(const char* optIFW_ROOT_PACKAGE_NAME = - this->GetOption("CPACK_IFW_ROOT_PACKAGE_NAME")) + if (const char* optIFW_PACKAGE_GROUP = + this->GetOption("CPACK_IFW_PACKAGE_GROUP")) + { + // Configure from root group + cmCPackIFWPackage package; + package.Generator = this; + package.ConfigureFromGroup(optIFW_PACKAGE_GROUP); + name = package.Name; + } + else if (const char* optIFW_PACKAGE_NAME = + this->GetOption("CPACK_IFW_PACKAGE_NAME")) { - name = optIFW_ROOT_PACKAGE_NAME; + // Configure from root package name + name = optIFW_PACKAGE_NAME; } else if (const char* optPACKAGE_NAME = this->GetOption("CPACK_PACKAGE_NAME")) { + // Configure from package name name = optPACKAGE_NAME; } return name; diff --git a/Source/CPack/IFW/cmCPackIFWGenerator.h b/Source/CPack/IFW/cmCPackIFWGenerator.h index e871f7c..7211e04 100644 --- a/Source/CPack/IFW/cmCPackIFWGenerator.h +++ b/Source/CPack/IFW/cmCPackIFWGenerator.h @@ -97,7 +97,7 @@ protected: // Methods bool IsOnePackage() const; - std::string GetRootPackageName() const; + std::string GetRootPackageName(); std::string GetGroupPackageName(cmCPackComponentGroup *group) const; std::string GetComponentPackageName(cmCPackComponent *component) const; diff --git a/Source/CPack/IFW/cmCPackIFWInstaller.cxx b/Source/CPack/IFW/cmCPackIFWInstaller.cxx index 78b2ffb..fcb07e6 100644 --- a/Source/CPack/IFW/cmCPackIFWInstaller.cxx +++ b/Source/CPack/IFW/cmCPackIFWInstaller.cxx @@ -48,9 +48,15 @@ const char *cmCPackIFWInstaller::GetOption(const std::string &op) const void cmCPackIFWInstaller::ConfigureFromOptions() { // Name; - if (const char* option = GetOption("CPACK_PACKAGE_NAME")) + if (const char* optIFW_PACKAGE_NAME = + this->GetOption("CPACK_IFW_PACKAGE_NAME")) { - Name = option; + Name = optIFW_PACKAGE_NAME; + } + else if (const char* optPACKAGE_NAME = + this->GetOption("CPACK_PACKAGE_NAME")) + { + Name = optPACKAGE_NAME; } else { @@ -274,7 +280,16 @@ void cmCPackIFWInstaller::GeneratePackageFiles() cmCPackIFWPackage package; package.Generator = Generator; package.Installer = this; - package.ConfigureFromOptions(); + // Check package group + if (const char* option = GetOption("CPACK_IFW_PACKAGE_GROUP")) + { + package.ConfigureFromGroup(option); + package.ForcedInstallation = "true"; + } + else + { + package.ConfigureFromOptions(); + } package.GeneratePackageFile(); return; } diff --git a/Source/CPack/IFW/cmCPackIFWInstaller.h b/Source/CPack/IFW/cmCPackIFWInstaller.h index 02cd07b..1630a94 100644 --- a/Source/CPack/IFW/cmCPackIFWInstaller.h +++ b/Source/CPack/IFW/cmCPackIFWInstaller.h @@ -13,7 +13,7 @@ #ifndef cmCPackIFWInstaller_h #define cmCPackIFWInstaller_h -#include "cmStandardIncludes.h" +#include <cmStandardIncludes.h> class cmCPackIFWPackage; class cmCPackIFWGenerator; diff --git a/Source/CPack/IFW/cmCPackIFWPackage.cxx b/Source/CPack/IFW/cmCPackIFWPackage.cxx index 5e7a7c7..3c45639 100644 --- a/Source/CPack/IFW/cmCPackIFWPackage.cxx +++ b/Source/CPack/IFW/cmCPackIFWPackage.cxx @@ -121,7 +121,14 @@ cmCPackIFWPackage::cmCPackIFWPackage() : //---------------------------------------------------------------------------- const char *cmCPackIFWPackage::GetOption(const std::string &op) const { - return Generator ? Generator->GetOption(op) : 0; + const char *option = Generator ? Generator->GetOption(op) : 0; + return option && *option ? option : 0; +} + +//---------------------------------------------------------------------------- +bool cmCPackIFWPackage::IsOn(const std::string &op) const +{ + return Generator ? Generator->IsOn(op) : false; } //---------------------------------------------------------------------------- @@ -232,7 +239,6 @@ int cmCPackIFWPackage::ConfigureFromComponent(cmCPackComponent *component) // Script if (const char* option = GetOption(prefix + "SCRIPT")) { - // TODO: add check file exist Script = option; } @@ -306,7 +312,7 @@ int cmCPackIFWPackage::ConfigureFromComponent(cmCPackComponent *component) //---------------------------------------------------------------------------- int -cmCPackIFWPackage::ConfigureFromComponentGroup(cmCPackComponentGroup *group) +cmCPackIFWPackage::ConfigureFromGroup(cmCPackComponentGroup *group) { if(!group) return 0; @@ -335,6 +341,12 @@ cmCPackIFWPackage::ConfigureFromComponentGroup(cmCPackComponentGroup *group) Version = "1.0.0"; } + // Script + if (const char* option = GetOption(prefix + "SCRIPT")) + { + Script = option; + } + // Licenses if (const char* option = this->GetOption(prefix + "LICENSES")) { @@ -359,6 +371,48 @@ cmCPackIFWPackage::ConfigureFromComponentGroup(cmCPackComponentGroup *group) } //---------------------------------------------------------------------------- +int cmCPackIFWPackage::ConfigureFromGroup(const std::string &groupName) +{ + // Group configuration + + cmCPackComponentGroup group; + std::string prefix = "CPACK_COMPONENT_GROUP_" + + cmsys::SystemTools::UpperCase(groupName) + + "_"; + + if (const char *option = GetOption(prefix + "DISPLAY_NAME")) + { + group.DisplayName = option; + } + else + { + group.DisplayName = group.Name; + } + + if (const char* option = GetOption(prefix + "DESCRIPTION")) + { + group.Description = option; + } + group.IsBold = IsOn(prefix + "BOLD_TITLE"); + group.IsExpandedByDefault = IsOn(prefix + "EXPANDED"); + + // Package configuration + + group.Name = groupName; + + if(Generator) + { + Name = Generator->GetGroupPackageName(&group); + } + else + { + Name = group.Name; + } + + return ConfigureFromGroup(&group); +} + +//---------------------------------------------------------------------------- void cmCPackIFWPackage::GeneratePackageFile() { // Lazy directory initialization diff --git a/Source/CPack/IFW/cmCPackIFWPackage.h b/Source/CPack/IFW/cmCPackIFWPackage.h index 868c15d..9fc9bd0 100644 --- a/Source/CPack/IFW/cmCPackIFWPackage.h +++ b/Source/CPack/IFW/cmCPackIFWPackage.h @@ -13,7 +13,7 @@ #ifndef cmCPackIFWPackage_h #define cmCPackIFWPackage_h -#include "cmStandardIncludes.h" +#include <cmStandardIncludes.h> class cmCPackComponent; class cmCPackComponentGroup; @@ -105,6 +105,7 @@ public: // Configuration public: // Internal implementation const char* GetOption(const std::string& op) const; + bool IsOn(const std::string& op) const; std::string GetComponentName(cmCPackComponent *component); @@ -112,7 +113,8 @@ public: // Internal implementation int ConfigureFromOptions(); int ConfigureFromComponent(cmCPackComponent *component); - int ConfigureFromComponentGroup(cmCPackComponentGroup *group); + int ConfigureFromGroup(cmCPackComponentGroup *group); + int ConfigureFromGroup(const std::string &groupName); void GeneratePackageFile(); |