Veethree D7 SDK
Loading...
Searching...
No Matches
Host deployment example

For some applications it may be valuable to produce a portable build for x86_64 machines; for instance, to be able to demonstrate a user interface without using a physical D7 device.

In those cases, CPack can be used to package an application for deployment on x86_64. It mostly requires a few extra lines in the applications existing CMakeLists.txt.

Here is an example CMakeLists.txt that does just that. The full example can be found in examples/gui/qml-host-deployment in the SDK installation folder.

CMakeLists.txt
# Note the minimum cmake version
# It's because of qt_generate_deploy_qml_app_script: https://doc.qt.io/qt-6/qt-generate-deploy-qml-app-script.html
# A lower version can be used, but requires a few more lines of boilerplate
cmake_minimum_required(VERSION 3.19)
project(
qml-host-deployment
VERSION 0.1
LANGUAGES CXX)
# Project name
set(APPNAME qml-host-deployment)
# Set C++ standard to C++17
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_STANDARD 17)
# Find QT and VSDK packages
find_package(Qt6 REQUIRED COMPONENTS Quick)
find_package(vsdk REQUIRED)
qt_standard_project_setup(REQUIRES 6.8)
qt_add_executable(${APPNAME} main.cpp)
qt_add_qml_module(
${APPNAME}
URI my_qml_host_deployment
VERSION 1.0
QML_FILES
ui/Main.qml
)
target_link_libraries(${APPNAME} PRIVATE Qt6::Quick)
## Deploy to target from Qt Creator
include(GNUInstallDirs)
install(TARGETS ${APPNAME}
BUNDLE DESTINATION .
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)
if (NOT CMAKE_CROSSCOMPILING)
# Build package for host deployment
# All the possible package types are available here: https://cmake.org/cmake/help/latest/manual/cpack-generators.7.html
# CPack cheatsheet: https://github.com/mgalloy/cpack-cheatsheets/blob/master/cpack-variables.rst
set(PACKAGE_TYPE "STGZ")
set(PLUGINS_TO_INCLUDE "")
if (WIN32)
set(PACKAGE_TYPE "ZIP")
# Run the .exe without opening a command line
set_target_properties(${APPNAME} PROPERTIES
WIN32_EXECUTABLE TRUE
)
else()
set(PLUGINS_TO_INCLUDE "xcb wayland")
endif()
qt_generate_deploy_qml_app_script(
TARGET ${APPNAME}
OUTPUT_SCRIPT my_deploy_script
NO_UNSUPPORTED_PLATFORM_ERROR
DEPLOY_USER_QML_MODULES_ON_UNSUPPORTED_PLATFORM
NO_TRANSLATIONS
INCLUDE_PLUGINS "${PLUGINS_TO_INCLUDE}"
)
install(SCRIPT ${my_deploy_script})
set(CPACK_PACKAGE_NAME "${APPNAME}-package")
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "The D7 Hello World Host deployment example")
set(CPACK_PACKAGE_VENDOR "Veethree Technologies")
set(CPACK_VERBATIM_VARIABLES ON)
set(CPACK_GENERATOR "${PACKAGE_TYPE}")
include (CPack)
endif()
@ set
set operation failed
Definition io_error_codes.h:48
Any entities that belong to the Veethree SDK libraries.
Definition can_adapter.h:11