diff options
author | Lorn Potter <lorn.potter@gmail.com> | 2021-01-06 07:30:03 +1000 |
---|---|---|
committer | Juha Vuolle <juha.vuolle@insta.fi> | 2021-04-19 13:29:47 +0300 |
commit | 45c8ae3232df8955644697ee88c4321f26bb5cf2 (patch) | |
tree | 77edea26c249ce6bb8a921fe67c266d3c95e094a /examples | |
parent | 5a8aa096dc61336ac95734e8cc61f106e359c865 (diff) | |
download | qtsensors-45c8ae3232df8955644697ee88c4321f26bb5cf2.tar.gz |
QtSensors initial cmake support
This commit introduces the bare minimum cmake support that should
unblock the CI and allow further verification and development on most
platforms: macOS, Linux, Win, iOS and Android.
Some clarifications:
* The support for sensorfw backend is very preliminary and can
be enabled later if needed (no Qt6 version of the sensorfw).
* The simulator backend is dropped as obsolete / unnecessary.
* Three examples are currently commented out and shall be ported with
a later commit.
Task-number: QTBUG-92502
Change-Id: Id523d43ed3ef177010dc73afc5812ed374cff0dd
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'examples')
-rw-r--r-- | examples/CMakeLists.txt | 5 | ||||
-rw-r--r-- | examples/sensors/CMakeLists.txt | 20 | ||||
-rw-r--r-- | examples/sensors/accelbubble/CMakeLists.txt | 52 | ||||
-rw-r--r-- | examples/sensors/grue/CMakeLists.txt | 56 | ||||
-rw-r--r-- | examples/sensors/grue/console_app/CMakeLists.txt | 36 | ||||
-rw-r--r-- | examples/sensors/grue/import/import.pro | 1 | ||||
-rw-r--r-- | examples/sensors/grue/lib/CMakeLists.txt | 38 | ||||
-rw-r--r-- | examples/sensors/grue/plugin/CMakeLists.txt | 56 | ||||
-rw-r--r-- | examples/sensors/maze/CMakeLists.txt | 65 | ||||
-rw-r--r-- | examples/sensors/qmlqtsensors/CMakeLists.txt | 54 | ||||
-rw-r--r-- | examples/sensors/qmlsensorgestures/CMakeLists.txt | 51 | ||||
-rw-r--r-- | examples/sensors/qmlsensorgestures/plugin/CMakeLists.txt | 38 | ||||
-rw-r--r-- | examples/sensors/sensor_explorer/CMakeLists.txt | 54 | ||||
-rw-r--r-- | examples/sensors/sensor_explorer/import/import.pro | 1 | ||||
-rw-r--r-- | examples/sensors/sensorgestures/CMakeLists.txt | 37 | ||||
-rw-r--r-- | examples/sensors/shakeit/CMakeLists.txt | 53 |
16 files changed, 617 insertions, 0 deletions
diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt new file mode 100644 index 0000000..b2d7229 --- /dev/null +++ b/examples/CMakeLists.txt @@ -0,0 +1,5 @@ +qt_examples_build_begin() + +add_subdirectory(sensors) + +qt_examples_build_end() diff --git a/examples/sensors/CMakeLists.txt b/examples/sensors/CMakeLists.txt new file mode 100644 index 0000000..8112bf5 --- /dev/null +++ b/examples/sensors/CMakeLists.txt @@ -0,0 +1,20 @@ +# TODO Qt 6.2 enable grue example, requires work +# add_subdirectory(grue) + +if(TARGET Qt::Quick) + add_subdirectory(maze) + # TODO Qt 6.2 enable qmlsensorgestures, requires work + # add_subdirectory(qmlsensorgestures) + add_subdirectory(qmlqtsensors) + # TODO Qt 6.2 enable sensor_explorer, requires work + # add_subdirectory(sensor_explorer) + if (TARGET Qt::Multimedia) + add_subdirectory(shakeit) + endif() + if(TARGET Qt::Svg) + add_subdirectory(accelbubble) + endif() +endif() +if(TARGET Qt::Widgets) + add_subdirectory(sensorgestures) +endif() diff --git a/examples/sensors/accelbubble/CMakeLists.txt b/examples/sensors/accelbubble/CMakeLists.txt new file mode 100644 index 0000000..8d75293 --- /dev/null +++ b/examples/sensors/accelbubble/CMakeLists.txt @@ -0,0 +1,52 @@ +cmake_minimum_required(VERSION 3.14) +project(accelbubble 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/accelbubble") + +find_package(Qt6 COMPONENTS Core Gui Quick Sensors Svg Xml) + +qt_add_executable(accelbubble + main.cpp +) +set_target_properties(accelbubble PROPERTIES + WIN32_EXECUTABLE TRUE + MACOSX_BUNDLE TRUE +) +target_link_libraries(accelbubble PUBLIC + Qt::Core + Qt::Gui + Qt::Quick + Qt::Sensors + Qt::Svg + Qt::Xml +) + + +# Resources: +set(accelbubble_resource_files + "accelbubble.qml" + "content/Bluebubble.svg" +) + +qt6_add_resources(accelbubble "accelbubble" + PREFIX + "/" + FILES + ${accelbubble_resource_files} +) + +install(TARGETS accelbubble + RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" + BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" + LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" +) diff --git a/examples/sensors/grue/CMakeLists.txt b/examples/sensors/grue/CMakeLists.txt new file mode 100644 index 0000000..043330d --- /dev/null +++ b/examples/sensors/grue/CMakeLists.txt @@ -0,0 +1,56 @@ +cmake_minimum_required(VERSION 3.14) +project(grue_app 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/grue") + +find_package(Qt6 COMPONENTS Quick) + +qt_add_executable(grue_app + main.cpp +) +set_target_properties(grue_app PROPERTIES + WIN32_EXECUTABLE TRUE + MACOSX_BUNDLE TRUE +) + +if(TARGET Qt::Quick) + target_link_libraries(grue_app PUBLIC + Qt::Quick + ) +endif() + +# Resources: +set(qml_resource_files + "grue.png" + "grue.qml" +) + +qt6_add_resources(grue_app "qml" + PREFIX + "/" + FILES + ${qml_resource_files} +) + +install(TARGETS grue_app + RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" + BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" + LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" +) + +add_subdirectory(lib) +add_subdirectory(plugin) +add_subdirectory(console_app) +if(TARGET Qt::Quick) + add_subdirectory(import) +endif() diff --git a/examples/sensors/grue/console_app/CMakeLists.txt b/examples/sensors/grue/console_app/CMakeLists.txt new file mode 100644 index 0000000..e6364e4 --- /dev/null +++ b/examples/sensors/grue/console_app/CMakeLists.txt @@ -0,0 +1,36 @@ +# Generated from console_app.pro. + +cmake_minimum_required(VERSION 3.14) +project(detect_grue 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/grue") + +find_package(Qt6 COMPONENTS Core Sensors) + +qt_add_executable(detect_grue + main.cpp +) +set_target_properties(detect_grue PROPERTIES + WIN32_EXECUTABLE FALSE + MACOSX_BUNDLE FALSE +) +target_link_libraries(detect_grue PUBLIC + Qt::Core + Qt::Sensors +) + +install(TARGETS detect_grue + RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" + BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" + LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" +) diff --git a/examples/sensors/grue/import/import.pro b/examples/sensors/grue/import/import.pro index 17d7713..f9d5108 100644 --- a/examples/sensors/grue/import/import.pro +++ b/examples/sensors/grue/import/import.pro @@ -1,5 +1,6 @@ TEMPLATE = lib CONFIG += plugin +QML_IMPORT_VERSION = $$QT_VERSION TARGET = $$qtLibraryTarget(declarative_grue) diff --git a/examples/sensors/grue/lib/CMakeLists.txt b/examples/sensors/grue/lib/CMakeLists.txt new file mode 100644 index 0000000..264ffd3 --- /dev/null +++ b/examples/sensors/grue/lib/CMakeLists.txt @@ -0,0 +1,38 @@ +cmake_minimum_required(VERSION 3.14) +project(gruesensor 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/grue") + +find_package(Qt6 COMPONENTS Core Sensors) + +qt_add_executable(gruesensor + gruesensor.cpp gruesensor.h gruesensor_p.h +) +set_target_properties(gruesensor PROPERTIES + WIN32_EXECUTABLE TRUE + MACOSX_BUNDLE TRUE +) +target_compile_definitions(gruesensor PUBLIC + QT_BUILD_GRUE_LIB +) + +target_link_libraries(gruesensor PUBLIC + Qt::Core + Qt::Sensors +) + +install(TARGETS gruesensor + RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" + BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" + LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" +) diff --git a/examples/sensors/grue/plugin/CMakeLists.txt b/examples/sensors/grue/plugin/CMakeLists.txt new file mode 100644 index 0000000..d55cc2d --- /dev/null +++ b/examples/sensors/grue/plugin/CMakeLists.txt @@ -0,0 +1,56 @@ +# Generated from plugin.pro. + +cmake_minimum_required(VERSION 3.14) +project(qtsensors_grue 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/grue/sensors") + +find_package(Qt6 COMPONENTS Core) +find_package(Qt6 COMPONENTS Sensors) + +qt_add_plugin(qtsensors_grue) +target_sources(qtsensors_grue PRIVATE + gruesensorimpl.cpp gruesensorimpl.h + main.cpp +) +set_target_properties(qtsensors_grue PROPERTIES + WIN32_EXECUTABLE TRUE + MACOSX_BUNDLE TRUE +) +target_include_directories(qtsensors_grue PUBLIC + ../lib +) + +target_link_libraries(qtsensors_grue PUBLIC + Qt::Core + Qt::Sensors + gruesensor +) + +if(MACOS) + target_link_libraries(qtsensors_grue PUBLIC + # Remove: L${CMAKE_CURRENT_BINARY_DIR}/../grue_app.app/Contents/Frameworks + ) +endif() + +if(NOT MACOS) + target_link_libraries(qtsensors_grue PUBLIC + # Remove: L${CMAKE_CURRENT_BINARY_DIR}/.. + ) +endif() + +install(TARGETS qtsensors_grue + RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" + BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" + LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" +) diff --git a/examples/sensors/maze/CMakeLists.txt b/examples/sensors/maze/CMakeLists.txt new file mode 100644 index 0000000..a2c484a --- /dev/null +++ b/examples/sensors/maze/CMakeLists.txt @@ -0,0 +1,65 @@ +cmake_minimum_required(VERSION 3.14) +project(maze 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/maze") + +find_package(Qt6 COMPONENTS Core Gui Quick Sensors) + +qt_add_executable(maze + main.cpp +) +set_target_properties(maze PROPERTIES + WIN32_EXECUTABLE TRUE + MACOSX_BUNDLE TRUE +) +target_link_libraries(maze PUBLIC + Qt::Core + Qt::Gui + Qt::Quick + Qt::Sensors +) + + +# Resources: +set(maze_resource_files + "Congratulation.qml" + "LabyrinthSquare.qml" + "Mouse.qml" + "components/ApplicationWindow.qml" + "components/Button.qml" + "components/images/button_background_disabled.png" + "components/images/button_background_normal.png" + "components/images/button_background_pressed.png" + "content/00.png" + "content/01.png" + "content/cheese.png" + "content/cheeseeating.gif" + "content/congratulations.gif" + "content/mouse_down.gif" + "content/start.png" + "lib.js" + "maze.qml" +) + +qt6_add_resources(maze "maze" + PREFIX + "/" + FILES + ${maze_resource_files} +) + +install(TARGETS maze + RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" + BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" + LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" +) diff --git a/examples/sensors/qmlqtsensors/CMakeLists.txt b/examples/sensors/qmlqtsensors/CMakeLists.txt new file mode 100644 index 0000000..ab74343 --- /dev/null +++ b/examples/sensors/qmlqtsensors/CMakeLists.txt @@ -0,0 +1,54 @@ +cmake_minimum_required(VERSION 3.14) +project(qmlqtsensors 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/qmlqtsensors") + +find_package(Qt6 COMPONENTS Core Gui Quick) + +qt_add_executable(qmlqtsensors + main.cpp +) +set_target_properties(qmlqtsensors PROPERTIES + WIN32_EXECUTABLE TRUE + MACOSX_BUNDLE TRUE +) +target_link_libraries(qmlqtsensors PUBLIC + Qt::Core + Qt::Gui + Qt::Quick +) + + +# Resources: +set(qmlqtsensors_resource_files + "components/ApplicationWindow.qml" + "components/Button.qml" + "components/Divider.qml" + "components/images/button_background_disabled.png" + "components/images/button_background_normal.png" + "components/images/button_background_pressed.png" + "qmlqtsensors.qml" +) + +qt6_add_resources(qmlqtsensors "qmlqtsensors" + PREFIX + "/" + FILES + ${qmlqtsensors_resource_files} +) + +install(TARGETS qmlqtsensors + RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" + BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" + LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" +) diff --git a/examples/sensors/qmlsensorgestures/CMakeLists.txt b/examples/sensors/qmlsensorgestures/CMakeLists.txt new file mode 100644 index 0000000..a3f01f0 --- /dev/null +++ b/examples/sensors/qmlsensorgestures/CMakeLists.txt @@ -0,0 +1,51 @@ +cmake_minimum_required(VERSION 3.14) +project(qmlsensorgestures 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/qmlsensorgestures") + +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" + "GestureList.qml" + "GestureView.qml" + "GesturesView.qml" + "qmlsensorgestures.qml" +) + +qt6_add_resources(qmlsensorgestures "qml" + PREFIX + "/" + FILES + ${qml_resource_files} +) + +install(TARGETS qmlsensorgestures + RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" + BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" + LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" +) +add_subdirectory(plugin) diff --git a/examples/sensors/qmlsensorgestures/plugin/CMakeLists.txt b/examples/sensors/qmlsensorgestures/plugin/CMakeLists.txt new file mode 100644 index 0000000..c583118 --- /dev/null +++ b/examples/sensors/qmlsensorgestures/plugin/CMakeLists.txt @@ -0,0 +1,38 @@ +cmake_minimum_required(VERSION 3.14) +project(qtsensorgestures_counterplugin 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}") + +find_package(Qt6 COMPONENTS Core) +find_package(Qt6 COMPONENTS Gui) +find_package(Qt6 COMPONENTS Sensors) + +qt_add_executable(qtsensorgestures_counterplugin + 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 + Qt::Sensors +) + +install(TARGETS qtsensorgestures_counterplugin + RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" + BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" + LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" +) diff --git a/examples/sensors/sensor_explorer/CMakeLists.txt b/examples/sensors/sensor_explorer/CMakeLists.txt new file mode 100644 index 0000000..3440f79 --- /dev/null +++ b/examples/sensors/sensor_explorer/CMakeLists.txt @@ -0,0 +1,54 @@ +cmake_minimum_required(VERSION 3.14) +project(sensor_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") + +find_package(Qt6 COMPONENTS Qml Quick) + +qt_add_executable(sensor_explorer + main.cpp +) +set_target_properties(sensor_explorer PROPERTIES + WIN32_EXECUTABLE TRUE + MACOSX_BUNDLE TRUE +) +target_link_libraries(sensor_explorer PUBLIC + Qt::Qml + Qt::Quick +) + + +# Resources: +set(qml_resource_files + "sensor_explorer.qml" +) + +qt6_add_resources(sensor_explorer "qml" + PREFIX + "/" + FILES + ${qml_resource_files} +) + +if(TARGET Qt::Widgets) + target_link_libraries(sensor_explorer PUBLIC + Qt::Widgets + ) +endif() + +install(TARGETS sensor_explorer + RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" + BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" + LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" +) +add_subdirectory(import) diff --git a/examples/sensors/sensor_explorer/import/import.pro b/examples/sensors/sensor_explorer/import/import.pro index 4850921..53bf224 100644 --- a/examples/sensors/sensor_explorer/import/import.pro +++ b/examples/sensors/sensor_explorer/import/import.pro @@ -1,5 +1,6 @@ TEMPLATE = lib CONFIG += plugin +QML_IMPORT_VERSION = $$QT_VERSION TARGET = $$qtLibraryTarget(declarative_explorer) diff --git a/examples/sensors/sensorgestures/CMakeLists.txt b/examples/sensors/sensorgestures/CMakeLists.txt new file mode 100644 index 0000000..a80f70f --- /dev/null +++ b/examples/sensors/sensorgestures/CMakeLists.txt @@ -0,0 +1,37 @@ +cmake_minimum_required(VERSION 3.14) +project(gesture 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/sensorgestures") + +find_package(Qt6 COMPONENTS Core Gui Sensors Widgets) + +qt_add_executable(gesture + main.cpp + mainwindow.cpp mainwindow.h mainwindow.ui +) +set_target_properties(gesture PROPERTIES + WIN32_EXECUTABLE TRUE + MACOSX_BUNDLE TRUE +) +target_link_libraries(gesture PUBLIC + Qt::Core + Qt::Gui + Qt::Sensors + Qt::Widgets +) + +install(TARGETS gesture + RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" + BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" + LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" +) diff --git a/examples/sensors/shakeit/CMakeLists.txt b/examples/sensors/shakeit/CMakeLists.txt new file mode 100644 index 0000000..aaacd2f --- /dev/null +++ b/examples/sensors/shakeit/CMakeLists.txt @@ -0,0 +1,53 @@ +cmake_minimum_required(VERSION 3.14) +project(shakeit 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/shakeit") + +find_package(Qt6 COMPONENTS Core Gui Quick) + +qt_add_executable(shakeit + main.cpp +) +set_target_properties(shakeit PROPERTIES + WIN32_EXECUTABLE TRUE + MACOSX_BUNDLE TRUE +) +target_link_libraries(shakeit PUBLIC + Qt::Core + Qt::Gui + Qt::Quick +) + + +# Resources: +set(shakeit_resource_files + "audio/loopy2a_mono.wav" + "audio/phone.wav" + "content/triangle.png" + "content/triangle2.png" + "content/triangle3.png" + "shakeit.qml" +) + +qt6_add_resources(shakeit "shakeit" + PREFIX + "/" + FILES + ${shakeit_resource_files} +) + +install(TARGETS shakeit + RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" + BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" + LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" +) |