aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVenugopal Shivashankar <Venugopal.Shivashankar@qt.io>2020-12-18 12:03:26 +0100
committerVenugopal Shivashankar <Venugopal.Shivashankar@qt.io>2021-01-07 12:33:24 +0100
commit6af3204a9b4352909489200f619198c6f3e9540f (patch)
treef9a54f646c05bc1c852881006c5c35131af0a86c
parent7739d330d46fd26948a1158a0f33077c82d0912e (diff)
Add CMake port based on the qmake setup
Change-Id: I47e7972bd2853608239a831586ba304573a7aef5 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
-rw-r--r--.cmake.conf1
-rw-r--r--CMakeLists.txt24
-rw-r--r--examples/CMakeLists.txt7
-rw-r--r--examples/treeview/CMakeLists.txt6
-rw-r--r--examples/treeview/customdelegate/CMakeLists.txt62
-rw-r--r--examples/treeview/standard/CMakeLists.txt56
-rw-r--r--src/CMakeLists.txt48
-rw-r--r--tests/CMakeLists.txt7
-rw-r--r--tests/auto/CMakeLists.txt14
9 files changed, 225 insertions, 0 deletions
diff --git a/.cmake.conf b/.cmake.conf
new file mode 100644
index 0000000..9305480
--- /dev/null
+++ b/.cmake.conf
@@ -0,0 +1 @@
+set(QT_REPO_MODULE_VERSION "6.0.0")
diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644
index 0000000..4964f28
--- /dev/null
+++ b/CMakeLists.txt
@@ -0,0 +1,24 @@
+# Generated from treeview.pro.
+
+cmake_minimum_required(VERSION 3.15.0)
+
+include(.cmake.conf)
+project(QtTreeView
+ VERSION "${QT_REPO_MODULE_VERSION}"
+ DESCRIPTION "Qt Quick Treeview plugin"
+ HOMEPAGE_URL "https://marketplace.qt.io/products/treeview"
+ LANGUAGES CXX C
+)
+
+find_package(Qt6 ${PROJECT_VERSION} CONFIG REQUIRED COMPONENTS BuildInternals Core Quick QuickControls2)
+find_package(Qt6 ${PROJECT_VERSION} CONFIG OPTIONAL_COMPONENTS Widgets)
+
+if(NOT TARGET Qt::Quick)
+ message(NOTICE "Skipping the build as the condition \"TARGET Qt::Quick\" is not met.")
+ return()
+endif()
+if(NOT TARGET Qt::QuickControls2)
+ message(NOTICE "Skipping the build as the condition \"TARGET Qt::QuickControls2\" is not met.")
+ return()
+endif()
+qt_build_repo()
diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt
new file mode 100644
index 0000000..e436a38
--- /dev/null
+++ b/examples/CMakeLists.txt
@@ -0,0 +1,7 @@
+# Generated from examples.pro.
+
+qt_examples_build_begin()
+
+add_subdirectory(treeview)
+
+qt_examples_build_end()
diff --git a/examples/treeview/CMakeLists.txt b/examples/treeview/CMakeLists.txt
new file mode 100644
index 0000000..cb87889
--- /dev/null
+++ b/examples/treeview/CMakeLists.txt
@@ -0,0 +1,6 @@
+# Generated from treeview.pro.
+
+if (TARGET Qt6::Widgets)
+ add_subdirectory(standard)
+endif()
+add_subdirectory(customdelegate)
diff --git a/examples/treeview/customdelegate/CMakeLists.txt b/examples/treeview/customdelegate/CMakeLists.txt
new file mode 100644
index 0000000..4604e63
--- /dev/null
+++ b/examples/treeview/customdelegate/CMakeLists.txt
@@ -0,0 +1,62 @@
+# Generated from customdelegate.pro.
+
+cmake_minimum_required(VERSION 3.14)
+project(customdelegate LANGUAGES CXX)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(CMAKE_AUTOMOC ON)
+set(CMAKE_AUTORCC ON)
+set(CMAKE_AUTOUIC ON)
+
+if(NOT DEFINED INSTALL_EXAMPLESDIR)
+ set(INSTALL_EXAMPLESDIR "examples")
+endif()
+
+set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/treeview/customdelegate")
+
+find_package(Qt6 COMPONENTS Core)
+find_package(Qt6 COMPONENTS Gui)
+find_package(Qt6 COMPONENTS Qml)
+find_package(Qt6 COMPONENTS Quick)
+find_package(Qt6 COMPONENTS Widgets)
+find_package(Qt6 COMPONENTS QuickControls2)
+
+qt_add_executable(customdelegate
+ main.cpp
+)
+set_target_properties(customdelegate PROPERTIES
+ WIN32_EXECUTABLE TRUE
+ MACOSX_BUNDLE TRUE
+)
+target_link_libraries(customdelegate PUBLIC
+ Qt::Core
+ Qt::Gui
+ Qt::Qml
+ Qt::Quick
+ Qt::QuickControls2
+ Qt::Widgets
+)
+
+
+# Resources:
+set(qmake_immediate_resource_files
+ "CustomTreeView.qml"
+ "file.png"
+ "folderclosed.png"
+ "folderopen.png"
+ "main.qml"
+)
+
+qt6_add_resources(customdelegate "qmake_immediate"
+ PREFIX
+ "/"
+ FILES
+ ${qmake_immediate_resource_files}
+)
+
+install(TARGETS customdelegate
+ RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
+ BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
+ LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
+)
diff --git a/examples/treeview/standard/CMakeLists.txt b/examples/treeview/standard/CMakeLists.txt
new file mode 100644
index 0000000..f38857b
--- /dev/null
+++ b/examples/treeview/standard/CMakeLists.txt
@@ -0,0 +1,56 @@
+# Generated from standard.pro.
+
+cmake_minimum_required(VERSION 3.14)
+project(standard LANGUAGES CXX)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(CMAKE_AUTOMOC ON)
+set(CMAKE_AUTORCC ON)
+set(CMAKE_AUTOUIC ON)
+
+if(NOT DEFINED INSTALL_EXAMPLESDIR)
+ set(INSTALL_EXAMPLESDIR "examples")
+endif()
+
+set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/treeview/standard")
+
+find_package(Qt6 COMPONENTS Core)
+find_package(Qt6 COMPONENTS Gui)
+find_package(Qt6 COMPONENTS Qml)
+find_package(Qt6 COMPONENTS Quick)
+find_package(Qt6 COMPONENTS Widgets)
+
+qt_add_executable(standard
+ main.cpp
+)
+set_target_properties(standard PROPERTIES
+ WIN32_EXECUTABLE TRUE
+ MACOSX_BUNDLE TRUE
+)
+target_link_libraries(standard PUBLIC
+ Qt::Core
+ Qt::Gui
+ Qt::Qml
+ Qt::Quick
+ Qt::Widgets
+)
+
+
+# Resources:
+set(qmake_immediate_resource_files
+ "main.qml"
+)
+
+qt6_add_resources(standard "qmake_immediate"
+ PREFIX
+ "/"
+ FILES
+ ${qmake_immediate_resource_files}
+)
+
+install(TARGETS standard
+ RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
+ BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
+ LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
+)
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
new file mode 100644
index 0000000..9944136
--- /dev/null
+++ b/src/CMakeLists.txt
@@ -0,0 +1,48 @@
+# Generated from src.pro.
+
+#####################################################################
+## qquicktreeviewplugin Plugin:
+#####################################################################
+
+qt_add_qml_module(qquicktreeviewplugin
+ URI "QtQuick.TreeView"
+ VERSION "2.0"
+ CLASSNAME QQuickTreeViewPlugin
+ GENERATE_QMLTYPES
+ INSTALL_QMLTYPES
+ SOURCES
+ qquicktreemodeladaptor.cpp qquicktreemodeladaptor_p.h
+ qquicktreeview.cpp qquicktreeview_p.h
+ qquicktreeview_p_p.h
+ qquicktreeviewplugin.cpp
+ PUBLIC_LIBRARIES
+ Qt::Core
+ Qt::Gui
+ Qt::Qml
+ Qt::Quick
+ Qt::QuickPrivate
+)
+
+#### Keys ignored in scope 1:.:.:src.pro:<TRUE>:
+# OTHER_FILES = "qmldir" "$$QML_FILES" "../README.md" "../Marketplace.md" "../Marketplace.json"
+# QML_FILES = "TreeView.qml"
+# QML_IMPORT_MAJOR_VERSION = "2"
+# QML_IMPORT_NAME = "QtQuick.TreeView"
+# TARGETPATH = "QtQuick/TreeView"
+# TEMPLATE = "lib"
+
+set(qml_files
+ "TreeView.qml"
+)
+set_source_files_properties(TreeView.qml PROPERTIES
+ QT_QML_SOURCE_VERSION "2.15"
+)
+
+qt6_target_qml_files(qquicktreeviewplugin
+ FILES
+ ${qml_files}
+)
+qt_add_docs(qquicktreeviewplugin
+ doc/treeview.qdocconf
+)
+
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
new file mode 100644
index 0000000..2214137
--- /dev/null
+++ b/tests/CMakeLists.txt
@@ -0,0 +1,7 @@
+# Generated from tests.pro.
+
+if(QT_BUILD_STANDALONE_TESTS)
+ # Add qt_find_package calls for extra dependencies that need to be found when building
+ # the standalone tests here.
+endif()
+qt_build_tests()
diff --git a/tests/auto/CMakeLists.txt b/tests/auto/CMakeLists.txt
new file mode 100644
index 0000000..93850ca
--- /dev/null
+++ b/tests/auto/CMakeLists.txt
@@ -0,0 +1,14 @@
+# Generated from auto.pro.
+
+#####################################################################
+## tst_treeview Test:
+#####################################################################
+
+qt_add_test(tst_treeview
+ SOURCES
+ tst_treeview.cpp
+ PUBLIC_LIBRARIES
+ Qt::Gui
+ Qt::Qml
+ Qt::Quick
+)