diff options
author | Shawn Rutledge <shawn.rutledge@qt.io> | 2023-05-24 22:03:37 +0200 |
---|---|---|
committer | Shawn Rutledge <shawn.rutledge@qt.io> | 2023-06-01 09:20:00 +0000 |
commit | 8d1bcf9eb29cb0a6dd8422a0e6b55bfecce0d170 (patch) | |
tree | ab2aff69f59453e6d9be76bf14c24dea74894438 /imports | |
parent | 4f27c8a046ca549a9d83f6f4a193df76711a4daa (diff) |
Convert to cmake
There are two modules: one to generate traces at runtime, and one
containing components used in the generated QML, needed to view the
traces. We use add_subdirectory; there is some redundancy between the
CMakeLists.txt in the subdirectories, but they are difficult to combine
because of the use of per-module variables like module_dir, module_uri
and module_version.
We use PLUGIN_TARGET to get the backing code linked into the plugins (as
was normal in Qt 5): Qt.labs.UmlQuick.Trace is a development-oriented
module, generally used with temporarily-instrumented QML files, not
meant for application deployment. Generated QML traces are generally
viewed with the qml tool, so again it doesn't seem beneficial to have
Qt.labs.UmlQuick.Sequence available in a separate backing library.
Task-number: QTBUG-111946
Change-Id: Ia0f0b3bd43f64d0e0cfc67dd1e93165626a8c28b
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Diffstat (limited to 'imports')
-rw-r--r-- | imports/CMakeLists.txt | 83 | ||||
-rw-r--r-- | imports/UmlQuick/Sequence/qmldir | 6 | ||||
-rw-r--r-- | imports/UmlQuick/UmlQuick.pro | 12 | ||||
-rw-r--r-- | imports/imports.pro | 2 |
4 files changed, 83 insertions, 20 deletions
diff --git a/imports/CMakeLists.txt b/imports/CMakeLists.txt new file mode 100644 index 0000000..bdc79b2 --- /dev/null +++ b/imports/CMakeLists.txt @@ -0,0 +1,83 @@ +cmake_minimum_required(VERSION 3.16) +project(sequencecomponents VERSION 1.0 LANGUAGES CXX) + +find_package(Qt6 REQUIRED COMPONENTS Core Gui Qml Quick) +qt_policy(SET QTP0001 NEW) +qt_standard_project_setup(REQUIRES 6.2) + +set(CMAKE_AUTOMOC ON) + +qt_add_qml_module(sequencecomponents + URI Qt.labs.UmlQuick.Sequence + PLUGIN_TARGET sequencecomponents + OUTPUT_DIRECTORY Qt/labs/UmlQuick/Sequence + VERSION 1.0 + QML_FILES + UmlQuick/Sequence/MessageRepeated.qml + UmlQuick/Sequence/Message.qml + UmlQuick/Sequence/Return.qml + UmlQuick/Sequence/ObjectInstance.qml + UmlQuick/Sequence/UmlSequenceDiagram.qml + RESOURCES + UmlQuick/common/images/vdash5.png + UmlQuick/common/images/hdash5.png +) + +qt_query_qml_module(sequencecomponents + URI module_uri + VERSION module_version + PLUGIN_TARGET module_plugin_target + TARGET_PATH module_target_path + QMLDIR module_qmldir + TYPEINFO module_typeinfo + QML_FILES module_qml_files + QML_FILES_DEPLOY_PATHS qml_files_deploy_paths + RESOURCES module_resources + RESOURCES_DEPLOY_PATHS resources_deploy_paths +) + +cmake_path(APPEND qtlibdir "${QT6_INSTALL_PREFIX}" "${QT6_INSTALL_LIBS}") +cmake_path(APPEND qtbindir "${QT6_INSTALL_PREFIX}" "${QT6_INSTALL_BINS}") +cmake_path(APPEND qtqmldir "${QT6_INSTALL_PREFIX}" "${QT6_INSTALL_QML}") + +cmake_path(APPEND module_dir "${qtqmldir}" "${module_target_path}") + +# Install the QML module backing library +install(TARGETS sequencecomponents + ARCHIVE DESTINATION "${qtlibdir}" + LIBRARY DESTINATION "${module_dir}" + RUNTIME DESTINATION "${qtbindir}" +) + +message(STATUS "===> ${module_uri} ${module_version} installed to ${module_dir}") +message(STATUS " ${qml_files_deploy_paths}") + +# allow the installed plugin to find its backing library +cmake_path(SET plugin2backinglibpath ${qtlibdir}) +cmake_path(RELATIVE_PATH plugin2backinglibpath BASE_DIRECTORY ${module_dir}) +set_property( + TARGET "${module_plugin_target}" + APPEND PROPERTY INSTALL_RPATH "\${ORIGIN}/${plugin2backinglibpath}" +) + +# Install the QML module runtime loadable plugin +install(TARGETS "${module_plugin_target}" + LIBRARY DESTINATION "${module_dir}" + RUNTIME DESTINATION "${module_dir}" +) + +# Install the QML module meta information. +install(FILES "${module_qmldir}" DESTINATION "${module_dir}") +install(FILES "${module_typeinfo}" DESTINATION "${module_dir}") + +# Install QML files, possibly renamed. +foreach(src_file deploy_path IN ZIP_LISTS qml_files_deploy_paths qml_files_deploy_paths) + get_filename_component(dst_name "${deploy_path}" NAME) + install(FILES "${src_file}" DESTINATION "${module_dir}" RENAME "${dst_name}") +endforeach() + +# Install resources, possibly renamed. +foreach(src_file deploy_path IN ZIP_LISTS module_resources resources_deploy_paths) + get_filename_component(dst_name "${deploy_path}" NAME) + install(FILES "${src_file}" DESTINATION "${module_dir}" RENAME "${dst_name}") +endforeach() diff --git a/imports/UmlQuick/Sequence/qmldir b/imports/UmlQuick/Sequence/qmldir deleted file mode 100644 index 72dd5a2..0000000 --- a/imports/UmlQuick/Sequence/qmldir +++ /dev/null @@ -1,6 +0,0 @@ -UmlSequenceDiagram 1.0 UmlSequenceDiagram.qml -ObjectInstance 1.0 ObjectInstance.qml -Message 1.0 Message.qml -MessageRepeated 1.0 MessageRepeated.qml -Return 1.0 Return.qml - diff --git a/imports/UmlQuick/UmlQuick.pro b/imports/UmlQuick/UmlQuick.pro deleted file mode 100644 index 5c6ff7b..0000000 --- a/imports/UmlQuick/UmlQuick.pro +++ /dev/null @@ -1,12 +0,0 @@ -TEMPLATE = aux -TARGETPATH = Qt/labs -IMPORT_VERSION = 1.0 - -sequence.files = Sequence/*.qml Sequence/qmldir -sequence.path = $$[QT_INSTALL_QML]/$$TARGETPATH/UmlQuick/Sequence/ - -images.files = common/images/* -images.path = $$[QT_INSTALL_QML]/$$TARGETPATH/UmlQuick/common/images/ - -OTHER_FILES += Sequence/*.qml -INSTALLS += images sequence diff --git a/imports/imports.pro b/imports/imports.pro deleted file mode 100644 index 6ef674c..0000000 --- a/imports/imports.pro +++ /dev/null @@ -1,2 +0,0 @@ -TEMPLATE = subdirs -SUBDIRS = UmlQuick |