C
Touch: Safe Touch
cmake_minimum_required(VERSION 3.16) project(TouchExample LANGUAGES CXX) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(CMAKE_AUTOMOC ON) # Define the condition for HOST_BUILD set(HOST_BUILD OFF) # Default to OFF if (NOT CMAKE_CROSSCOMPILING AND (NOT UNIX OR NOT (CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "arm|aarch64") OR APPLE)) set(HOST_BUILD ON) endif() if (WIN32) set(APP_ICON_RESOURCE "${CMAKE_CURRENT_LIST_DIR}/icons/app.rc") endif() find_package(Qt6 REQUIRED COMPONENTS Core Qml Quick SafeRenderer SafeRendererTools SafePlatformAdaptation SafeEventSender) set(sources main.cpp ) set (safeqmls "main.qml" ) # Resource files are passed to qtsafelayouttool set(resource_files "qml.qrc" ) #resource.bin is loaded by qtsafelayouttool to find the resource data asset. qt6_add_binary_resources(resources_TouchExample ${resource_files} DESTINATION resource.bin) qsr_add_safelayout(generatelayout_TouchExample SAFE_QMLS ${safeqmls} OUTPUT_PATH ${CMAKE_CURRENT_LIST_DIR}/layoutData SAFE_RESOURCE "${CMAKE_CURRENT_LIST_DIR}/safeasset.qrc" INPUT_RESOURCES resource.bin) qsr_add_resource(buildresource_TouchExample sources "${CMAKE_CURRENT_LIST_DIR}/safeasset.qrc") if (HOST_BUILD) qt6_add_resources(sources ${resource_files}) endif() add_executable(TouchExample WIN32 ${APP_ICON_RESOURCE} ${sources} ) #Enable when using monitor feature: #target_compile_definitions(TouchExample PRIVATE USE_OUTPUTVERIFIER) add_dependencies(TouchExample generatelayout_TouchExample) if (HOST_BUILD) target_compile_definitions(TouchExample PUBLIC HOST_BUILD ) target_link_libraries(TouchExample PUBLIC Qt::Quick Qt::Widgets Qt::Qml ) else() message(STATUS "Project is not linked with Qt when building for embedded systems.") endif() target_link_libraries(TouchExample PUBLIC Qt::SafeRenderer Qt::SafePlatformAdaptation Qt::SafeEventSender )