1
find_program(qmlplugindump_exe qmlplugindump)
3
if(NOT qmlplugindump_exe)
4
msg(FATAL_ERROR "Could not locate qmlplugindump.")
7
# Creates target for copying and installing qmlfiles
9
# export_qmlfiles(plugin sub_path)
12
# Target to be created:
13
# - plugin-qmlfiles - Copies the qml files (*.qml, *.js, qmldir) into the shadow build folder.
15
macro(export_qmlfiles PLUGIN PLUGIN_SUBPATH)
23
# copy the qmldir file
24
add_custom_target(${PLUGIN}-qmlfiles ALL
25
COMMAND cp ${QMLFILES} ${CMAKE_CURRENT_BINARY_DIR}
29
# install the qmlfiles file.
30
install(FILES ${QMLFILES}
31
DESTINATION ${SHELL_PRIVATE_LIBDIR}/qml/${PLUGIN_SUBPATH}
33
endmacro(export_qmlfiles)
36
# Creates target for generating the qmltypes file for a plugin and installs plugin files
38
# export_qmlplugin(plugin version sub_path [TARGETS target1 [target2 ...]])
40
# TARGETS additional install targets (eg the plugin shared object)
42
# Target to be created:
43
# - plugin-qmltypes - Generates the qmltypes file in the shadow build folder.
45
macro(export_qmlplugin PLUGIN VERSION PLUGIN_SUBPATH)
46
set(multi_value_keywords TARGETS)
47
cmake_parse_arguments(qmlplugin "" "" "${multi_value_keywords}" ${ARGN})
49
# Only try to generate .qmltypes if not cross compiling
50
if(NOT CMAKE_CROSSCOMPILING)
51
# create the plugin.qmltypes file
52
add_custom_target(${PLUGIN}-qmltypes ALL
53
COMMAND ${qmlplugindump_exe} -notrelocatable ${PLUGIN} ${VERSION} ${CMAKE_BINARY_DIR}/plugins > ${CMAKE_BINARY_DIR}/plugins/${PLUGIN_SUBPATH}/plugin.qmltypes
55
add_dependencies(${PLUGIN}-qmltypes ${PLUGIN}-qmlfiles ${qmlplugin_TARGETS})
57
# install the qmltypes file.
58
install(FILES ${CMAKE_BINARY_DIR}/plugins/${PLUGIN_SUBPATH}/plugin.qmltypes
59
DESTINATION ${SHELL_PRIVATE_LIBDIR}/qml/${PLUGIN_SUBPATH}
63
# install the additional targets
64
install(TARGETS ${qmlplugin_TARGETS}
65
DESTINATION ${SHELL_PRIVATE_LIBDIR}/qml/${PLUGIN_SUBPATH}
67
endmacro(export_qmlplugin)