on xenial help sign in
Do not generate qmltypes for the duplicate plugin.
43ec45aMichał Sawicz
cmake/modules/QmlPlugins.cmake+20−16
@@ -79,8 +79,8 @@ macro(export_qmlfiles PLUGIN PATH)
79endmacro()
79endmacro()
80
80
81
81
82−# Creates a target for generating the typeinfo file for a QML plugin and optionally installs
82+# Creates a target for generating the typeinfo file for a QML plugin and/or installs the plugin
83−# additional targets.
83+# targets.
84#
84#
85# Files will be copied into ${BINARY_DIR}/${path} or ${CMAKE_CURRENT_BINARY_DIR} and installed
85# Files will be copied into ${BINARY_DIR}/${path} or ${CMAKE_CURRENT_BINARY_DIR} and installed
86# 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
@@ -94,6 +94,7 @@ endmacro()
94# [TARGET_PREFIX string] # Will be prefixed to the target name
94# [TARGET_PREFIX string] # Will be prefixed to the target name
95# [ENVIRONMENT string] # Will be added to qmlplugindump's env
95# [ENVIRONMENT string] # Will be added to qmlplugindump's env
96# [TARGETS target1 [target2 ...]] # Targets to depend on and install (e.g. the plugin shared object)
96# [TARGETS target1 [target2 ...]] # Targets to depend on and install (e.g. the plugin shared object)
97+# [NO_TYPES] # Do not create the qmltypes target
97# )
98# )
98#
99#
99# Created target:
100# Created target:
@@ -101,9 +102,10 @@ endmacro()
101# It will be made a dependency of the "qmltypes" target.
102# It will be made a dependency of the "qmltypes" target.
102
103
103macro(export_qmlplugin PLUGIN VERSION PATH)
104macro(export_qmlplugin PLUGIN VERSION PATH)
105+ set(options NO_TYPES)
104 set(single BINARY_DIR DESTINATION TARGET_PREFIX ENVIRONMENT)
106 set(single BINARY_DIR DESTINATION TARGET_PREFIX ENVIRONMENT)
105 set(multi TARGETS)
107 set(multi TARGETS)
106− cmake_parse_arguments(QMLPLUGIN "" "${single}" "${multi}" ${ARGN})
108+ cmake_parse_arguments(QMLPLUGIN "${options}" "${single}" "${multi}" ${ARGN})
107
109
108 get_target_property(qmlplugindump_executable qmlplugindump LOCATION)
110 get_target_property(qmlplugindump_executable qmlplugindump LOCATION)
109
111
@@ -115,21 +117,23 @@ macro(export_qmlplugin PLUGIN VERSION PATH)
115 set(qmlplugin_dir ${CMAKE_CURRENT_BINARY_DIR})
117 set(qmlplugin_dir ${CMAKE_CURRENT_BINARY_DIR})
116 endif()
118 endif()
117
119
120+ if(NOT QMLPLUGIN_NO_TYPES)
118− # Relative path for the module
121+ # Relative path for the module
119− string(REPLACE "${CMAKE_BINARY_DIR}/" "" QMLPLUGIN_MODULE_DIR "${QMLPLUGIN_BINARY_DIR}")
122+ string(REPLACE "${CMAKE_BINARY_DIR}/" "" QMLPLUGIN_MODULE_DIR "${QMLPLUGIN_BINARY_DIR}")
120
123
121− # Find the last segment of the plugin name to use as qmltypes basename
124+ # Find the last segment of the plugin name to use as qmltypes basename
122− string(REGEX MATCH "[^.]+$" plugin_suffix ${PLUGIN})
125+ string(REGEX MATCH "[^.]+$" plugin_suffix ${PLUGIN})
123− set(target_prefix ${QMLPLUGIN_TARGET_PREFIX}${PLUGIN})
126+ set(target_prefix ${QMLPLUGIN_TARGET_PREFIX}${PLUGIN})
124− set(qmltypes_path ${CMAKE_CURRENT_SOURCE_DIR}/${plugin_suffix}.qmltypes)
127+ set(qmltypes_path ${CMAKE_CURRENT_SOURCE_DIR}/${plugin_suffix}.qmltypes)
125
128
126− add_custom_target(${target_prefix}-qmltypes
129+ add_custom_target(${target_prefix}-qmltypes
127− COMMAND env ${QMLPLUGIN_ENVIRONMENT} ${qmlplugindump_executable} -notrelocatable
130+ COMMAND env ${QMLPLUGIN_ENVIRONMENT} ${qmlplugindump_executable} -notrelocatable
128− ${PLUGIN} ${VERSION} ${QMLPLUGIN_MODULE_DIR} > ${qmltypes_path}
131+ ${PLUGIN} ${VERSION} ${QMLPLUGIN_MODULE_DIR} > ${qmltypes_path}
129− WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
132+ WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
130− )
133+ )
131− add_dependencies(${target_prefix}-qmltypes ${target_prefix}-qmlfiles ${QMLPLUGIN_TARGETS})
134+ add_dependencies(${target_prefix}-qmltypes ${target_prefix}-qmlfiles ${QMLPLUGIN_TARGETS})
132− add_dependencies(qmltypes ${target_prefix}-qmltypes)
135+ add_dependencies(qmltypes ${target_prefix}-qmltypes)
136+ endif()
133
137
134 set_target_properties(${QMLPLUGIN_TARGETS} PROPERTIES
138 set_target_properties(${QMLPLUGIN_TARGETS} PROPERTIES
135 ARCHIVE_OUTPUT_DIRECTORY ${qmlplugin_dir}
139 ARCHIVE_OUTPUT_DIRECTORY ${qmlplugin_dir}
tests/mocks/Unity/Application/Application.qmltypes+1−1
@@ -4,7 +4,7 @@ import QtQuick.tooling 1.1
4// It is used for QML tooling purposes only.
4// It is used for QML tooling purposes only.
5//
5//
6// This file was auto-generated by:
6// This file was auto-generated by:
7−// 'qmlplugindump -notrelocatable Unity.Application 0.1 nonmirplugins'
7+// 'qmlplugindump -notrelocatable Unity.Application 0.1 tests/mocks'
8
8
9Module {
9Module {
10 Component {
10 Component {
tests/mocks/Unity/Application/CMakeLists.txt+2−1
@@ -22,4 +22,5 @@ add_unity8_mock(Unity.Application 0.1 Unity/Application PREFIX mocks TARGETS Fak
22add_unity8_mock(Unity.Application 0.1 Unity/Application
22add_unity8_mock(Unity.Application 0.1 Unity/Application
23 PREFIX nonmirplugins
23 PREFIX nonmirplugins
24 TARGETS NonMirUnityApplicationQml
24 TARGETS NonMirUnityApplicationQml
25− BINARY_DIR ${CMAKE_BINARY_DIR}/nonmirplugins)
25+ BINARY_DIR ${CMAKE_BINARY_DIR}/nonmirplugins
26+ NO_TYPES)