diff options
-rw-r--r-- | CMakeCPack.cmake | 13 | ||||
-rw-r--r-- | CMakeCPackOptions.cmake.in | 27 | ||||
-rw-r--r-- | Modules/CPackIFW.cmake | 48 | ||||
-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 |
9 files changed, 148 insertions, 58 deletions
diff --git a/CMakeCPack.cmake b/CMakeCPack.cmake index b27cd69..66ec900 100644 --- a/CMakeCPack.cmake +++ b/CMakeCPack.cmake @@ -65,16 +65,9 @@ if(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake") endif() endif() - # default component for IFW - if(CMAKE_INSTALL_DEFAULT_COMPONENT_NAME) - set(_CPACK_IFW_COMPONENT_NAME ${CMAKE_INSTALL_DEFAULT_COMPONENT_NAME}) - else() - set(_CPACK_IFW_COMPONENT_NAME Unspecified) - endif() - string(TOUPPER ${_CPACK_IFW_COMPONENT_NAME} _CPACK_IFW_COMPONENT_UNAME) - if(${CMAKE_SYSTEM_NAME} MATCHES Windows) - set(_CPACK_IFW_PACKAGE_ICON "set(CPACK_IFW_PACKAGE_ICON \"${CMake_SOURCE_DIR}/Source/QtDialog/CMakeSetup.ico\")") + set(_CPACK_IFW_PACKAGE_ICON + "set(CPACK_IFW_PACKAGE_ICON \"${CMake_SOURCE_DIR}/Source/QtDialog/CMakeSetup.ico\")") if(BUILD_QtDialog) set(_CPACK_IFW_SHORTCUT_OPTIONAL "${_CPACK_IFW_SHORTCUT_OPTIONAL}component.addOperation(\"CreateShortcut\", \"@TargetDir@/bin/cmake-gui.exe\", \"@StartMenuDir@/CMake (cmake-gui).lnk\");\n") endif() @@ -87,7 +80,7 @@ if(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake") install(FILES "${CMake_SOURCE_DIR}/Source/QtIFW/cmake.org.html" DESTINATION "." ) - set(_CPACK_IFW_COMPONENT_SCRIPT "set(CPACK_IFW_COMPONENT_${_CPACK_IFW_COMPONENT_UNAME}_SCRIPT \"${CMake_BINARY_DIR}/installscript.qs\")") + set(_CPACK_IFW_PACKAGE_SCRIPT "set(CPACK_IFW_COMPONENT_GROUP_CMAKE_SCRIPT \"${CMake_BINARY_DIR}/installscript.qs\")") endif() if(${CMAKE_SYSTEM_NAME} MATCHES Linux) diff --git a/CMakeCPackOptions.cmake.in b/CMakeCPackOptions.cmake.in index 5127220..57ed4ca 100644 --- a/CMakeCPackOptions.cmake.in +++ b/CMakeCPackOptions.cmake.in @@ -32,22 +32,25 @@ endif() include("@QT_DIALOG_CPACK_OPTIONS_FILE@" OPTIONAL) if(CPACK_GENERATOR MATCHES "IFW") - # Version with QtIFW limitations - set(CPACK_PACKAGE_VERSION "@_CPACK_IFW_PACKAGE_VERSION@") # Installer configuration set(CPACK_IFW_PACKAGE_TITLE "CMake Build Tool") set(CPACK_IFW_PRODUCT_URL "http://www.cmake.org") @_CPACK_IFW_PACKAGE_ICON@ - set(CPACK_IFW_PACKAGE_WINDOW_ICON "@CMake_SOURCE_DIR@/Source/QtDialog/CMakeSetup128.png") - # Enable install default component - set(CPACK_COMPONENTS_ALL "@_CPACK_IFW_COMPONENT_NAME@") - # Component configuration - set(CPACK_COMPONENT_@_CPACK_IFW_COMPONENT_UNAME@_DISPLAY_NAME "@CPACK_PACKAGE_NAME@") - set(CPACK_COMPONENT_@_CPACK_IFW_COMPONENT_UNAME@_DESCRIPTION "@CPACK_PACKAGE_DESCRIPTION_SUMMARY@") - # IFW component onfiguration - set(CPACK_IFW_COMPONENT_@_CPACK_IFW_COMPONENT_UNAME@_NAME "@CPACK_PACKAGE_NAME@") - set(CPACK_IFW_COMPONENT_@_CPACK_IFW_COMPONENT_UNAME@_LICENSES "@CPACK_PACKAGE_NAME@ Copyright" "@CPACK_RESOURCE_FILE_LICENSE@") - @_CPACK_IFW_COMPONENT_SCRIPT@ + set(CPACK_IFW_PACKAGE_WINDOW_ICON + "@CMake_SOURCE_DIR@/Source/QtDialog/CMakeSetup128.png") + # Package configuration group + set(CPACK_IFW_PACKAGE_GROUP CMake) + # Group configuration + set(CPACK_COMPONENT_GROUP_CMAKE_DISPLAY_NAME + "@CPACK_PACKAGE_NAME@") + set(CPACK_COMPONENT_GROUP_CMAKE_DESCRIPTION + "@CPACK_PACKAGE_DESCRIPTION_SUMMARY@") + # IFW group configuration + set(CPACK_IFW_COMPONENT_GROUP_CMAKE_VERSION + "@_CPACK_IFW_PACKAGE_VERSION@") + set(CPACK_IFW_COMPONENT_GROUP_CMAKE_LICENSES + "@CPACK_PACKAGE_NAME@ Copyright" "@CPACK_RESOURCE_FILE_LICENSE@") + @_CPACK_IFW_PACKAGE_SCRIPT@ endif() if(CPACK_GENERATOR MATCHES "CygwinSource") diff --git a/Modules/CPackIFW.cmake b/Modules/CPackIFW.cmake index 29a0047..8463b5d 100644 --- a/Modules/CPackIFW.cmake +++ b/Modules/CPackIFW.cmake @@ -74,6 +74,15 @@ # # You can use predefined variables. # +# .. variable:: CPACK_IFW_PACKAGE_GROUP +# +# The group, which will be used to configure the root package +# +# .. variable:: CPACK_IFW_PACKAGE_NAME +# +# The root package name, which will be used if configuration group is not +# specified +# # Components # """""""""" # @@ -122,11 +131,10 @@ # # :: # -# cpack_ifw_configure_component(<compname> -# [COMMON] +# cpack_ifw_configure_component(<compname> [COMMON] +# [NAME <name>] # [VERSION <version>] # [SCRIPT <script>] -# [NAME <name>] # [PRIORITY <priority>] # [DEPENDS <com_id> ...] # [LICENSES <display_name> <file_path> ...]) @@ -163,6 +171,7 @@ # cpack_ifw_configure_component_group(<grpname> # [VERSION <version>] # [NAME <name>] +# [SCRIPT <script>] # [PRIORITY <priority>] # [LICENSES <display_name> <file_path> ...]) # @@ -174,6 +183,9 @@ # ``NAME`` is used to create domain-like identification for this component group. # By default used origin component group name. # +# ``SCRIPT`` is relative or absolute path to operations script +# for this component group. +# # ``PRIORITY`` is priority of the component group in the tree. # # ``LICENSES`` pair of <display_name> and <file_path> of license text for this @@ -329,6 +341,20 @@ if(NOT __CMAKE_PARSE_ARGUMENTS_INCLUDED) include(CMakeParseArguments) endif() +# Resolve full filename for script file +macro(_cpack_ifw_resolve_script _variable) + set(_ifw_script_macro ${_variable}) + set(_ifw_script_file ${${_ifw_script_macro}}) + if(DEFINED ${_ifw_script_macro}) + get_filename_component(${_ifw_script_macro} ${_ifw_script_file} ABSOLUTE) + set(_ifw_script_file ${${_ifw_script_macro}}) + if(NOT EXISTS ${_ifw_script_file}) + message(WARNING "CPack IFW: script file \"${_ifw_script_file}\" is not exists") + set(${_ifw_script_macro}) + endif() + endif() +endmacro() + # Resolve full path to lisense file macro(_cpack_ifw_resolve_lisenses _variable) if(${_variable}) @@ -357,18 +383,7 @@ macro(cpack_ifw_configure_component compname) set(_IFW_MULTI_ARGS DEPENDS LICENSES) cmake_parse_arguments(CPACK_IFW_COMPONENT_${_CPACK_IFWCOMP_UNAME} "${_IFW_OPT}" "${_IFW_ARGS}" "${_IFW_MULTI_ARGS}" ${ARGN}) - # Resolve full filename for script file - set(_IFW_SCRIPT_MACRO CPACK_IFW_COMPONENT_${_CPACK_IFWCOMP_UNAME}_SCRIPT) - set(_IFW_SCRIPT_FILE ${${_IFW_SCRIPT_MACRO}}) - if(DEFINED ${_IFW_SCRIPT_MACRO}) - get_filename_component(${_IFW_SCRIPT_MACRO} ${_IFW_SCRIPT_FILE} ABSOLUTE) - set(_IFW_SCRIPT_FILE ${${_IFW_SCRIPT_MACRO}}) - if(NOT EXISTS ${_IFW_SCRIPT_FILE}) - message(WARNING "CPack IFW: script file \"${_IFW_SCRIPT_FILE}\" for component \"${compname}\" is not exists" ) - set(${_IFW_SCRIPT_MACRO}) - endif() - endif() - + _cpack_ifw_resolve_script(CPACK_IFW_COMPONENT_${_CPACK_IFWCOMP_UNAME}_SCRIPT) _cpack_ifw_resolve_lisenses(CPACK_IFW_COMPONENT_${_CPACK_IFWCOMP_UNAME}_LICENSES) set(_CPACK_IFWCOMP_STR "\n# Configuration for IFW component \"${compname}\"\n") @@ -403,10 +418,11 @@ macro(cpack_ifw_configure_component_group grpname) string(TOUPPER ${grpname} _CPACK_IFWGRP_UNAME) set(_IFW_OPT) - set(_IFW_ARGS VERSION NAME PRIORITY) + set(_IFW_ARGS NAME VERSION SCRIPT PRIORITY) set(_IFW_MULTI_ARGS LICENSES) cmake_parse_arguments(CPACK_IFW_COMPONENT_GROUP_${_CPACK_IFWGRP_UNAME} "${_IFW_OPT}" "${_IFW_ARGS}" "${_IFW_MULTI_ARGS}" ${ARGN}) + _cpack_ifw_resolve_script(CPACK_IFW_COMPONENT_GROUP_${_CPACK_IFWGRP_UNAME}_SCRIPT) _cpack_ifw_resolve_lisenses(CPACK_IFW_COMPONENT_GROUP_${_CPACK_IFWGRP_UNAME}_LICENSES) set(_CPACK_IFWGRP_STR "\n# Configuration for IFW component group \"${grpname}\"\n") 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(); |