From 938bbc4352cf34532dc1f52998ec7d23532df765 Mon Sep 17 00:00:00 2001 From: Konstantin Podsvirov Date: Sun, 7 Dec 2014 21:25:28 +0300 Subject: [PATCH] CMake: Install COMPONENTs Added components: - cmake - ctest - cpack - cmake-gui - ccmake - data - sphinx-html - sphinx-singlehtml - sphinx-qthelp Other now Unspecified. --- CMakeCPack.cmake | 48 ++++++++--- CMakeCPackOptions.cmake.in | 84 ++++++++++++++++++- CMakeLists.txt | 1 + Source/CMakeLists.txt | 11 ++- Source/CursesDialog/CMakeLists.txt | 2 +- Source/QtDialog/CMakeLists.txt | 4 +- Source/QtIFW/CMake.Dialogs.QtGUI.qs | 21 +++++ .../CMake.Documentation.SphinxHTML.qs.in | 21 +++++ .../{installscript.qs.in => CMake.qs.in} | 12 ++- Utilities/Sphinx/CMakeLists.txt | 4 +- 10 files changed, 183 insertions(+), 25 deletions(-) create mode 100644 Source/QtIFW/CMake.Dialogs.QtGUI.qs create mode 100644 Source/QtIFW/CMake.Documentation.SphinxHTML.qs.in rename Source/QtIFW/{installscript.qs.in => CMake.qs.in} (81%) diff --git a/CMakeCPack.cmake b/CMakeCPack.cmake index 22ca8cfa1..b299e7f96 100644 --- a/CMakeCPack.cmake +++ b/CMakeCPack.cmake @@ -65,22 +65,48 @@ if(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake") endif() endif() + # Components + set(_CPACK_IFW_COMPONENTS_ALL cmake ctest cpack) + list(APPEND _CPACK_IFW_COMPONENTS_ALL data) + if(CMAKE_INSTALL_DEFAULT_COMPONENT_NAME) + set(_CPACK_IFW_COMPONENT_UNSPECIFIED_NAME + ${CMAKE_INSTALL_DEFAULT_COMPONENT_NAME}) + else() + set(_CPACK_IFW_COMPONENT_UNSPECIFIED_NAME Unspecified) + endif() + list(APPEND _CPACK_IFW_COMPONENTS_ALL ${_CPACK_IFW_COMPONENT_UNSPECIFIED_NAME}) + string(TOUPPER "${_CPACK_IFW_COMPONENT_UNSPECIFIED_NAME}" + _CPACK_IFW_COMPONENT_UNSPECIFIED_UNAME) + if(BUILD_CursesDialog) + list(APPEND _CPACK_IFW_COMPONENTS_ALL ccmake) + endif() + if(BUILD_QtDialog) + list(APPEND _CPACK_IFW_COMPONENTS_ALL cmake-gui) + endif() + if(SPHINX_HTML) + list(APPEND _CPACK_IFW_COMPONENTS_ALL sphinx-html) + endif() + if(SPHINX_SINGLEHTML) + list(APPEND _CPACK_IFW_COMPONENTS_ALL sphinx-singlehtml) + endif() + if(SPHINX_QTHELP) + list(APPEND _CPACK_IFW_COMPONENTS_ALL sphinx-qthelp) + endif() + + # Components scripts configuration + foreach(_script + CMake + CMake.Documentation.SphinxHTML) + configure_file("${CMake_SOURCE_DIR}/Source/QtIFW/${_script}.qs.in" + "${CMake_BINARY_DIR}/${_script}.qs" @ONLY) + endforeach() + if(${CMAKE_SYSTEM_NAME} MATCHES Windows) 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() - if(SPHINX_HTML) - set(_CPACK_IFW_SHORTCUT_OPTIONAL "${_CPACK_IFW_SHORTCUT_OPTIONAL}component.addOperation(\"CreateShortcut\", \"@TargetDir@/doc/cmake-${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}/html/index.html\", \"@StartMenuDir@/CMake Documentation.lnk\");\n") - endif() - configure_file("${CMake_SOURCE_DIR}/Source/QtIFW/installscript.qs.in" - "${CMake_BINARY_DIR}/installscript.qs" @ONLY - ) install(FILES "${CMake_SOURCE_DIR}/Source/QtIFW/cmake.org.html" - DESTINATION "." + DESTINATION "${CMAKE_DOC_DIR}" ) - 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 600356513..07c7017dc 100644 --- a/CMakeCPackOptions.cmake.in +++ b/CMakeCPackOptions.cmake.in @@ -44,17 +44,97 @@ if(CPACK_GENERATOR MATCHES "IFW") set(CPACK_IFW_PACKAGE_MAINTENANCE_TOOL_NAME "cmake-maintenance") # Package configuration group set(CPACK_IFW_PACKAGE_GROUP CMake) + # Components + set(CPACK_COMPONENTS_ALL "@_CPACK_IFW_COMPONENTS_ALL@") + set(CPACK_COMPONENTS_GROUPING IGNORE) + # Unspecified + set(CPACK_IFW_COMPONENT_@_CPACK_IFW_COMPONENT_UNSPECIFIED_UNAME@_VERSION + "@_CPACK_IFW_PACKAGE_VERSION@") # 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@ + set(CPACK_IFW_COMPONENT_GROUP_CMAKE_SCRIPT "@CMake_BINARY_DIR@/CMake.qs") + set(CPACK_IFW_COMPONENT_GROUP_CMAKE_PRIORITY 100) + + # Tools + set(CPACK_COMPONENT_GROUP_TOOLS_DISPLAY_NAME "Command-Line Tools") + set(CPACK_COMPONENT_GROUP_TOOLS_PARENT_GROUP CMake) + set(CPACK_IFW_COMPONENT_GROUP_TOOLS_PRIORITY 90) + set(CPACK_IFW_COMPONENT_GROUP_TOOLS_VERSION "@_CPACK_IFW_PACKAGE_VERSION@") + + set(CPACK_COMPONENT_CMAKE_DISPLAY_NAME "cmake") + set(CPACK_COMPONENT_CMAKE_GROUP Tools) + set(CPACK_IFW_COMPONENT_CMAKE_NAME "CMake") + set(CPACK_IFW_COMPONENT_CMAKE_VERSION "@_CPACK_IFW_PACKAGE_VERSION@") + + set(CPACK_COMPONENT_CTEST_DISPLAY_NAME "ctest") + set(CPACK_COMPONENT_CTEST_GROUP Tools) + set(CPACK_IFW_COMPONENT_CTEST_NAME "CTest") + set(CPACK_IFW_COMPONENT_CTEST_VERSION "@_CPACK_IFW_PACKAGE_VERSION@") + + set(CPACK_COMPONENT_CPACK_DISPLAY_NAME "cpack") + set(CPACK_COMPONENT_CPACK_GROUP Tools) + set(CPACK_IFW_COMPONENT_CPACK_NAME "CPack") + set(CPACK_IFW_COMPONENT_CPACK_VERSION "@_CPACK_IFW_PACKAGE_VERSION@") + + # Dialogs + set(CPACK_COMPONENT_GROUP_DIALOGS_DISPLAY_NAME "Interactive Dialogs") + set(CPACK_COMPONENT_GROUP_DIALOGS_PARENT_GROUP CMake) + set(CPACK_IFW_COMPONENT_GROUP_DIALOGS_PRIORITY 80) + set(CPACK_IFW_COMPONENT_GROUP_DIALOGS_VERSION "@_CPACK_IFW_PACKAGE_VERSION@") + + set(CPACK_COMPONENT_CMAKE-GUI_DISPLAY_NAME "cmake-gui") + set(CPACK_COMPONENT_CMAKE-GUI_GROUP Dialogs) + set(CPACK_IFW_COMPONENT_CMAKE-GUI_NAME "QtGUI") + set(CPACK_IFW_COMPONENT_CMAKE-GUI_SCRIPT + "@CMake_SOURCE_DIR@/Source/QtIFW/CMake.Dialogs.QtGUI.qs") + set(CPACK_IFW_COMPONENT_CMAKE-GUI_VERSION "@_CPACK_IFW_PACKAGE_VERSION@") + + set(CPACK_COMPONENT_CCMAKE_DISPLAY_NAME "ccmake") + set(CPACK_COMPONENT_CCMAKE_GROUP Dialogs) + set(CPACK_IFW_COMPONENT_CCMAKE_NAME "CursesGUI") + set(CPACK_IFW_COMPONENT_CCMAKE_VERSION "@_CPACK_IFW_PACKAGE_VERSION@") + + # Data + set(CPACK_COMPONENT_DATA_DISPLAY_NAME "Data") + set(CPACK_COMPONENT_DATA_DESCRIPTION + "CMake data files (help, modules and templates)") + set(CPACK_COMPONENT_DATA_GROUP CMake) + set(CPACK_IFW_COMPONENT_DATA_PRIORITY 70) + set(CPACK_IFW_COMPONENT_DATA_NAME "Data") + set(CPACK_IFW_COMPONENT_DATA_VERSION "@_CPACK_IFW_PACKAGE_VERSION@") + + # Documentation + set(CPACK_COMPONENT_GROUP_DOCUMENTATION_DISPLAY_NAME "Documentation") + set(CPACK_COMPONENT_GROUP_DOCUMENTATION_PARENT_GROUP CMake) + set(CPACK_IFW_COMPONENT_GROUP_DOCUMENTATION_PRIORITY 60) + set(CPACK_IFW_COMPONENT_GROUP_DOCUMENTATION_VERSION + "@_CPACK_IFW_PACKAGE_VERSION@") + + set(CPACK_COMPONENT_SPHINX-HTML_DISPLAY_NAME "HTML") + set(CPACK_COMPONENT_SPHINX-HTML_GROUP Documentation) + set(CPACK_IFW_COMPONENT_SPHINX-HTML_NAME "SphinxHTML") + set(CPACK_IFW_COMPONENT_SPHINX-HTML_SCRIPT + "@CMake_BINARY_DIR@/CMake.Documentation.SphinxHTML.qs") + set(CPACK_IFW_COMPONENT_SPHINX-HTML_VERSION "@_CPACK_IFW_PACKAGE_VERSION@") + + set(CPACK_COMPONENT_SPHINX-SINGLEHTML_DISPLAY_NAME "Single HTML") + set(CPACK_COMPONENT_SPHINX-SINGLEHTML_GROUP Documentation) + set(CPACK_IFW_COMPONENT_SPHINX-SINGLEHTML_NAME "SphinxSingleHTML") + set(CPACK_IFW_COMPONENT_SPHINX-SINGLEHTML_VERSION + "@_CPACK_IFW_PACKAGE_VERSION@") + + set(CPACK_COMPONENT_SPHINX-QTHELP_DISPLAY_NAME "Qt Compressed Help") + set(CPACK_COMPONENT_SPHINX-QTHELP_GROUP Documentation) + set(CPACK_IFW_COMPONENT_SPHINX-QTHELP_NAME "SphinxQtHelp") + set(CPACK_IFW_COMPONENT_SPHINX-QTHELP_VERSION "@_CPACK_IFW_PACKAGE_VERSION@") + endif() if(CPACK_GENERATOR MATCHES "CygwinSource") diff --git a/CMakeLists.txt b/CMakeLists.txt index 1b91ab893..2c40a1a4b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -652,6 +652,7 @@ if(NOT CMake_TEST_EXTERNAL_CMAKE) DIRECTORY_PERMISSIONS OWNER_READ OWNER_EXECUTE OWNER_WRITE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE + COMPONENT data PATTERN "*.sh*" PERMISSIONS OWNER_READ OWNER_EXECUTE OWNER_WRITE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index 6d012fdde..83d3090eb 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -734,9 +734,16 @@ endif() include (${CMake_BINARY_DIR}/Source/LocalUserOptions.cmake OPTIONAL) include (${CMake_SOURCE_DIR}/Source/LocalUserOptions.cmake OPTIONAL) -install(TARGETS cmake ctest cpack DESTINATION bin) +# Install tools + +set(_tools cmake ctest cpack) + if(APPLE) - install(TARGETS cmakexbuild DESTINATION bin) + list(APPEND _tools cmakexbuild) endif() +foreach(_tool ${_tools}) + install(TARGETS ${_tool} DESTINATION bin COMPONENT ${_tool}) +endforeach() + install(FILES cmCPluginAPI.h DESTINATION ${CMAKE_DATA_DIR}/include) diff --git a/Source/CursesDialog/CMakeLists.txt b/Source/CursesDialog/CMakeLists.txt index 7d4e88cdc..14eb46c46 100644 --- a/Source/CursesDialog/CMakeLists.txt +++ b/Source/CursesDialog/CMakeLists.txt @@ -47,4 +47,4 @@ else() target_link_libraries(ccmake cmForm) endif() -install(TARGETS ccmake DESTINATION bin) +install(TARGETS ccmake DESTINATION bin COMPONENT ccmake) diff --git a/Source/QtDialog/CMakeLists.txt b/Source/QtDialog/CMakeLists.txt index 168f57d04..f3590c43b 100644 --- a/Source/QtDialog/CMakeLists.txt +++ b/Source/QtDialog/CMakeLists.txt @@ -165,7 +165,9 @@ endif() set(CMAKE_INSTALL_DESTINATION_ARGS BUNDLE DESTINATION "${CMAKE_BUNDLE_LOCATION}") -install(TARGETS cmake-gui RUNTIME DESTINATION bin ${CMAKE_INSTALL_DESTINATION_ARGS}) +install(TARGETS cmake-gui + RUNTIME DESTINATION bin COMPONENT cmake-gui + ${CMAKE_INSTALL_DESTINATION_ARGS}) if(UNIX AND NOT APPLE) foreach (size IN ITEMS 32 128) diff --git a/Source/QtIFW/CMake.Dialogs.QtGUI.qs b/Source/QtIFW/CMake.Dialogs.QtGUI.qs new file mode 100644 index 000000000..219a0a90a --- /dev/null +++ b/Source/QtIFW/CMake.Dialogs.QtGUI.qs @@ -0,0 +1,21 @@ +// Component: CMake.Dialogs.QtGUI + +function Component() +{ + // Default constructor +} + +Component.prototype.createOperations = function() +{ + // Create shortcut + if (installer.value("os") === "win") { + + component.addOperation("CreateShortcut", + installer.value("TargetDir") + "/bin/cmake-gui.exe", + installer.value("StartMenuDir") + "/CMake (cmake-gui).lnk"); + + } + + // Call default implementation + component.createOperations(); +} diff --git a/Source/QtIFW/CMake.Documentation.SphinxHTML.qs.in b/Source/QtIFW/CMake.Documentation.SphinxHTML.qs.in new file mode 100644 index 000000000..5c929e86f --- /dev/null +++ b/Source/QtIFW/CMake.Documentation.SphinxHTML.qs.in @@ -0,0 +1,21 @@ +// Component: CMake.Documentation.SphinxHTML + +function Component() +{ + // Default constructor +} + +Component.prototype.createOperations = function() +{ + // Create shortcut + if (installer.value("os") === "win") { + + component.addOperation("CreateShortcut", + installer.value("TargetDir") + "/@CMAKE_DOC_DIR@/html/index.html", + installer.value("StartMenuDir") + "/CMake Documentation.lnk"); + + } + + // Call default implementation + component.createOperations(); +} diff --git a/Source/QtIFW/installscript.qs.in b/Source/QtIFW/CMake.qs.in similarity index 81% rename from Source/QtIFW/installscript.qs.in rename to Source/QtIFW/CMake.qs.in index 570dba1e0..828cc7cb2 100644 --- a/Source/QtIFW/installscript.qs.in +++ b/Source/QtIFW/CMake.qs.in @@ -1,24 +1,22 @@ function Component() { - // default constructor + // Default constructor } Component.prototype.createOperations = function() { - // call default implementation to actually install applications! - component.createOperations(); - // Create shortcut if (installer.value("os") === "win") { -@_CPACK_IFW_SHORTCUT_OPTIONAL@ - component.addOperation("CreateShortcut", - installer.value("TargetDir") + "/cmake.org.html", + installer.value("TargetDir") + "/@CMAKE_DOC_DIR@/cmake.org.html", installer.value("StartMenuDir") + "/CMake Web Site.lnk"); component.addOperation("CreateShortcut", installer.value("TargetDir") + "/cmake-maintenance.exe", installer.value("StartMenuDir") + "/CMake Maintenance Tool.lnk"); } + + // Call default implementation + component.createOperations(); } diff --git a/Utilities/Sphinx/CMakeLists.txt b/Utilities/Sphinx/CMakeLists.txt index a755ca129..f2a3727fd 100644 --- a/Utilities/Sphinx/CMakeLists.txt +++ b/Utilities/Sphinx/CMakeLists.txt @@ -162,6 +162,7 @@ endif() if(SPHINX_HTML) install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/html DESTINATION ${CMAKE_DOC_DIR} + COMPONENT sphinx-html PATTERN .buildinfo EXCLUDE ) endif() @@ -169,12 +170,13 @@ endif() if(SPHINX_SINGLEHTML) install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/singlehtml DESTINATION ${CMAKE_DOC_DIR} + COMPONENT sphinx-singlehtml PATTERN .buildinfo EXCLUDE ) endif() if(SPHINX_QTHELP) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/qthelp/CMake-${CMake_VERSION_MAJOR}${CMake_VERSION_MINOR}${CMake_VERSION_PATCH}.qch - DESTINATION ${CMAKE_DOC_DIR} + DESTINATION ${CMAKE_DOC_DIR} COMPONENT sphinx-qthelp ) endif()