summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorJuha Vuolle <juha.vuolle@insta.fi>2021-04-26 14:11:22 +0300
committerJuha Vuolle <juha.vuolle@insta.fi>2021-04-26 15:06:18 +0300
commit31e909ef7e19e90a3efcfff385bb634f6c51cb96 (patch)
treee03f11ef177d2af608b0a8eaaefa347bc25403d1 /examples
parent01efff97e7491c2e0961e7ac88f77b245cc388dc (diff)
Add cmake support for two examples missing it
The grue example remains commented out, it will be addressed with a separate commit as part of the QTBUG-92514 Task-number: QTBUG-92502 Change-Id: Ieb1a61b942ac6adc6880e33478059893a9492730 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'examples')
-rw-r--r--examples/sensors/CMakeLists.txt9
-rw-r--r--examples/sensors/qmlsensorgestures/CMakeLists.txt3
-rw-r--r--examples/sensors/qmlsensorgestures/plugin/CMakeLists.txt10
-rw-r--r--examples/sensors/sensor_explorer/import/CMakeLists.txt54
4 files changed, 65 insertions, 11 deletions
diff --git a/examples/sensors/CMakeLists.txt b/examples/sensors/CMakeLists.txt
index 8112bf57..db539b53 100644
--- a/examples/sensors/CMakeLists.txt
+++ b/examples/sensors/CMakeLists.txt
@@ -1,13 +1,10 @@
-# TODO Qt 6.2 enable grue example, requires work
+# TODO Qt 6.2 enable
# add_subdirectory(grue)
-
if(TARGET Qt::Quick)
add_subdirectory(maze)
- # TODO Qt 6.2 enable qmlsensorgestures, requires work
- # add_subdirectory(qmlsensorgestures)
+ add_subdirectory(qmlsensorgestures)
add_subdirectory(qmlqtsensors)
- # TODO Qt 6.2 enable sensor_explorer, requires work
- # add_subdirectory(sensor_explorer)
+ add_subdirectory(sensor_explorer)
if (TARGET Qt::Multimedia)
add_subdirectory(shakeit)
endif()
diff --git a/examples/sensors/qmlsensorgestures/CMakeLists.txt b/examples/sensors/qmlsensorgestures/CMakeLists.txt
index a3f01f0e..ad49997f 100644
--- a/examples/sensors/qmlsensorgestures/CMakeLists.txt
+++ b/examples/sensors/qmlsensorgestures/CMakeLists.txt
@@ -18,15 +18,16 @@ find_package(Qt6 COMPONENTS Quick)
qt_add_executable(qmlsensorgestures
main.cpp
)
+
set_target_properties(qmlsensorgestures PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(qmlsensorgestures PUBLIC
Qt::Quick
)
-
# Resources:
set(qml_resource_files
"Button.qml"
diff --git a/examples/sensors/qmlsensorgestures/plugin/CMakeLists.txt b/examples/sensors/qmlsensorgestures/plugin/CMakeLists.txt
index c5831189..1617ce3d 100644
--- a/examples/sensors/qmlsensorgestures/plugin/CMakeLists.txt
+++ b/examples/sensors/qmlsensorgestures/plugin/CMakeLists.txt
@@ -13,18 +13,20 @@ endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Sensors)
+find_package(Qt6 COMPONENTS Core Gui Sensors)
-qt_add_executable(qtsensorgestures_counterplugin
+qt_add_plugin(qtsensorgestures_counterplugin)
+
+target_sources(qtsensorgestures_counterplugin PRIVATE
qcountergestureplugin.cpp qcountergestureplugin.h
qcounterrecognizer.cpp qcounterrecognizer.h
)
+
set_target_properties(qtsensorgestures_counterplugin PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(qtsensorgestures_counterplugin PUBLIC
Qt::Core
Qt::Gui
diff --git a/examples/sensors/sensor_explorer/import/CMakeLists.txt b/examples/sensors/sensor_explorer/import/CMakeLists.txt
new file mode 100644
index 00000000..57ae2040
--- /dev/null
+++ b/examples/sensors/sensor_explorer/import/CMakeLists.txt
@@ -0,0 +1,54 @@
+cmake_minimum_required(VERSION 3.14)
+project(declarative_explorer 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}/sensors/sensor_explorer/Explorer")
+
+find_package(Qt6 COMPONENTS Core Gui Qml Sensors)
+
+if (MACOS)
+ set(PLUGIN_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/../sensor_explorer.app/Contents/MacOS/Explorer")
+else()
+ set(PLUGIN_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/../Explorer")
+endif()
+
+qt6_add_qml_module(declarative_explorer
+ OUTPUT_DIRECTORY "${PLUGIN_OUTPUT_DIRECTORY}"
+ VERSION 1.0
+ URI "Explorer"
+ INSTALL_LOCATION ${INSTALL_EXAMPLEDIR}
+)
+
+target_sources(declarative_explorer PRIVATE
+ explorer.cpp explorer.h
+ main.cpp main.h
+ propertyinfo.cpp propertyinfo.h
+ sensoritem.cpp sensoritem.h
+)
+
+set_target_properties(declarative_explorer PROPERTIES
+ WIN32_EXECUTABLE TRUE
+ MACOSX_BUNDLE TRUE
+)
+
+target_link_libraries(declarative_explorer PUBLIC
+ Qt::Core
+ Qt::Gui
+ Qt::Qml
+ Qt::Sensors
+)
+
+install(TARGETS declarative_explorer
+ RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
+ BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
+ LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
+)