Explorar el Código

Merge topic 'ifw-user-interfaces'

c2f0f41f CPackIFW: Add USER_INTERFACES option
Brad King hace 9 años
padre
commit
34b49df564

+ 7 - 0
Help/release/dev/ifw-user-interfaces.rst

@@ -0,0 +1,7 @@
+ifw-user-interfaces
+-------------------
+
+* The :module:`CPackIFW` module :command:`cpack_ifw_configure_component` and
+  :command:`cpack_ifw_configure_component_group` commands gained a new
+  ``USER_INTERFACES`` option to add a list of additonal pages to the IFW
+  installer.

+ 28 - 4
Modules/CPackIFW.cmake

@@ -195,7 +195,8 @@
 #                       [SCRIPT <script>]
 #                       [SCRIPT <script>]
 #                       [PRIORITY <priority>]
 #                       [PRIORITY <priority>]
 #                       [DEPENDS <com_id> ...]
 #                       [DEPENDS <com_id> ...]
-#                       [LICENSES <display_name> <file_path> ...])
+#                       [LICENSES <display_name> <file_path> ...]
+#                       [USER_INTERFACES <file_path> <file_path> ...])
 #
 #
 # This command should be called after :command:`cpack_add_component` command.
 # This command should be called after :command:`cpack_add_component` command.
 #
 #
@@ -221,6 +222,8 @@
 # ``LICENSES`` pair of <display_name> and <file_path> of license text for this
 # ``LICENSES`` pair of <display_name> and <file_path> of license text for this
 # component. You can specify more then one license.
 # component. You can specify more then one license.
 #
 #
+# ``USER_INTERFACES`` a list of <file_path> representing pages to load
+#
 # --------------------------------------------------------------------------
 # --------------------------------------------------------------------------
 #
 #
 # .. command:: cpack_ifw_configure_component_group
 # .. command:: cpack_ifw_configure_component_group
@@ -234,7 +237,8 @@
 #                       [VERSION <version>]
 #                       [VERSION <version>]
 #                       [SCRIPT <script>]
 #                       [SCRIPT <script>]
 #                       [PRIORITY <priority>]
 #                       [PRIORITY <priority>]
-#                       [LICENSES <display_name> <file_path> ...])
+#                       [LICENSES <display_name> <file_path> ...]
+#                       [USER_INTERFACES <file_path> <file_path> ...])
 #
 #
 # This command should be called after :command:`cpack_add_component_group`
 # This command should be called after :command:`cpack_add_component_group`
 # command.
 # command.
@@ -254,6 +258,8 @@
 # ``LICENSES`` pair of <display_name> and <file_path> of license text for this
 # ``LICENSES`` pair of <display_name> and <file_path> of license text for this
 # component group. You can specify more then one license.
 # component group. You can specify more then one license.
 #
 #
+# ``USER_INTERFACES`` a list of <file_path> representing pages to load
+#
 # --------------------------------------------------------------------------
 # --------------------------------------------------------------------------
 #
 #
 # .. command:: cpack_ifw_add_repository
 # .. command:: cpack_ifw_add_repository
@@ -543,6 +549,22 @@ macro(_cpack_ifw_resolve_lisenses _variable)
   endif()
   endif()
 endmacro()
 endmacro()
 
 
+# Resolve full path to a list of provided files
+macro(_cpack_ifw_resolve_file_list _variable)
+  if(${_variable})
+    set(_ifw_list_fix)
+    foreach(_ifw_file_arg ${${_variable}})
+      get_filename_component(_ifw_file_arg "${_ifw_file_arg}" ABSOLUTE)
+      if(EXISTS ${_ifw_file_arg})
+        list(APPEND _ifw_list_fix "${_ifw_file_arg}")
+      else()
+        message(WARNING "CPack IFW: page file \"${_ifw_file_arg}\" does not exist. Skipping")
+      endif()
+    endforeach(_ifw_file_arg)
+    set(${_variable} "${_ifw_list_fix}")
+  endif()
+endmacro()
+
 # Macro for configure component
 # Macro for configure component
 macro(cpack_ifw_configure_component compname)
 macro(cpack_ifw_configure_component compname)
 
 
@@ -550,11 +572,12 @@ macro(cpack_ifw_configure_component compname)
 
 
   set(_IFW_OPT COMMON ESSENTIAL)
   set(_IFW_OPT COMMON ESSENTIAL)
   set(_IFW_ARGS NAME VERSION SCRIPT PRIORITY)
   set(_IFW_ARGS NAME VERSION SCRIPT PRIORITY)
-  set(_IFW_MULTI_ARGS DEPENDS LICENSES)
+  set(_IFW_MULTI_ARGS DEPENDS LICENSES USER_INTERFACES)
   cmake_parse_arguments(CPACK_IFW_COMPONENT_${_CPACK_IFWCOMP_UNAME} "${_IFW_OPT}" "${_IFW_ARGS}" "${_IFW_MULTI_ARGS}" ${ARGN})
   cmake_parse_arguments(CPACK_IFW_COMPONENT_${_CPACK_IFWCOMP_UNAME} "${_IFW_OPT}" "${_IFW_ARGS}" "${_IFW_MULTI_ARGS}" ${ARGN})
 
 
   _cpack_ifw_resolve_script(CPACK_IFW_COMPONENT_${_CPACK_IFWCOMP_UNAME}_SCRIPT)
   _cpack_ifw_resolve_script(CPACK_IFW_COMPONENT_${_CPACK_IFWCOMP_UNAME}_SCRIPT)
   _cpack_ifw_resolve_lisenses(CPACK_IFW_COMPONENT_${_CPACK_IFWCOMP_UNAME}_LICENSES)
   _cpack_ifw_resolve_lisenses(CPACK_IFW_COMPONENT_${_CPACK_IFWCOMP_UNAME}_LICENSES)
