Commit 49717993 authored by Konstantin Podsvirov's avatar Konstantin Podsvirov

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.
parent 728820f3
Pipeline #42333 passed with stage
......@@ -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
......
......@@ -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@
......
......@@ -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)
......@@ -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]);
......
......@@ -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");
}
......
......@@ -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");
}
......
......@@ -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");
}
......
// 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
......
// 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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment