diff options
Diffstat (limited to 'examples/sensors/grue/plugin/CMakeLists.txt')
-rw-r--r-- | examples/sensors/grue/plugin/CMakeLists.txt | 40 |
1 files changed, 26 insertions, 14 deletions
diff --git a/examples/sensors/grue/plugin/CMakeLists.txt b/examples/sensors/grue/plugin/CMakeLists.txt index d55cc2dc..e8a016e6 100644 --- a/examples/sensors/grue/plugin/CMakeLists.txt +++ b/examples/sensors/grue/plugin/CMakeLists.txt @@ -18,35 +18,47 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/sensors/grue/sensors") find_package(Qt6 COMPONENTS Core) find_package(Qt6 COMPONENTS Sensors) -qt_add_plugin(qtsensors_grue) +qt_add_plugin(qtsensors_grue + PLUGIN_TYPE sensors +) + target_sources(qtsensors_grue PRIVATE gruesensorimpl.cpp gruesensorimpl.h + gruesensor.cpp gruesensor.h gruesensor_p.h main.cpp ) + set_target_properties(qtsensors_grue PROPERTIES WIN32_EXECUTABLE TRUE MACOSX_BUNDLE TRUE ) -target_include_directories(qtsensors_grue PUBLIC - ../lib -) + +if(WIN32) + set_target_properties(qtsensors_grue PROPERTIES + LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/../sensors + ) +endif() + +if(APPLE AND QT6_IS_SHARED_LIBS_BUILD) + set_target_properties(qtsensors_grue PROPERTIES + LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/../grue_app.app/Contents/MacOS/../sensors + ) +endif() 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(ANDROID) + add_custom_target(gruesensorplugin_android_copy ALL + COMMAND "${CMAKE_COMMAND}" + -E copy_if_different + "$<TARGET_FILE:qtsensors_grue>" + "${CMAKE_CURRENT_BINARY_DIR}/../android-build/libs/${CMAKE_ANDROID_ARCH_ABI}/$<TARGET_FILE_NAME:qtsensors_grue>" + COMMENT "Copying sensor plugin lib to grue_app android libs folder.") -if(NOT MACOS) - target_link_libraries(qtsensors_grue PUBLIC - # Remove: L${CMAKE_CURRENT_BINARY_DIR}/.. - ) + add_dependencies(gruesensorplugin_android_copy qtsensors_grue) endif() install(TARGETS qtsensors_grue |