+  _cpack_ifw_resolve_file_list(CPACK_IFW_COMPONENT_${_CPACK_IFWCOMP_UNAME}_USER_INTERFACES)
 
 
   set(_CPACK_IFWCOMP_STR "\n# Configuration for IFW component \"${compname}\"\n")
   set(_CPACK_IFWCOMP_STR "\n# Configuration for IFW component \"${compname}\"\n")
 
 
@@ -589,11 +612,12 @@ macro(cpack_ifw_configure_component_group grpname)
 
 
   set(_IFW_OPT)
   set(_IFW_OPT)
   set(_IFW_ARGS NAME VERSION SCRIPT PRIORITY)
   set(_IFW_ARGS NAME VERSION SCRIPT PRIORITY)
-  set(_IFW_MULTI_ARGS LICENSES)
+  set(_IFW_MULTI_ARGS LICENSES USER_INTERFACES)
   cmake_parse_arguments(CPACK_IFW_COMPONENT_GROUP_${_CPACK_IFWGRP_UNAME} "${_IFW_OPT}" "${_IFW_ARGS}" "${_IFW_MULTI_ARGS}" ${ARGN})
   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_script(CPACK_IFW_COMPONENT_GROUP_${_CPACK_IFWGRP_UNAME}_SCRIPT)
   _cpack_ifw_resolve_lisenses(CPACK_IFW_COMPONENT_GROUP_${_CPACK_IFWGRP_UNAME}_LICENSES)
   _cpack_ifw_resolve_lisenses(CPACK_IFW_COMPONENT_GROUP_${_CPACK_IFWGRP_UNAME}_LICENSES)
+  _cpack_ifw_resolve_file_list(CPACK_IFW_COMPONENT_GROUP_${_CPACK_IFWGRP_UNAME}_USER_INTERFACES)
 
 
   set(_CPACK_IFWGRP_STR "\n# Configuration for IFW component group \"${grpname}\"\n")
   set(_CPACK_IFWGRP_STR "\n# Configuration for IFW component group \"${grpname}\"\n")
 
 

+ 30 - 0
Source/CPack/IFW/cmCPackIFWPackage.cxx

@@ -153,6 +153,7 @@ void cmCPackIFWPackage::DefaultConfiguration()
   ReleaseDate = "";
   ReleaseDate = "";
   Script = "";
   Script = "";
   Licenses.clear();
   Licenses.clear();
+  UserInterfaces.clear();
   SortingPriority = "";
   SortingPriority = "";
   Default = "";
   Default = "";
   Essential = "";
   Essential = "";
@@ -229,6 +230,12 @@ int cmCPackIFWPackage::ConfigureFromComponent(cmCPackComponent* component)
     Script = option;
     Script = option;
   }
   }
 
 
+  // User interfaces
+  if (const char* option = this->GetOption(prefix + "USER_INTERFACES")) {
+    UserInterfaces.clear();
+    cmSystemTools::ExpandListArgument(option, UserInterfaces);
+  }
+
   // CMake dependencies
   // CMake dependencies
   if (!component->Dependencies.empty()) {
   if (!component->Dependencies.empty()) {
     std::vector<cmCPackComponent*>::iterator dit;
     std::vector<cmCPackComponent*>::iterator dit;
@@ -322,6 +329,12 @@ int cmCPackIFWPackage::ConfigureFromGroup(cmCPackComponentGroup* group)
     Script = option;
     Script = option;
   }
   }
 
 
+  // User interfaces
+  if (const char* option = this->GetOption(prefix + "USER_INTERFACES")) {
+    UserInterfaces.clear();
+    cmSystemTools::ExpandListArgument(option, UserInterfaces);
+  }
+
   // Licenses
   // Licenses
   if (const char* option = this->GetOption(prefix + "LICENSES")) {
   if (const char* option = this->GetOption(prefix + "LICENSES")) {
     Licenses.clear();
     Licenses.clear();
@@ -417,6 +430,23 @@ void cmCPackIFWPackage::GeneratePackageFile()
     xout.Element("Script", name);
     xout.Element("Script", name);
   }
   }
 
 
+  // User Interfaces (copy to meta dir)
+  std::vector<std::string> userInterfaces = UserInterfaces;
+  for (size_t i = 0; i < userInterfaces.size(); i++) {
+    std::string name = cmSystemTools::GetFilenameName(userInterfaces[i]);
+    std::string path = Directory + "/meta/" + name;
+    cmsys::SystemTools::CopyFileIfDifferent(userInterfaces[i].data(),
+                                            path.data());
+    userInterfaces[i] = name;
+  }
+  if (!userInterfaces.empty()) {
+    xout.StartElement("UserInterfaces");
+    for (size_t i = 0; i < userInterfaces.size(); i++) {
+      xout.Element("UserInterface", userInterfaces[i]);
+    }
+    xout.EndElement();
+  }
+
   // Dependencies
   // Dependencies
   std::set<DependenceStruct> compDepSet;
   std::set<DependenceStruct> compDepSet;
   for (std::set<DependenceStruct*>::iterator ait = AlienDependencies.begin();
   for (std::set<DependenceStruct*>::iterator ait = AlienDependencies.begin();

+ 3 - 0
Source/CPack/IFW/cmCPackIFWPackage.h

@@ -99,6 +99,9 @@ public:
   /// List of license agreements to be accepted by the installing user
   /// List of license agreements to be accepted by the installing user
   std::vector<std::string> Licenses;
   std::vector<std::string> Licenses;
 
 
+  /// List of pages to load
+  std::vector<std::string> UserInterfaces;
+
   /// Priority of the component in the tree
   /// Priority of the component in the tree
   std::string SortingPriority;
   std::string SortingPriority;