on 5ab40fb help sign in
unity8/cmake/modules/Plugins.cmake
58 lines 1.9 kB history raw
1# Creates target for copying and installing qmlfiles
2#
3# export_qmlfiles(plugin sub_path)
4#
5#
6# Target to be created:
7# - plugin-qmlfiles - Copies the qml files (*.qml, *.js, qmldir) into the shadow build folder.
9macro(export_qmlfiles PLUGIN PLUGIN_SUBPATH)
11 file(GLOB QMLFILES
12 *.qml
13 *.js
14 qmldir
15 )
17 # copy the qmldir file
18 add_custom_target(${PLUGIN}-qmlfiles ALL
19 COMMAND cp ${QMLFILES} ${CMAKE_BINARY_DIR}/plugins/${PLUGIN_SUBPATH}
20 DEPENDS ${QMLFILES}
21 )
23 # install the qmlfiles file.
24 install(FILES ${QMLFILES}
25 DESTINATION ${SHELL_PRIVATE_LIBDIR}/qml/${PLUGIN_SUBPATH}
26 )
27endmacro(export_qmlfiles)
30# Creates target for generating the qmltypes file for a plugin and installs plugin files
32# export_qmlplugin(plugin version sub_path [TARGETS target1 [target2 ...]])
34# TARGETS additional install targets (eg the plugin shared object)
36# Target to be created:
37# - plugin-qmltypes - Generates the qmltypes file in the shadow build folder.
39macro(export_qmlplugin PLUGIN VERSION PLUGIN_SUBPATH)
40 set(multi_value_keywords TARGETS)
41 cmake_parse_arguments(qmlplugin "" "" "${multi_value_keywords}" ${ARGN})
43 # create the plugin.qmltypes file
44 add_custom_target(${PLUGIN}-qmltypes ALL
45 COMMAND qmlplugindump -notrelocatable ${PLUGIN} ${VERSION} ${CMAKE_BINARY_DIR}/plugins > ${CMAKE_BINARY_DIR}/plugins/${PLUGIN_SUBPATH}/plugin.qmltypes
46 )
47 add_dependencies(${PLUGIN}-qmltypes ${PLUGIN}-qmlfiles ${qmlplugin_TARGETS})
49 # install the qmltypes file.
50 install(FILES ${CMAKE_BINARY_DIR}/plugins/${PLUGIN_SUBPATH}/plugin.qmltypes
51 DESTINATION ${SHELL_PRIVATE_LIBDIR}/qml/${PLUGIN_SUBPATH}
52 )
54 # install the additional targets
55 install(TARGETS ${qmlplugin_TARGETS}
56 DESTINATION ${SHELL_PRIVATE_LIBDIR}/qml/${PLUGIN_SUBPATH}
57 )
58endmacro(export_qmlplugin)