Warning, /frameworks/extra-cmake-modules/modules/ECMGenerateQmlTypes.cmake is written in an unsupported language. File is not indexed.
0001 # SPDX-FileCopyrightText: 2017 Aleix Pol Gonzalez <aleixpol@kde.org> 0002 # 0003 # SPDX-License-Identifier: BSD-3-Clause 0004 0005 #[=======================================================================[.rst: 0006 ECMGenerateQmlTypes 0007 ------------------- 0008 0009 Generates plugins.qmltypes files for QML plugins. 0010 0011 :: 0012 0013 ecm_generate_qmltypes(<org.kde.pluginname> 1.3 0014 DESTINATION <${KDE_INSTALL_QMLDIR}/org/kde/pluginname>) 0015 0016 Makes it possible to generate plugins.qmltypes files for the QML plugins that 0017 our project offers. These files offer introspection upon our plugin and are 0018 useful for integrating with IDE language support of our plugin. It offers 0019 information about the objects its methods and their argument types. 0020 0021 The developer will be in charge of making sure that these files are up to date. 0022 The plugin.qmltypes file will sit in the source directory. This function will 0023 include the code that installs the file in the right place and a small unit 0024 test named qmltypes-pluginname-version that makes sure that it doesn't need updating. 0025 0026 0027 Since 5.33.0 0028 #]=======================================================================] 0029 0030 function(ecm_generate_qmltypes) 0031 if (NOT TARGET qmltypes) 0032 add_custom_target(qmltypes) 0033 endif () 0034 0035 set(options) 0036 set(oneValueArgs DESTINATION TEST_ENABLED) 0037 cmake_parse_arguments(ARG "${options}" "${oneValueArgs}" "" ${ARGN}) 0038 0039 set(targetname "qmltypes-${ARG_UNPARSED_ARGUMENTS}") 0040 string(REPLACE ";" - targetname "${targetname}") 0041 0042 set(generatedFile ${CMAKE_CURRENT_SOURCE_DIR}/plugins.qmltypes) 0043 add_custom_target(${targetname} 0044 BYPRODUCTS ${generatedFile} 0045 COMMAND qmlplugindump -nonrelocatable ${ARG_UNPARSED_ARGUMENTS} ${KDE_INSTALL_QMLDIR} > ${generatedFile} 0046 ) 0047 add_dependencies(qmltypes ${targetname}) 0048 if (EXISTS ${generatedFile}) 0049 install(FILES ${generatedFile} DESTINATION "${ARG_DESTINATION}") 0050 endif() 0051 0052 string(REPLACE ";" / processedArgs "${ARG_UNPARSED_ARGUMENTS}") 0053 0054 # sometimes qmlplugindump output isn't reproducible, we better have it opt in for now 0055 if(ARG_TEST_ENABLED) 0056 add_test(NAME ${targetname} COMMAND 0057 cmake -DARG_UNPARSED_ARGUMENTS=${processedArgs} -DKDE_INSTALL_QMLDIR=${KDE_INSTALL_QMLDIR} -DINPUT=${generatedFile} -P ${ECM_MODULE_DIR}/../test-modules/test_execute_and_compare.cmake 0058 ) 0059 endif() 0060 endfunction()