diff options
author | Konstantin Podsvirov <konstantin@podsvirov.pro> | 2017-01-11 11:06:00 (GMT) |
---|---|---|
committer | Konstantin Podsvirov <konstantin@podsvirov.pro> | 2017-01-12 16:29:52 (GMT) |
commit | 4971799360b5ec7c99f94810f2fa5cb9f80dcebf (patch) | |
tree | 488e2e136a9101741a30ae90d1e155f5f252bb2a | |
parent | 728820f3ea0faf55ffe1236a44a35e9197fc6291 (diff) | |
download | CMake-4971799360b5ec7c99f94810f2fa5cb9f80dcebf.zip CMake-4971799360b5ec7c99f94810f2fa5cb9f80dcebf.tar.gz CMake-4971799360b5ec7c99f94810f2fa5cb9f80dcebf.tar.bz2 |
QtIFW: Improved packaging
Now cpack_ifw_configure_file command used to configure
template files of component's scripts.
Now for these template files we can use QtIFW predefined
variables (like @VAR@) and template variables
in Qt/IFW/SDK/Creator templates style (like %VAR%).
Now CMake_INSTALL_INFIX advanced variable used to configure
CMake installation destination when package as part of QtSDK.
-rw-r--r-- | CMakeCPack.cmake | 45 | ||||
-rw-r--r-- | CMakeCPackOptions.cmake.in | 2 | ||||
-rw-r--r-- | Packaging/QtSDK/ToolsCMakeXX.cmake | 49 | ||||
-rw-r--r-- | Packaging/QtSDK/qt.tools.cmake.xx.qs.in | 12 | ||||
-rw-r--r-- | Source/QtIFW/CMake.DeveloperReference.HTML.qs.in | 4 | ||||
-rw-r--r-- | Source/QtIFW/CMake.Dialogs.QtGUI.qs.in (renamed from Source/QtIFW/CMake.Dialogs.QtGUI.qs) | 4 | ||||
-rw-r--r-- | Source/QtIFW/CMake.Documentation.SphinxHTML.qs.in | 4 | ||||
-rw-r--r-- | Source/QtIFW/CMake.qs.in | 10 | ||||
-rw-r--r-- | Source/QtIFW/installscript.qs.in | 12 |
9 files changed, 65 insertions, 77 deletions
diff --git a/CMakeCPack.cmake b/CMakeCPack.cmake index ba858bd..a0aacb4 100644 --- a/CMakeCPack.cmake +++ b/CMakeCPack.cmake @@ -54,6 +54,9 @@ if(${CPACK_SYSTEM_NAME} MATCHES Windows) endif() endif() +# Command for configure IFW script templates +include(${CMake_SOURCE_DIR}/Modules/CPackIFWConfigureFile.cmake) + # Advanced IFW configuration set(_cpifwrc CPACK_IFW_COMPONENT_GROUP_CMAKE_) set(_cpifwrcconf _CPACK_IFW_COMPONENT_GROUP_CMAKE) @@ -85,8 +88,6 @@ _cmifwarg("Package <Default> tag (values: TRUE, FALSE, SCRIPT)" _cmifwarg("Package <Version> tag" STRING VERSION "${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}.${CMake_VERSION_PATCH}") -_cmifwarg("Package <Script> tag" - FILEPATH SCRIPT "${CMake_BINARY_DIR}/installscript.qs") _cmifwarg("Package <SortingPriority> tag" STRING PRIORITY "100") _cmifwarg("Package <ForsedInstallation> tag" @@ -148,33 +149,22 @@ if(CMake_INSTALL_COMPONENTS) set(CPACK_COMPONENTS_ALL \"${_CPACK_IFW_COMPONENTS_ALL}\") set(CPACK_COMPONENTS_GROUPING IGNORE) ") + _cmifwarg("Package <Script> template" + FILEPATH SCRIPT_TEMPLATE "${CMake_SOURCE_DIR}/Source/QtIFW/CMake.qs.in") else() if(BUILD_QtDialog AND USE_LGPL) set(${_cpifwrc}LICENSES_DEFAULT "${${_cpifwrc}LICENSES_DEFAULT};LGPLv${USE_LGPL};${CMake_SOURCE_DIR}/Licenses/LGPLv${USE_LGPL}.txt") endif() + _cmifwarg("Package <Script> template" + FILEPATH SCRIPT_TEMPLATE "${CMake_SOURCE_DIR}/Source/QtIFW/installscript.qs.in") endif() +_cmifwarg("Package <Script> generated" + FILEPATH SCRIPT_GENERATED "${CMake_BINARY_DIR}/CMake.qs") _cmifwarg("Package <Licenses> tag (pairs of <display_name> <file_path>)" STRING LICENSES "${${_cpifwrc}LICENSES_DEFAULT}") -# Components scripts configuration -if(CMake_INSTALL_COMPONENTS) - configure_file("${CMake_SOURCE_DIR}/Source/QtIFW/CMake.qs.in" - "${CMake_BINARY_DIR}/installscript.qs" @ONLY - ) -else() - configure_file("${CMake_SOURCE_DIR}/Source/QtIFW/installscript.qs.in" - "${CMake_BINARY_DIR}/installscript.qs" @ONLY - ) -endif() -foreach(_script - CMake.Documentation.SphinxHTML - CMake.DeveloperReference.HTML) - 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\")") @@ -199,6 +189,23 @@ if(${CMAKE_SYSTEM_NAME} MATCHES Linux) set(CPACK_IFW_ADMIN_TARGET_DIRECTORY "@ApplicationsDir@/${CMAKE_PROJECT_NAME}") endif() +# Components scripts configuration +if((EXISTS "${CMake_IFW_ROOT_COMPONENT_SCRIPT_TEMPLATE}") + AND (NOT "${CMake_IFW_ROOT_COMPONENT_SCRIPT_GENERATED}" STREQUAL "") + AND (NOT "${CMake_IFW_ROOT_COMPONENT_SCRIPT}")) + cpack_ifw_configure_file("${CMake_IFW_ROOT_COMPONENT_SCRIPT_TEMPLATE}" + "${CMake_IFW_ROOT_COMPONENT_SCRIPT_GENERATED}") + _cmifwarg("Package <Script> tag" + FILEPATH SCRIPT "${CMake_IFW_ROOT_COMPONENT_SCRIPT_GENERATED}") +endif() +foreach(_script + CMake.Dialogs.QtGUI + CMake.Documentation.SphinxHTML + CMake.DeveloperReference.HTML) + cpack_ifw_configure_file("${CMake_SOURCE_DIR}/Source/QtIFW/${_script}.qs.in" + "${CMake_BINARY_DIR}/${_script}.qs") +endforeach() + if(NOT DEFINED CPACK_PACKAGE_FILE_NAME) # if the CPACK_PACKAGE_FILE_NAME is not defined by the cache # default to source package - system, on cygwin system is not diff --git a/CMakeCPackOptions.cmake.in b/CMakeCPackOptions.cmake.in index 99746b0..ad0c245 100644 --- a/CMakeCPackOptions.cmake.in +++ b/CMakeCPackOptions.cmake.in @@ -132,7 +132,7 @@ if(CPACK_GENERATOR MATCHES "IFW") 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") + "@CMake_BINARY_DIR@/CMake.Dialogs.QtGUI.qs") set(CPACK_IFW_COMPONENT_CMAKE-GUI_VERSION "@CMake_IFW_ROOT_COMPONENT_VERSION@") @_CPACK_IFW_COMPONENT_CMAKE-GUI_LICENSES@ diff --git a/Packaging/QtSDK/ToolsCMakeXX.cmake b/Packaging/QtSDK/ToolsCMakeXX.cmake index e227b73..c5f8f34 100644 --- a/Packaging/QtSDK/ToolsCMakeXX.cmake +++ b/Packaging/QtSDK/ToolsCMakeXX.cmake @@ -3,38 +3,29 @@ # CMake version include("${CMAKE_CURRENT_LIST_DIR}/../../Source/CMakeVersion.cmake") -set(CM_VER_XY ${CMake_VERSION_MAJOR}${CMake_VERSION_MINOR}) -set(CM_VER_X_Y ${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}) -set(CM_VER_X_Y_Z ${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}.${CMake_VERSION_PATH}) -# Destiantion -set(CM_INST_PREF "Tools/CMake/${CM_VER_X_Y}") -set(CMAKE_BIN_DIR "${CM_INST_PREF}/bin" - CACHE STRING "Location under install bin") -set(CMAKE_DATA_DIR "${CM_INST_PREF}/share/cmake-${CM_VER_X_Y}" - CACHE STRING "Location under install data") -set(CMAKE_DOC_DIR "${CM_INST_PREF}/doc/cmake-${CM_VER_X_Y}" - CACHE STRING "Location under install docs") -set(CMAKE_MAN_DIR "${CM_INST_PREF}/man" - CACHE STRING "Location under install man pages") -set(CMAKE_XDGDATA_DIR "${CM_INST_PREF}/share" - CACHE STRING "Location under install XDG specific files") +# Install destinations +set(CMake_INSTALL_INFIX "Tools/CMake/${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}/" + CACHE STRING "Location under install CMake tools") # Package set(CMake_IFW_ROOT_COMPONENT_NAME - "qt.tools.cmake.${CM_VER_XY}" + "qt.tools.cmake.${CMake_VERSION_MAJOR}${CMake_VERSION_MINOR}" CACHE STRING "QtSDK CMake tools component name") set(CMake_IFW_ROOT_COMPONENT_DISPLAY_NAME - "CMake ${CM_VER_X_Y}" + "CMake ${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}" CACHE STRING "QtSDK CMake tools component display name") set(CMake_IFW_ROOT_COMPONENT_DESCRIPTION - "CMake Build Tools ${CM_VER_X_Y_Z}" + "CMake Build Tools ${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}.${CMake_VERSION_PATH}" CACHE STRING "QtSDK CMake tools component description") -set(CMake_IFW_ROOT_COMPONENT_SCRIPT - "${CMAKE_CURRENT_BINARY_DIR}/qt.tools.cmake.${CM_VER_XY}.qs" - CACHE STRING "QtSDK CMake tools component display name") +set(CMake_IFW_ROOT_COMPONENT_SCRIPT_TEMPLATE + "${CMAKE_CURRENT_LIST_DIR}/qt.tools.cmake.xx.qs.in" + CACHE FILEPATH "QtSDK CMake tools script template") +set(CMake_IFW_ROOT_COMPONENT_SCRIPT_GENERATED + "${CMAKE_CURRENT_BINARY_DIR}/qt.tools.cmake.${CMake_VERSION_MAJOR}${CMake_VERSION_MINOR}.qs" + CACHE FILEPATH "QtSDK CMake tools script generated") set(CMake_IFW_ROOT_COMPONENT_PRIORITY - "${CM_VER_XY}" + "${CMake_VERSION_MAJOR}${CMake_VERSION_MINOR}" CACHE STRING "QtSDK CMake tools component sorting priority") set(CMake_IFW_ROOT_COMPONENT_DEFAULT "" CACHE STRING "QtSDK CMake tools component default") @@ -52,17 +43,3 @@ set(CPACK_IFW_DOWNLOAD_ALL "TRUE" CACHE STRING "All QtSDK components is downloaded") set(CPACK_DOWNLOAD_SITE "file:///${CMAKE_CURRENT_BINARY_DIR}/QtSDK/IFW/CMake/repository" CACHE STRING "Local repository for testing") - -# Script -set(SDKToolBinary "@SDKToolBinary@") -set(CM_VER_XY_DIR "@CMAKE${CM_VER_XY}_DIR@") -configure_file("${CMAKE_CURRENT_LIST_DIR}/qt.tools.cmake.xx.qs.in" - "${CMAKE_CURRENT_BINARY_DIR}/qt.tools.cmake.${CM_VER_XY}.qs" - @ONLY) - -# Unset temporary variables -unset(CM_VER_XY) -unset(CM_VER_X_Y) -unset(CM_VER_X_Y_Z) -unset(CM_INST_PREF) -unset(SDKToolBinary) diff --git a/Packaging/QtSDK/qt.tools.cmake.xx.qs.in b/Packaging/QtSDK/qt.tools.cmake.xx.qs.in index cb42a71..81ce157 100644 --- a/Packaging/QtSDK/qt.tools.cmake.xx.qs.in +++ b/Packaging/QtSDK/qt.tools.cmake.xx.qs.in @@ -9,15 +9,15 @@ function Component() { installer.valueChanged.connect( this, Component.prototype.reactOnTargetDirChange ); - // set the default values to CMAKE@CM_VER_XY@_DIR + // set the default values to CMAKE%CMake_VERSION_MAJOR%%CMake_VERSION_MINOR%_BIN_DIR Component.prototype.reactOnTargetDirChange("TargetDir", installer.value("TargetDir")); } Component.prototype.reactOnTargetDirChange = function(key, value) { if (key == "TargetDir") { - var path = value + "/@CM_INST_PREF@"; - installer.setValue("CMAKE@CM_VER_XY@_DIR", path.replace(/\\/g, "/")); + var path = value + "/%CMAKE_BIN_DIR%"; + installer.setValue("CMAKE%CMake_VERSION_MAJOR%%CMake_VERSION_MINOR%_BIN_DIR", path.replace(/\\/g, "/")); } } @@ -31,13 +31,13 @@ Component.prototype.createOperations = function() return; var cmId = component.name; - installer.setValue("CMAKE@CM_VER_XY@_ID", cmId); + installer.setValue("CMAKE%CMake_VERSION_MAJOR%%CMake_VERSION_MINOR%_ID", cmId); component.addOperation("Execute", ["{0,2}", "@SDKToolBinary@", "addCMake", "--id", cmId, - "--name", "@CMake_IFW_ROOT_COMPONENT_DISPLAY_NAME@", - "--path", "@CM_VER_XY_DIR@/bin/cmake.exe", + "--name", "%CMake_IFW_ROOT_COMPONENT_DISPLAY_NAME%", + "--path", "@CMAKE%CMake_VERSION_MAJOR%%CMake_VERSION_MINOR%_BIN_DIR@/cmake.exe", "UNDOEXECUTE", "@SDKToolBinary@", "rmCMake", "--id", cmId]); diff --git a/Source/QtIFW/CMake.DeveloperReference.HTML.qs.in b/Source/QtIFW/CMake.DeveloperReference.HTML.qs.in index e3d8554..8cc5835 100644 --- a/Source/QtIFW/CMake.DeveloperReference.HTML.qs.in +++ b/Source/QtIFW/CMake.DeveloperReference.HTML.qs.in @@ -11,8 +11,8 @@ Component.prototype.createOperations = function() if (installer.value("os") === "win") { component.addOperation("CreateShortcut", - installer.value("TargetDir") + "/@CMAKE_DOC_DIR@/developer-reference/html/index.html", - installer.value("StartMenuDir") + "/CMake Developer Reference.lnk"); + "@TargetDir@/%CMAKE_DOC_DIR%/developer-reference/html/index.html", + "@StartMenuDir@/CMake Developer Reference.lnk"); } diff --git a/Source/QtIFW/CMake.Dialogs.QtGUI.qs b/Source/QtIFW/CMake.Dialogs.QtGUI.qs.in index 219a0a9..71f395a 100644 --- a/Source/QtIFW/CMake.Dialogs.QtGUI.qs +++ b/Source/QtIFW/CMake.Dialogs.QtGUI.qs.in @@ -11,8 +11,8 @@ Component.prototype.createOperations = function() if (installer.value("os") === "win") { component.addOperation("CreateShortcut", - installer.value("TargetDir") + "/bin/cmake-gui.exe", - installer.value("StartMenuDir") + "/CMake (cmake-gui).lnk"); + "@TargetDir@/%CMAKE_BIN_DIR%/cmake-gui.exe", + "@StartMenuDir@/CMake (cmake-gui).lnk"); } diff --git a/Source/QtIFW/CMake.Documentation.SphinxHTML.qs.in b/Source/QtIFW/CMake.Documentation.SphinxHTML.qs.in index 5c929e8..54bc14a 100644 --- a/Source/QtIFW/CMake.Documentation.SphinxHTML.qs.in +++ b/Source/QtIFW/CMake.Documentation.SphinxHTML.qs.in @@ -11,8 +11,8 @@ Component.prototype.createOperations = function() if (installer.value("os") === "win") { component.addOperation("CreateShortcut", - installer.value("TargetDir") + "/@CMAKE_DOC_DIR@/html/index.html", - installer.value("StartMenuDir") + "/CMake Documentation.lnk"); + "@TargetDir@/%CMAKE_DOC_DIR%/html/index.html", + "@StartMenuDir@/CMake Documentation.lnk"); } diff --git a/Source/QtIFW/CMake.qs.in b/Source/QtIFW/CMake.qs.in index 828cc7c..1f3166e 100644 --- a/Source/QtIFW/CMake.qs.in +++ b/Source/QtIFW/CMake.qs.in @@ -1,3 +1,5 @@ +// Component: CMake + function Component() { // Default constructor @@ -9,12 +11,12 @@ Component.prototype.createOperations = function() if (installer.value("os") === "win") { component.addOperation("CreateShortcut", - installer.value("TargetDir") + "/@CMAKE_DOC_DIR@/cmake.org.html", - installer.value("StartMenuDir") + "/CMake Web Site.lnk"); + "@TargetDir@/%CMAKE_DOC_DIR%/cmake.org.html", + "@StartMenuDir@/CMake Web Site.lnk"); component.addOperation("CreateShortcut", - installer.value("TargetDir") + "/cmake-maintenance.exe", - installer.value("StartMenuDir") + "/CMake Maintenance Tool.lnk"); + "@TargetDir@/cmake-maintenance.exe", + "@StartMenuDir@/CMake Maintenance Tool.lnk"); } // Call default implementation diff --git a/Source/QtIFW/installscript.qs.in b/Source/QtIFW/installscript.qs.in index 39a8795..72d49e8 100644 --- a/Source/QtIFW/installscript.qs.in +++ b/Source/QtIFW/installscript.qs.in @@ -1,3 +1,5 @@ +// Component: CMake + function Component() { // Do not show component selection page @@ -9,15 +11,15 @@ Component.prototype.createOperations = function() // Create shortcut if (installer.value("os") === "win") { -@_CPACK_IFW_SHORTCUT_OPTIONAL@ +%_CPACK_IFW_SHORTCUT_OPTIONAL% component.addOperation("CreateShortcut", - installer.value("TargetDir") + "/@CMAKE_DOC_DIR@/cmake.org.html", - installer.value("StartMenuDir") + "/CMake Web Site.lnk"); + "@TargetDir@/%CMAKE_DOC_DIR%/cmake.org.html", + "@StartMenuDir@/CMake Web Site.lnk"); component.addOperation("CreateShortcut", - installer.value("TargetDir") + "/cmake-maintenance.exe", - installer.value("StartMenuDir") + "/CMake Maintenance Tool.lnk"); + "@TargetDir@/cmake-maintenance.exe", + "@StartMenuDir@/CMake Maintenance Tool.lnk"); } // Call default implementation |