diff options
author | Andrei Golubev <andrei.golubev@qt.io> | 2021-09-17 17:01:56 +0200 |
---|---|---|
committer | Andrei Golubev <andrei.golubev@qt.io> | 2021-10-22 12:47:19 +0200 |
commit | 8dab4a81a0bf6cf1765ecf15f6f8c5b9ac2f5100 (patch) | |
tree | 167fed54732edfc76a171e0c0f57643367d4378a /src/qml/doc/src | |
parent | 325938018be24fa54b2d06d9e16b040a925580f3 (diff) |
qmltc: add cmake api and simplest file writer
Also update tests to include the generated file. While the
content is meaningless, it's good enough to check that the file
is include-able at this stage
Task-number: QTBUG-84368
Task-number: QTBUG-96040
Change-Id: I155826a52090c5b13d14be6330813dc5a27f28e5
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'src/qml/doc/src')
-rw-r--r-- | src/qml/doc/src/cmake/qt_target_compile_qml_to_cpp.qdoc | 81 |
1 files changed, 81 insertions, 0 deletions
diff --git a/src/qml/doc/src/cmake/qt_target_compile_qml_to_cpp.qdoc b/src/qml/doc/src/cmake/qt_target_compile_qml_to_cpp.qdoc new file mode 100644 index 0000000000..04731a88ee --- /dev/null +++ b/src/qml/doc/src/cmake/qt_target_compile_qml_to_cpp.qdoc @@ -0,0 +1,81 @@ +/**************************************************************************** +** +** Copyright (C) 2021 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:FDL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU Free Documentation License Usage +** Alternatively, this file may be used under the terms of the GNU Free +** Documentation License version 1.3 as published by the Free Software +** Foundation and appearing in the file included in the packaging of +** this file. Please review the following information to ensure +** the GNU Free Documentation License version 1.3 requirements +** will be met: https://www.gnu.org/licenses/fdl-1.3.html. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! +\page qt_target_compile_qml_to_cpp.html +\ingroup cmake-commands-qtqml + +\title qt_target_compile_qml_to_cpp +\target qt6_target_compile_qml_to_cpp + +\brief Compiles QML files (.qml) to C++ source code with Qml Type Compiler (qmltc). + +\section1 Synopsis + +\badcode +qt_target_compile_qml_to_cpp( + target + FILES ... +) + +\endcode + +\versionlessCMakeCommandsNote qt6_target_compile_qml_to_cpp() + +\section1 Description + +This command compiles the object structure of the passed QML files to C++ using +qmltc. By default, qmltc generates lower-case \c{.h} and \c{.cpp} files for a +given \c{.qml} file, so an arbitrary \c{HelloWorld.qml} ends up being compiled +into \c{helloworld.h} and \c{helloworld.cpp}. The generated files are then +automatically added to the target. + +\note This command is in technology preview and may change in future releases. + +\section1 Arguments + +The \c target specifies the name of the binary that the QML files belong to. In +order for the compilation to succeed, the target is expected to be a valid QML +module, defined with qt_add_qml_module() command. + +\c FILES lists the \c{.qml} files that are going to be compiled into C++. In +most cases, all the target's QML files would be specified in the FILES. This +way, FILES argument is equivalent to QML_FILES argument of the +qt_add_qml_module() command. + +While processing FILES, the following source file properties are respected: +\list + \li \c{QT_QMLTC_FILE_BASENAME}: use this source file property to specify a + non-default .h and .cpp file name, which might be useful to e.g. resolve + conflicting file names (imagine you have main.qml that is being + compiled, but main.h already exists, so #include "main.h" might not do + what you expect it to do). Unlike in the case of default behavior, the + QT_QMLTC_FILE_BASENAME is taken as is, without being lower-cased or + processed by any other means +\endlist + +*/ |