From a6bce55aefd332f148a2753d5be0ec4383534473 Mon Sep 17 00:00:00 2001 From: Eric NOULARD Date: Sat, 18 Feb 2012 22:07:39 +0100 Subject: Dynamically add documentation section specified in documented script. Modify CPackDeb and CPackRPM as an example --- Modules/CPackDeb.cmake | 2 +- Modules/CPackRPM.cmake | 2 +- Source/CPack/cpack.cxx | 3 +-- Source/cmDocumentation.cxx | 21 ++++++++++++++++++--- Source/cmDocumentation.h | 6 ++++-- 5 files changed, 25 insertions(+), 9 deletions(-) diff --git a/Modules/CPackDeb.cmake b/Modules/CPackDeb.cmake index 0916843..fe81dc9 100644 --- a/Modules/CPackDeb.cmake +++ b/Modules/CPackDeb.cmake @@ -1,4 +1,4 @@ -##section Variables specific to a CPack generator +##section Variables specific to CPack Debian (DEB) generator ##end ##module # - The builtin (binary) CPack Deb generator (Unix only) diff --git a/Modules/CPackRPM.cmake b/Modules/CPackRPM.cmake index f76e91e..ae81ab7 100644 --- a/Modules/CPackRPM.cmake +++ b/Modules/CPackRPM.cmake @@ -1,4 +1,4 @@ -##section Variables specific to a CPack generator +##section Variables specific to CPack RPM generator ##end ##module # - The builtin (binary) CPack RPM generator (Unix only) diff --git a/Source/CPack/cpack.cxx b/Source/CPack/cpack.cxx index c541610..6f5055c 100644 --- a/Source/CPack/cpack.cxx +++ b/Source/CPack/cpack.cxx @@ -514,7 +514,6 @@ int main (int argc, char *argv[]) if ( help ) { // Construct and print requested documentation. - std::vector variables; doc.SetName("cpack"); doc.SetSection("Name",cmDocumentationName); @@ -545,7 +544,7 @@ int main (int argc, char *argv[]) { doc.GetStructuredDocFromFile( (docedIt->first).c_str(), - commands,&cminst,(docedIt->second).c_str()); + commands,&cminst); } std::map propDocs; diff --git a/Source/cmDocumentation.cxx b/Source/cmDocumentation.cxx index 02f69f1..17e35d8 100644 --- a/Source/cmDocumentation.cxx +++ b/Source/cmDocumentation.cxx @@ -745,6 +745,18 @@ void cmDocumentation::addCPackStandardDocSections() "Variables specific to a CPack generator"); } +void cmDocumentation::addAutomaticVariableSections(const std::string& section) +{ + std::vector::iterator it; + it = find(this->VariableSections.begin(), + this->VariableSections.end(), + section); + /* if the section does not exist then add it */ + if (it==this->VariableSections.end()) + { + this->VariableSections.push_back(section); + } +} //---------------------------------------------------------------------------- int cmDocumentation::getDocumentedModulesListInDir( std::string path, @@ -818,8 +830,7 @@ static void trim(std::string& s) int cmDocumentation::GetStructuredDocFromFile( const char* fname, std::vector& commands, - cmake* cm, - const char *docSection) + cmake* cm) { typedef enum sdoce { SDOC_NONE, SDOC_MODULE, SDOC_MACRO, SDOC_FUNCTION, SDOC_VARIABLE, @@ -835,6 +846,7 @@ int cmDocumentation::GetStructuredDocFromFile( { return nbDocItemFound; } + std::string section; std::string name; std::string full; std::string brief; @@ -886,6 +898,8 @@ int cmDocumentation::GetStructuredDocFromFile( { docCtxIdx++; docContextStack[docCtxIdx]=SDOC_SECTION; + // 10 is the size of '##section' + 1 + section = line.substr(10,std::string::npos); /* drop the rest of the line */ line = ""; newCtx = true; @@ -900,11 +914,12 @@ int cmDocumentation::GetStructuredDocFromFile( brief.c_str(),full.c_str())); break; case SDOC_VARIABLE: + this->addAutomaticVariableSections(section); cm->DefineProperty (name.c_str(), cmProperty::VARIABLE, brief.c_str(), full.c_str(),false, - docSection); + section.c_str()); break; case SDOC_MODULE: /* not implemented */ diff --git a/Source/cmDocumentation.h b/Source/cmDocumentation.h index 00dba1a..11bef16 100644 --- a/Source/cmDocumentation.h +++ b/Source/cmDocumentation.h @@ -147,6 +147,9 @@ public: /** Add the CPack standard documentation section(s) */ void addCPackStandardDocSections(); + /** Add automatic variables sections */ + void addAutomaticVariableSections(const std::string& section); + /** * Retrieve the list of documented module located in * path which match the globing expression globExpr. @@ -185,8 +188,7 @@ public: */ int GetStructuredDocFromFile(const char* fname, std::vector& commands, - cmake* cm, - const char *docSection); + cmake* cm); private: void SetForm(Form f); void SetDocName(const char* docname); -- cgit v0.12 From b8a274c091b63e6203b61f5aee40393d1409c9fc Mon Sep 17 00:00:00 2001 From: Eric NOULARD Date: Sat, 18 Feb 2012 22:10:19 +0100 Subject: Add structured documentation for NSIS --- Modules/CPackNSIS.cmake | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/Modules/CPackNSIS.cmake b/Modules/CPackNSIS.cmake index d9dab53..093d0fc 100644 --- a/Modules/CPackNSIS.cmake +++ b/Modules/CPackNSIS.cmake @@ -1,70 +1,112 @@ +##section Variables specific to CPack Debian (DEB) generator +##end +##module # - CPack NSIS generator specific options # # The following variables are specific to the graphical installers built # on Windows using the Nullsoft Installation System. +##end # +##variable # CPACK_PACKAGE_INSTALL_REGISTRY_KEY - Registry key used when # installing this project. +##end # +##variable # CPACK_NSIS_INSTALL_ROOT - The default installation directory presented # to the end user by the NSIS installer is under this root dir. The full # directory presented to the end user is: # ${CPACK_NSIS_INSTALL_ROOT}/${CPACK_PACKAGE_INSTALL_DIRECTORY} +##end # +##variable # CPACK_NSIS_MUI_ICON - The icon file (.ico) for the generated # install program. +##end # +##variable # CPACK_NSIS_MUI_UNIICON - The icon file (.ico) for the generated # uninstall program. +##end # +##variable # CPACK_PACKAGE_ICON - A branding image that will be displayed inside # the installer. +##end # +##variable # CPACK_NSIS_EXTRA_INSTALL_COMMANDS - Extra NSIS commands that will # be added to the install Section. +##end # +##variable # CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS - Extra NSIS commands that will # be added to the uninstall Section. +##end # +##variable # CPACK_NSIS_COMPRESSOR - The arguments that will be passed to the # NSIS SetCompressor command. +##end # +##variable # CPACK_NSIS_MODIFY_PATH - If this is set to "ON", then an extra page # will appear in the installer that will allow the user to choose # whether the program directory should be added to the system PATH # variable. +##end # +##variable # CPACK_NSIS_DISPLAY_NAME - The display name string that appears in # the Windows Add/Remove Program control panel +##end # +##variable # CPACK_NSIS_PACKAGE_NAME - The title displayed at the top of the # installer. +##end # +##variable # CPACK_NSIS_INSTALLED_ICON_NAME - A path to the executable that # contains the installer icon. +##end # +##variable # CPACK_NSIS_HELP_LINK - URL to a web site providing assistance in # installing your application. +##end # +##variable # CPACK_NSIS_URL_INFO_ABOUT - URL to a web site providing more # information about your application. +##end # +##variable # CPACK_NSIS_CONTACT - Contact information for questions and comments # about the installation process. +##end # +##variable # CPACK_NSIS_CREATE_ICONS_EXTRA - Additional NSIS commands for # creating start menu shortcuts. +##end # +##variable # CPACK_NSIS_DELETE_ICONS_EXTRA -Additional NSIS commands to # uninstall start menu shortcuts. +##end # +##variable # CPACK_NSIS_EXECUTABLES_DIRECTORY - Creating NSIS start menu links # assumes that they are in 'bin' unless this variable is set. # For example, you would set this to 'exec' if your executables are # in an exec directory. +##end # +##variable # CPACK_NSIS_MUI_FINISHPAGE_RUN - Specify an executable to add an option # to run on the finish page of the NSIS installer. +##end #============================================================================= # Copyright 2006-2009 Kitware, Inc. -- cgit v0.12 From 7a8f44a2d6d23ec0345a1413f3a79c21f9566456 Mon Sep 17 00:00:00 2001 From: Eric NOULARD Date: Sat, 18 Feb 2012 22:14:45 +0100 Subject: Add structure documentation for CPack Bundle generator --- Modules/CPackBundle.cmake | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Modules/CPackBundle.cmake b/Modules/CPackBundle.cmake index 3ac4ea8..007fc04 100644 --- a/Modules/CPackBundle.cmake +++ b/Modules/CPackBundle.cmake @@ -1,25 +1,37 @@ +##section Variables specific to CPack Bundle generator +##end +##module # - CPack Bundle generator (Mac OS X) specific options # # Installers built on Mac OS X using the Bundle generator use the # aforementioned DragNDrop variables, plus the following Bundle-specific # parameters: +##end # +##variable # CPACK_BUNDLE_NAME - The name of the generated bundle. This # appears in the OSX finder as the bundle name. Required. +##end # +##variable # CPACK_BUNDLE_PLIST - Path to an OSX plist file that will be used # as the Info.plist for the generated bundle. This assumes that # the caller has generated or specified their own Info.plist file. # Required. +##end # +##variable # CPACK_BUNDLE_ICON - Path to an OSX icns file that will be used as # the icon for the generated bundle. This is the icon that appears # in the OSX finder for the bundle, and in the OSX dock when the # bundle is opened. Required. +##end # +##variable # CPACK_BUNDLE_STARTUP_SCRIPT - Path to an executable or script that # will be run whenever an end-user double-clicks the generated bundle # in the OSX Finder. Optional. +##end #============================================================================= # Copyright 2006-2009 Kitware, Inc. -- cgit v0.12 From 9717727d5fa29a993b22b9437e67cc28d8eaf52c Mon Sep 17 00:00:00 2001 From: Eric NOULARD Date: Sat, 18 Feb 2012 22:30:57 +0100 Subject: Suppress unecessary (now empty) doc sections --- Source/cmDocumentation.cxx | 2 -- 1 file changed, 2 deletions(-) diff --git a/Source/cmDocumentation.cxx b/Source/cmDocumentation.cxx index 17e35d8..1fb8ab6 100644 --- a/Source/cmDocumentation.cxx +++ b/Source/cmDocumentation.cxx @@ -741,8 +741,6 @@ void cmDocumentation::addCPackStandardDocSections() this->VariableSections.push_back( "Variables common to all CPack generators"); - this->VariableSections.push_back( - "Variables specific to a CPack generator"); } void cmDocumentation::addAutomaticVariableSections(const std::string& section) -- cgit v0.12 From b4abcfecbe281373fd3c28adccf4c3002b7909c4 Mon Sep 17 00:00:00 2001 From: Eric NOULARD Date: Sat, 18 Feb 2012 22:31:43 +0100 Subject: Correct copy/paste section name mistake --- Modules/CPackNSIS.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modules/CPackNSIS.cmake b/Modules/CPackNSIS.cmake index 093d0fc..97179d7 100644 --- a/Modules/CPackNSIS.cmake +++ b/Modules/CPackNSIS.cmake @@ -1,4 +1,4 @@ -##section Variables specific to CPack Debian (DEB) generator +##section Variables specific to CPack NSIS generator ##end ##module # - CPack NSIS generator specific options -- cgit v0.12 From dee0a38648195786bae0abce437ef4617ea0912e Mon Sep 17 00:00:00 2001 From: Eric NOULARD Date: Sat, 18 Feb 2012 22:33:10 +0100 Subject: Put CPack DMG and PackageMaker doc in separate files --- Modules/CPack.cmake | 55 -------------------------------- Modules/CPackDMG.cmake | 70 +++++++++++++++++++++++++++++++++++++++++ Modules/CPackPackageMaker.cmake | 34 ++++++++++++++++++++ 3 files changed, 104 insertions(+), 55 deletions(-) create mode 100644 Modules/CPackDMG.cmake create mode 100644 Modules/CPackPackageMaker.cmake diff --git a/Modules/CPack.cmake b/Modules/CPack.cmake index 8a44991..e0a5518 100644 --- a/Modules/CPack.cmake +++ b/Modules/CPack.cmake @@ -187,61 +187,6 @@ # list of patterns, e.g., /CVS/;/\\.svn/;\\.swp$;\\.#;/#;.*~;cscope.* ##end # -# The following variables are specific to the DragNDrop installers -# built on Mac OS X: -# -# CPACK_DMG_VOLUME_NAME - The volume name of the generated disk -# image. Defaults to CPACK_PACKAGE_FILE_NAME. -# -# CPACK_DMG_FORMAT - The disk image format. Common values are UDRO -# (UDIF read-only), UDZO (UDIF zlib-compressed) or UDBZ (UDIF -# bzip2-compressed). Refer to hdiutil(1) for more information on -# other available formats. -# -# CPACK_DMG_DS_STORE - Path to a custom .DS_Store file which e.g. -# can be used to specify the Finder window position/geometry and -# layout (such as hidden toolbars, placement of the icons etc.). -# This file has to be generated by the Finder (either manually or -# through OSA-script) using a normal folder from which the .DS_Store -# file can then be extracted. -# -# CPACK_DMG_BACKGROUND_IMAGE - Path to an image file which is to be -# used as the background for the Finder Window when the disk image -# is opened. By default no background image is set. The background -# image is applied after applying the custom .DS_Store file. -# -# CPACK_COMMAND_HDIUTIL - Path to the hdiutil(1) command used to -# operate on disk image files on Mac OS X. This variable can be used -# to override the automatically detected command (or specify its -# location if the auto-detection fails to find it.) -# -# CPACK_COMMAND_SETFILE - Path to the SetFile(1) command used to set -# extended attributes on files and directories on Mac OS X. This -# variable can be used to override the automatically detected -# command (or specify its location if the auto-detection fails to -# find it.) -# -# CPACK_COMMAND_REZ - Path to the Rez(1) command used to compile -# resources on Mac OS X. This variable can be used to override the -# automatically detected command (or specify its location if the -# auto-detection fails to find it.) -# -# The following variable is specific to installers build on Mac OS X -# using PackageMaker: -# -# CPACK_OSX_PACKAGE_VERSION - The version of Mac OS X that the -# resulting PackageMaker archive should be compatible -# with. Different versions of Mac OS X support different -# features. For example, CPack can only build component-based -# installers for Mac OS X 10.4 or newer, and can only build -# installers that download component son-the-fly for Mac OS X 10.5 -# or newer. If left blank, this value will be set to the minimum -# version of Mac OS X that supports the requested features. Set this -# variable to some value (e.g., 10.4) only if you want to guarantee -# that your installer will work on that version of Mac OS X, and -# don't mind missing extra features available in the installer -# shipping with later versions of Mac OS X. -# # The following variables are for advanced uses of CPack: # ##variable diff --git a/Modules/CPackDMG.cmake b/Modules/CPackDMG.cmake new file mode 100644 index 0000000..08a19d9 --- /dev/null +++ b/Modules/CPackDMG.cmake @@ -0,0 +1,70 @@ +##section Variables specific to CPack DragNDrop generator +##end +##module +# - DragNDrop CPack generator (Mac OS X). +# The following variables are specific to the DragNDrop installers +# built on Mac OS X: +#end +# +##variable +# CPACK_DMG_VOLUME_NAME - The volume name of the generated disk +# image. Defaults to CPACK_PACKAGE_FILE_NAME. +##end +# +##variable +# CPACK_DMG_FORMAT - The disk image format. Common values are UDRO +# (UDIF read-only), UDZO (UDIF zlib-compressed) or UDBZ (UDIF +# bzip2-compressed). Refer to hdiutil(1) for more information on +# other available formats. +##end +# +##variable +# CPACK_DMG_DS_STORE - Path to a custom .DS_Store file which e.g. +# can be used to specify the Finder window position/geometry and +# layout (such as hidden toolbars, placement of the icons etc.). +# This file has to be generated by the Finder (either manually or +# through OSA-script) using a normal folder from which the .DS_Store +# file can then be extracted. +##end +# +##variable +# CPACK_DMG_BACKGROUND_IMAGE - Path to an image file which is to be +# used as the background for the Finder Window when the disk image +# is opened. By default no background image is set. The background +# image is applied after applying the custom .DS_Store file. +##end +# +##variable +# CPACK_COMMAND_HDIUTIL - Path to the hdiutil(1) command used to +# operate on disk image files on Mac OS X. This variable can be used +# to override the automatically detected command (or specify its +# location if the auto-detection fails to find it.) +##end +# +##variable +# CPACK_COMMAND_SETFILE - Path to the SetFile(1) command used to set +# extended attributes on files and directories on Mac OS X. This +# variable can be used to override the automatically detected +# command (or specify its location if the auto-detection fails to +# find it.) +##end +# +##variable +# CPACK_COMMAND_REZ - Path to the Rez(1) command used to compile +# resources on Mac OS X. This variable can be used to override the +# automatically detected command (or specify its location if the +# auto-detection fails to find it.) +##end + +#============================================================================= +# Copyright 2006-2012 Kitware, Inc. +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distribute this file outside of CMake, substitute the full +# License text for the above reference.) diff --git a/Modules/CPackPackageMaker.cmake b/Modules/CPackPackageMaker.cmake new file mode 100644 index 0000000..8fe423c --- /dev/null +++ b/Modules/CPackPackageMaker.cmake @@ -0,0 +1,34 @@ +##section Variables specific to CPack PackageMaker generator +##end +##module +# - PackageMaker CPack generator (Mac OS X). +# The following variable is specific to installers build on Mac OS X +# using PackageMaker: +# +##variable +# CPACK_OSX_PACKAGE_VERSION - The version of Mac OS X that the +# resulting PackageMaker archive should be compatible +# with. Different versions of Mac OS X support different +# features. For example, CPack can only build component-based +# installers for Mac OS X 10.4 or newer, and can only build +# installers that download component son-the-fly for Mac OS X 10.5 +# or newer. If left blank, this value will be set to the minimum +# version of Mac OS X that supports the requested features. Set this +# variable to some value (e.g., 10.4) only if you want to guarantee +# that your installer will work on that version of Mac OS X, and +# don't mind missing extra features available in the installer +# shipping with later versions of Mac OS X. +##end + +#============================================================================= +# Copyright 2006-2012 Kitware, Inc. +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distribute this file outside of CMake, substitute the full +# License text for the above reference.) -- cgit v0.12 From cfac874b7783a5c464334bfc13d969a667f1c397 Mon Sep 17 00:00:00 2001 From: Eric NOULARD Date: Sat, 18 Feb 2012 23:10:14 +0100 Subject: More documentation concerning CPack Components --- Modules/CPackComponent.cmake | 47 +++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 46 insertions(+), 1 deletion(-) diff --git a/Modules/CPackComponent.cmake b/Modules/CPackComponent.cmake index 016cb8c..1598703 100644 --- a/Modules/CPackComponent.cmake +++ b/Modules/CPackComponent.cmake @@ -1,4 +1,4 @@ -##section Variables common to all CPack generators +##section Variables concerning CPack Components ##end ##module # - Build binary and source package installers @@ -25,6 +25,51 @@ # CPack commands: ##end # +##variable +# CPACK_COMPONENTS_ALL - The list of component to install. +# +# The default value of this variable is computed by CPack +# and contains all components defined by the project. The +# user may set it to only include the specified components. +##end +# +##variable +# CPACK__COMPONENT_INSTALL - Enable/Disable component install for +# CPack generator . +# +# Each CPack Generator (RPM, DEB, ARCHIVE, NSIS, DMG, etc...) has a legacy +# default behavior. e.g. RPM builds monolithic whereas NSIS builds component. +# One can change the default behavior by setting this variable to 0/1 or OFF/ON. +##end +##variable +# CPACK_COMPONENTS_GROUPING - Specify how components are grouped for multi-package +# component-aware CPack generators. +# +# Some generators like RPM or ARCHIVE family (TGZ, ZIP, ...) generates several +# packages files when asked for component packaging. They group the component +# differently depending on the value of this variable: +# - ONE_PER_GROUP (default): creates one package file per component group +# - ALL_COMPONENTS_IN_ONE : creates a single package with all (requested) component +# - IGNORE : creates one package per component, i.e. IGNORE component group +# One can specify different grouping for different CPack generator by using +# a CPACK_PROJECT_CONFIG_FILE. +##end +##variable +# CPACK_COMPONENT__DISPLAY_NAME - The name to be displayed for a component. +##end +##variable +# CPACK_COMPONENT__DESCRIPTION - The description of a component. +##end +##variable +# CPACK_COMPONENT__GROUP - The group of a component. +##end +##variable +# CPACK_COMPONENT__DEPENDS - The dependencies (list of components) +# on which this component depends. +##end +##variable +# CPACK_COMPONENT__REQUIRED - True is this component is required. +##end ##macro # cpack_add_component - Describes a CPack installation component # named by the COMPONENT argument to a CMake INSTALL command. -- cgit v0.12 From 4da2223ab768e44b7ef6e789ab193ea54c9b5e27 Mon Sep 17 00:00:00 2001 From: Eric NOULARD Date: Sat, 18 Feb 2012 23:13:45 +0100 Subject: Fix typo in end markup --- Modules/CPackDMG.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modules/CPackDMG.cmake b/Modules/CPackDMG.cmake index 08a19d9..caa8dc8 100644 --- a/Modules/CPackDMG.cmake +++ b/Modules/CPackDMG.cmake @@ -4,7 +4,7 @@ # - DragNDrop CPack generator (Mac OS X). # The following variables are specific to the DragNDrop installers # built on Mac OS X: -#end +##end # ##variable # CPACK_DMG_VOLUME_NAME - The volume name of the generated disk -- cgit v0.12 From 9a8103e929de7569fd2e5459a6676dff64d88892 Mon Sep 17 00:00:00 2001 From: Eric NOULARD Date: Sun, 19 Feb 2012 00:01:39 +0100 Subject: Try to fix compile error on Win32-vs70 --- Source/cmDocumentation.cxx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Source/cmDocumentation.cxx b/Source/cmDocumentation.cxx index 1fb8ab6..904a157 100644 --- a/Source/cmDocumentation.cxx +++ b/Source/cmDocumentation.cxx @@ -16,6 +16,7 @@ #include #include +#include //---------------------------------------------------------------------------- static const char *cmDocumentationStandardOptions[][3] = @@ -746,9 +747,9 @@ void cmDocumentation::addCPackStandardDocSections() void cmDocumentation::addAutomaticVariableSections(const std::string& section) { std::vector::iterator it; - it = find(this->VariableSections.begin(), - this->VariableSections.end(), - section); + it = std::find(this->VariableSections.begin(), + this->VariableSections.end(), + section); /* if the section does not exist then add it */ if (it==this->VariableSections.end()) { -- cgit v0.12