diff options
-rw-r--r-- | Packaging/QtSDK/ToolsCMakeXX.cmake | 68 | ||||
-rw-r--r-- | Packaging/QtSDK/qt.tools.cmake.xx.qs.in | 48 |
2 files changed, 116 insertions, 0 deletions
diff --git a/Packaging/QtSDK/ToolsCMakeXX.cmake b/Packaging/QtSDK/ToolsCMakeXX.cmake new file mode 100644 index 0000000..e227b73 --- /dev/null +++ b/Packaging/QtSDK/ToolsCMakeXX.cmake @@ -0,0 +1,68 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +# 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") + +# Package +set(CMake_IFW_ROOT_COMPONENT_NAME + "qt.tools.cmake.${CM_VER_XY}" + CACHE STRING "QtSDK CMake tools component name") +set(CMake_IFW_ROOT_COMPONENT_DISPLAY_NAME + "CMake ${CM_VER_X_Y}" + CACHE STRING "QtSDK CMake tools component display name") +set(CMake_IFW_ROOT_COMPONENT_DESCRIPTION + "CMake Build Tools ${CM_VER_X_Y_Z}" + 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_PRIORITY + "${CM_VER_XY}" + CACHE STRING "QtSDK CMake tools component sorting priority") +set(CMake_IFW_ROOT_COMPONENT_DEFAULT "" + CACHE STRING "QtSDK CMake tools component default") +set(CMake_IFW_ROOT_COMPONENT_FORCED_INSTALLATION "" + CACHE STRING "QtSDK CMake tools component forsed installation") + +# CPack +set(CPACK_GENERATOR "IFW" + CACHE STRING "Generator to build QtSDK CMake package") +set(CPACK_PACKAGE_FILE_NAME "CMake" + CACHE STRING "Short package name") +set(CPACK_TOPLEVEL_TAG "../QtSDK" + CACHE STRING "QtSDK packages dir") +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 new file mode 100644 index 0000000..cb42a71 --- /dev/null +++ b/Packaging/QtSDK/qt.tools.cmake.xx.qs.in @@ -0,0 +1,48 @@ +/**************************************************************************** +** +** Distributed under the OSI-approved BSD 3-Clause License. See accompanying +** file Copyright.txt or https://cmake.org/licensing for details. +** +****************************************************************************/ + +// constructor +function Component() +{ + installer.valueChanged.connect( this, Component.prototype.reactOnTargetDirChange ); + // set the default values to CMAKE@CM_VER_XY@_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, "/")); + } +} + +Component.prototype.createOperations = function() +{ + component.createOperations(); + + if (installer.value("os") == "win") { + try { + if (installer.value("SDKToolBinary") == "") + return; + + var cmId = component.name; + installer.setValue("CMAKE@CM_VER_XY@_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", + "UNDOEXECUTE", + "@SDKToolBinary@", "rmCMake", "--id", cmId]); + + } catch( e ) { + print( e ); + } + } +} |