on xenial help sign in
Only generate .qmltypes files manually, no need to do it build-time.

It didn't work when cross-compiling either, and required builders to have otherwise unnecessary environment.

commitd554ebb0fd261df86e0a47abf1c93c1d8a1c78c0 authorMichał Sawicz <michal.sawicz@canonical.com> dateThu 26 Jun 2014, 09:40 (12 years ago) parentad0a13f
1 file changed+20−21
cmake/modules/QmlPlugins.cmake+20−21
cmake/modules/QmlPlugins.cmake+20−21
@@ -12,6 +12,12 @@ if(NOT TARGET qmlplugindump)
1212 set_target_properties(qmlplugindump PROPERTIES IMPORTED_LOCATION ${qmlplugindump_exe})
1313endif()
1414
15+#
16+# A custom target for building the qmltypes files manually.
17+#
18+if (NOT TARGET qmltypes)
19+ add_custom_target(qmltypes)
20+endif()
1521
1622# Creates a target for copying resource files into build dir and optionally installing them.
1723#
@@ -51,6 +57,7 @@ macro(export_qmlfiles PLUGIN PATH)
5157 ${QMLFILES_SEARCH_PATH}/*.png
5258 ${QMLFILES_SEARCH_PATH}/*.sci
5359 ${QMLFILES_SEARCH_PATH}/*.svg
60+ ${QMLFILES_SEARCH_PATH}/*.qmltypes
5461 ${QMLFILES_SEARCH_PATH}/qmldir
5562 )
5663
@@ -69,14 +76,14 @@ macro(export_qmlfiles PLUGIN PATH)
6976 DESTINATION ${QMLFILES_DESTINATION}/${PATH}
7077 )
7178 endif()
72−endmacro(export_qmlfiles)
79+endmacro()
7380
7481
75−# Creates a target for generating the typeinfo file for a QML plugin and optionally installs it
76−# and additional targets.
82+# Creates a target for generating the typeinfo file for a QML plugin and optionally installs
83+# additional targets.
7784#
7885# Files will be copied into ${BINARY_DIR}/${path} or ${CMAKE_CURRENT_BINARY_DIR} and installed
79−# into ${DESTINATION}/${path}. If you don't pass BINARY_DIR, it's assumed that current source
86+# into ${DESTINATION}/${path}. If you don't pass BINARY_DIR, it's assumed that current source
8087# path ends with ${path}.
8188#
8289# The generated file will be named after the last segment of the plugin name, e.g. Foo.qmltypes.
@@ -90,7 +97,8 @@ endmacro(export_qmlfiles)
9097# )
9198#
9299# Created target:
93−# - ${TARGET_PREFIX}${plugin}-qmltypes - Generates the qmltypes file in the binary dir.
100+# - ${TARGET_PREFIX}${plugin}-qmltypes - Generates the qmltypes file in the source dir.
101+# It will be made a dependency of the "qmltypes" target.
94102
95103macro(export_qmlplugin PLUGIN VERSION PATH)
96104 set(single BINARY_DIR DESTINATION TARGET_PREFIX ENVIRONMENT)
@@ -110,23 +118,14 @@ macro(export_qmlplugin PLUGIN VERSION PATH)
110118 # Find the last segment of the plugin name to use as qmltypes basename
111119 string(REGEX MATCH "[^.]+$" plugin_suffix ${PLUGIN})
112120 set(target_prefix ${QMLPLUGIN_TARGET_PREFIX}${PLUGIN})
113− set(qmltypes_path ${qmlplugin_dir}/${plugin_suffix}.qmltypes)
121+ set(qmltypes_path ${CMAKE_CURRENT_SOURCE_DIR}/${plugin_suffix}.qmltypes)
114122
115− # Only generate typeinfo if not cross compiling
116− if(NOT CMAKE_CROSSCOMPILING)
117− add_custom_target(${target_prefix}-qmltypes ALL
118− COMMAND env ${QMLPLUGIN_ENVIRONMENT} ${qmlplugindump_executable} -notrelocatable
119− ${PLUGIN} ${VERSION} ${QMLPLUGIN_BINARY_DIR} > ${qmltypes_path}
120− )
121− add_dependencies(${target_prefix}-qmltypes ${target_prefix}-qmlfiles ${QMLPLUGIN_TARGETS})
122−
123− if (QMLPLUGIN_DESTINATION)
124− # Install the typeinfo file
125− install(FILES ${qmltypes_path}
126− DESTINATION ${QMLPLUGIN_DESTINATION}/${PATH}
127− )
128− endif()
129− endif()
123+ add_custom_target(${target_prefix}-qmltypes
124+ COMMAND env ${QMLPLUGIN_ENVIRONMENT} ${qmlplugindump_executable} -notrelocatable
125+ ${PLUGIN} ${VERSION} ${QMLPLUGIN_BINARY_DIR} > ${qmltypes_path}
126+ )
127+ add_dependencies(${target_prefix}-qmltypes ${target_prefix}-qmlfiles ${QMLPLUGIN_TARGETS})
128+ add_dependencies(qmltypes ${target_prefix}-qmltypes)
130129
131130 set_target_properties(${QMLPLUGIN_TARGETS} PROPERTIES
132131 ARCHIVE_OUTPUT_DIRECTORY ${qmlplugin_dir}