Commit Graph

207 Commits

Author SHA1 Message Date
Joerg Bornemann 2c39e1196e CMake: Fix installation of qmlcache's .prf files in cross-builds
In cross-builds of Qt we missed to install qtquickcompiler.prf and
qmlcache.prf. Fix that by installing these files before the
qt_internal_return_unless_building_tools call.

Remove qmake2cmake conversion cruft as drive-by.

Fixes: QTBUG-132423
Pick-to: 6.5 6.8 6.9
Change-Id: Ic7a63af90985e42c221cce2c54de285f03b09999
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2025-01-03 11:57:39 +01:00
Ulf Hermann f56a0c8294 qmlcachegen: Fix resource import paths
Amends commit 2cf9aeccdd.

Pick-to: 6.8
Change-Id: Ic280eb3caa67c17c87cd5419fad0f6b8801a46a9
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
2024-11-14 10:48:06 +01:00
Olivier De Cannière 4dab304aeb aotstats: Keep track of files and modules with no functions or bindings
Before this change, the report presented to the user would be
completely silent about them. For the sake of consitency, register each
file before trying to compile it. This will then add an entry for empty
files and modules.

Task-number: QTBUG-124667
Pick-to: 6.8
Change-Id: I502660b7a16a67a173763f9ea2b081cbcceb5658
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
2024-11-04 15:21:11 +01:00
Olivier De Cannière 318ac44065 aotstats: Support --only-bytecode and modules with no qml files
It is possible to pass --only-bytecode to qmlcachegen. As the name
implies, this only generates the bytecode for the qml files and does not
compile them. This case was not taken into account which could lead to
files commands depend upon not being generated.

Therefore, keep track of empty and only-bytecode modules in files
generated by cmake and pass them to qmlaotstats upon aggregation such
that it can include that information in the report.

Also, only pass the arguments specific to aotstats to qmlcachegen if
--only-bytecode is not set for that module.

Fixes: QTBUG-130084
Task-number: QTBUG-124667
Pick-to: 6.8
Change-Id: I44b4a80e8a6fd2f9bc16ae1bb2c8d540ff3b697b
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
2024-11-04 15:21:09 +01:00
Olivier De Cannière ee5c015b3a Compiler: Make qqmljsscope::filePath hold the source location more often
Previously, it would hold the location of the copy in the build
directory or in the resource file system.

This should improve the accuracy of the information that we can report
back. For example, the file location of files reported in aotstats will
now be those in the source folder.

The changes necessary for this patch were found through trial and error
by asserting that the filePath respect a certain form and fixing what I
could. There remain cases where the filePath still contains a location
in the build directory. We would need some other change to report those
accurately as well.

Finally, sometimes the filePath is empty or does not contain a valid
path at all but instead what seems to be the location of an included
file. It can have the form "private/..._p.h" for example.

Pick-to: 6.8
Change-Id: I77a2596f6c4a179580d924a6e9324e43dbb86c0c
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2024-10-31 11:49:54 +01:00
Ulf Hermann ead2ab3f6a qmlcachegen: Accept --dump-aotstats and --module-id on --only-bytecode
We set those options from CMake. qmlcachegen can still dump (empty) AOT
stats if it's compiling only to byte code, and it's not wrong to still
tell it the module ID.

Amends commit 6ae36202fd

Change-Id: I3990c0783f9fdf0c7c7263675dc82c8c74851eb8
Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2024-09-30 11:20:09 +00:00
Olivier De Cannière 6ae36202fd qmlcachegen: Reject using --only-bytecode with compiler-only options
[ChangeLog][QtQml] qmlcachegen will now exit with a failure state if
--only-bytecode is set as the same time as Script Compiler exclusive
options. The only-bytecode flag skips the compilation altogether.
Remove one of the conflicting flag to solve the issue.

Change-Id: I5c6a0610ec4c2eb06624c2d123ab62bc633a46b8
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2024-08-23 15:44:58 +02:00
Olivier De Cannière 8827af0fe8 Compiler: Record statistics about aot compilation
This patch introduces the collection of statistics about the
ahead-of-time compilation of functions and bindings to Cpp by
qmlcachegen. This is done by having qmlcachegen save an aotstats file
for every qml file it compiles. This file contains, for every function
and binding, whether the Cpp codegen was successful, its duration and a
potential error message

Task-number: QTBUG-124667
Change-Id: Iba9a72be04f6642688533a3ae12ea687296c85e1
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2024-05-28 10:25:41 +02:00
Ulf Hermann 9b78434579 qmlcompiler: Sanitize qmldir paths before using them
They may contain backslashes.

Pick-to: 6.7 6.5
Fixes: QTBUG-125393
Change-Id: Ifd8c97c44b036ab64a221775a7fe6316445f6cf8
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2024-05-17 17:34:33 +02:00
Ulf Hermann 1e0db4577a qmlcachegen: Add hidden --static option
We want qmlcachegen to accept the same arguments as qmlsc so that people
don't have to fiddle with the build system when they need to switch
between them.

Pick-to: 6.7 6.5
Change-Id: If21cbd262104c68c96649b4b0882c079c3862f05
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2024-04-18 14:42:40 +02:00
Joerg Bornemann 107c5da80c Add --warnings-are-errors option to qmlcachegen
[ChangeLog][qmlcachegen] Added the --warnings-are-errors option that
treats warnings as errors when generating C++ code.

Like gcc's -Werror, this option is useful when aiming at warning-free
QML code. Add it to the QT_QMLCACHEGEN_ARGUMENTS target property to
error out once warnings have been encountered.

Change-Id: If72875b33052b37642b18fa192a1344c347990d8
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2023-12-22 09:50:34 +01:00
Olivier De Cannière 2cf9aeccdd Compiler: Separate function prolog block and add validation of blocks
The function prolog logic is now separated in its own basic block. The
first "real" block with user code starts at offset 0.

Having the function prolog as a hidden part of the first block caused
some inconsistencies in block generation and would create empty blocks.
This happened for example when a back edge of a loop would target offset
0 in code where a loop condition is the very first set of instructions
that are run. This is because the target block offset didn't exist due
to it being part of the hidden prolog block.

Validation for the basic blocks was also added. This checks for three
things at the moment:
1. That return and throw blocks don't have jump targets.
2. That the basic blocks graph is connected.
3. That jump targets are the first offset of a block.

Test tst_QmlCppCodegen::basicBlocksWithBackJump_infinite() is expected
to fail because it contains an infinite loop and the basic blocks that
are generated for it are inconsistent due to dead-code elimination
happening earlier in compilation.

Debug outputs for dumping basic blocks were also adapted to reflect
these changes.

Change-Id: I513f73856412d488d443c2b47a052b0023d45496
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2023-08-04 09:34:09 +02:00
Ulf Hermann a7c92814f0 qmlcachegen: Add a --verbose command line option
This replaces the logging category magic to determine whether we should
output warnings.

Change-Id: Ibc95ed70227e3438504e921693aa4af9a1d0376e
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2023-04-24 22:22:13 +02:00
Ulf Hermann ddba87612d QML: Turn singleton/type mismatch into a run time type error
There are many ways to "hide" the qmldir from the engine at run time,
which turns singletons into regular types. While all of this is invalid,
we should not assert on it, but rather produce a legible warning.

Furthermore, sharpen the importing of extra modules from qrc as implicit
imports. We should really only import modules the file in question can
ever be part of. Otherwise we needlessly produce the above situation and
hide legitimate warning messages.

Amends commit 7517c1b3ae.

Now we need to teach our tools about the default import paths in the
resorurce file system. They cannot guess any type they may find in any
resource file anymore.

Pick-to: 6.5
Task-number: QTBUG-106929
Change-Id: Ic8c02396d10830a7f461e8a81649bb8c9a1add1f
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
2023-01-27 10:42:06 +01:00
Joerg Bornemann e4feab1992 qmake: Fix generated *_qmlcache.cpp file paths
...for source files that are outside of the source directory.

Having QML files that are generated in the build directory led
to *_qmlcache.cpp files with very long file names, hitting file system
limitations on Windows.

Apply the same fix that was done for generated qmlcache.qrc files in
commit 5d7710a623.

Pick-to: 6.2 6.4 6.5
Task-number: QTBUG-108150
Change-Id: Icef9dbf40fc7ade54b584bcdc8799c4cc95ac76d
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-12-14 17:39:55 +01:00
Ulf Hermann bc528a0770 QmlCompiler: Add a separate flag for the "pragma Strict" check
We want to trigger the qFatal() when running qmlcachegen or qmlsc, but
we don't want to trigger it in qmllint, even if we are using the same
QtMsgType for the severity of the messages.

In turn, demote qmlCompiler messages to QtWarningMsg in qmlcachegen.

Pick-to: 6.4
Task-number: QTBUG-107168
Change-Id: Ib660df41742b2d426241eb29ac4c91f4933c5ba1
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-10-20 21:37:57 +02:00
Marc Mutz 958cd3ee10 Port from container::count() and length() to size()
This is a semantic patch using ClangTidyTransformator as in
qtbase/df9d882d41b741fef7c5beeddb0abe9d904443d8:

  auto QtContainerClass = anyOf(
      expr(hasType(cxxRecordDecl(isSameOrDerivedFrom(hasAnyName(classes))))).bind(o),
      expr(hasType(namedDecl(hasAnyName(<classes>)))).bind(o));
  makeRule(cxxMemberCallExpr(on(QtContainerClass),
                             callee(cxxMethodDecl(hasAnyName({"count", "length"),
                                                  parameterCountIs(0))))),
           changeTo(cat(access(o, cat("size"), "()"))),
           cat("use 'size()' instead of 'count()/length()'"))

a.k.a qt-port-to-std-compatible-api with config Scope: 'Container',
with the extended set of container classes recognized.

Change-Id: Idb1f75dfe2323bd1d9e8b4d58d54f1b4b80c7ed7
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-10-07 23:38:48 +02:00
Ulf Hermann 2f583eeab2 Add --bare option to qmltc and qmlcachegen
We need those to prevent usage of the host Qt's import path when
building QML files for the target.

Task-number: QTBUG-106365
Pick-to: 6.4 6.4.0
Change-Id: I34499af850fb759603206cb429ff97633c76054d
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-09-09 15:40:40 +02:00
Lucie Gérard 1b9808737a Change the license of all CMakeLists.txt and *.cmake files to BSD
Task-number: QTBUG-105718
Change-Id: Id89ed14990804a5024183e75382cc539d4293da1
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2022-09-07 17:01:30 +02:00
Ivan Solovev 309e2e864f QtDeclarative: port away from deprecated qSetGlobalQHashSeed(0)
Use QHashSeed::setDeterministicGlobalSeed() instead

Task-number: QTBUG-105102
Change-Id: I1d13f3872b335ff9998f7c4538d3b9c3c77fe232
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-08-29 20:48:09 +02:00
Alexandru Croitor eed7b3f4e7 CMake: Don't use PUBLIC_LIBRARIES for executables
Change-Id: I346ea4eac1dfbfb7fb81609307f5f7c4716bb8d1
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
2022-07-21 13:19:04 +02:00
Lucie Gérard 5a7b716474 Add license headers to cmake files
CMakeLists.txt and .cmake files of significant size
(more than 2 lines according to our check in tst_license.pl)
now have the copyright and license header.

Existing copyright statements remain intact

Task-number: QTBUG-88621
Change-Id: I72c89a98c42bbc9234d8495e9e503bec81d11037
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2022-07-08 10:41:06 +02:00
Maximilian Goldstein a9038a6cc6 QQmlJSLogger: Switch to an ID based system
This change makes qmljslogger use an ID based system for categorizing
logging entries instead of using an enum. This allows plugins to
register their own logging categories after the fact.

It's also necessary for us to later show the warning ID when
printing warnings and for creating documentation for each ID entry.

Currently not every ID maps cleanly to only one type of warning,
this has to be cleaned up in a follow-up change.

Task-number: QTBUG-103453
Change-Id: I4cac6be7ca165b938e0ea032d077823bf17baf75
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-06-30 11:23:36 +02:00
Lucie Gérard 0dc4fd240a Use SPDX license identifiers
Replace the current license disclaimer in files by
a SPDX-License-Identifier.
Files that have to be modified by hand are modified.
License files are organized under LICENSES directory.

Pick-to: 6.4
Task-number: QTBUG-67283
Change-Id: I63563bbeb6f60f89d2c99660400dca7fab78a294
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2022-06-11 08:05:15 +02:00
Maximilian Goldstein dc6b39fb2e Turn qmlcompiler into a shared library
Converts qmlcompiler into a shared library so it isn't duplicated when
statically linked in tools and so that plugins can link against it.

Change-Id: I91e13cc588796f71a5463dbdce21e42a74120565
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-03-25 13:12:32 +01:00
Ulf Hermann 6ff2669b36 qmlcachegen: Re-enable pragma Strict checking
We've accidentally disabled the pragma Strict check when re-designing
the logging system.

Change-Id: I74cf0d4a45742831037ec0bc0615f1f6a15b7023
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
2022-02-18 12:13:47 +01:00
Andrei Golubev 690b7cb6a2 Redesign QQmlJSLogger internals
High-level goal: be able to reuse existing infrastructure
"as is" to configure semantic analysis categories in tools
(qmllint, qmltc, qmlsc, etc.)

To achieve that, simplify the logging to always "log"
something, without explicitly specifying the severity. The
severity is now baked into the category (and we can extend
those to cover different cases)

One slight deviation is the cache generation which likes
to do its own thing at present. Provide a "forced logging"
option where we can specify which severify we want. The
hope is that this gets removed at some point

Particular list of (noteworthy) changes:
* No more "thresholding" by the level (this is rarely needed
  and is actually questionable). Instead, we can ignore a
  particular category explicitly
* Category levels are repurposed as category severities
  (at least from the high-level picture that always should've
  been this way)
* log{Warning,Info,Critical} removed. We use category severity
  instead
* "category error" makes zero sense so removed: if our severity
  is:
  - QtWarningMsg (qmllint), it is already an "error"
  - QtCriticalMsg (compilers), it is already an "error"
* Align m_output and m_{infos,warnings,errors} stored information
* Accept the fact that we don't support QtDebugMsg and QtFatalMsg
* Additional categories added to cover for places where the same
  category would be both an error and not an error

Task-number: QTBUG-100052
Change-Id: I3cd5d17d58be204f48428877bed053f756ac40a8
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2022-02-12 23:21:29 +01:00
Maximilian Goldstein dc9de38abe qmllint: Warn about missing singleton pragmas/qmldir entries
This change adds a warning if we encounter a component marked as a
singleton in a qmldir file which does not contain a pragma
Singleton entry and vice versa.

Note that the warning only gets triggered if the singleton is
actually used.

Fixes: QTBUG-98558
Change-Id: Id7c63f48ba49759c15dffcaee0270c7caab2eb7d
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
2022-02-03 11:17:34 +01:00
Ulf Hermann 576fafd1e6 Pass qmldir to qmlcachegen, qmllint and qmltc, not the qmltypes file
The tools will still grudgingly accept qmltypes files being passed via
the -i option. We generally expect qmldir files, though. Ignoring the
qmldir file and importing the qmltypes directly, ignores qmldir imports,
dependencies and other component entries. This leads to unresolvable
types.

[ChangeLog][QML Tooling] qmllint expects qmldir files, not qmltypes
files to be passed via the -i option now. This enables it to see the
imports and dependencies of the module being imported. For backwards
compatibility it still accepts qmltypes files, with a warning.

Pick-to: 6.3
Fixes: QTBUG-99043
Change-Id: I5ed32d7e78df1e604aaf1bfa2ebda09d5d57b628
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2021-12-13 11:51:13 +00:00
Ulf Hermann 58ff7aa4fe Compile QML files ahead of time with qmlcachegen
qmlcachegen compiles bindings and functions to C++ as far as
QQmlJSAotCompiler can. It does respect "pragma Strict" and rejects the
file if it's violated. Furthermore, it sets up the logger to follow the
qt.qml.compiler.aot logging category. By default it's completely silent.

Compiling the examples with qmlcachegen exposes a bug in the type
resolver where it returns an invalid generic type. It should never do
that. Fix it by returning JSValue.

[ChangeLog][QtQml][Important Behavior Changes] QML bindings and
functions are now compiled to C++ by qmlcachegen, if possible. Use the
qt.qml.compiler.aot logging category to receive diagnostics about the
compilation.

Task-number: QTBUG-98305
Change-Id: I6953812c3fd20b68339617a5714fcbe16a384360
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2021-12-03 12:09:26 +01:00
Joerg Bornemann 0d6d3c7bc5 Skip unnecessary commands when cross-building tools
Call qt_internal_return_unless_building_tools() directly after
qt_internal_add_tool() to avoid having to special-case code for when
this function only creates imported targets in cross-builds.

Task-number: QTBUG-85084
Change-Id: I5c8f2ecdf4936cfd15cb530e896bc4e5b5531620
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-10-08 10:37:35 +02:00
Fawzi Mohamed 70dac58bd9 replace devtools library with QtQml
qmldevtools was needed when building with qmake, and to avoid circular
dependencies in the tools (before making QtQml minimal).
Now it can be avoided.
This change will make qmldom, qmlformat, qmlimportscanner and qmllint
depend on QtQml (just like the other Qml tools) and not be always
completely static (qmldevtools was always a static library, QtQml
normally isn't).

Change-Id: Idfa0a70e51f0d4999fb9753121c6c228ae69c9bb
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2021-07-02 12:06:21 +02:00
Alexandru Croitor 63b91343ad CMake: Update warning about qtquick_compiler_add_resources
To mention qt_add_qml_module instead of qt6_add_resources.
The latter does not process qml files anymore.

Pick-to: 6.2
Change-Id: I12ce2b60b1d20cbfc9c781e3f15f7999f5ba563d
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2021-06-25 15:40:46 +02:00
Ulf Hermann 06b3f1f2e7 Replace qmlcachegen's --qmljs-runtime with generic mechanism
We don't need --qmljs-runtime after all. However, we do want to pass
custom arguments to qmlcachegen. This way we don't need to change the
world whenever we invent one.

Pick-to: 6.2
Change-Id: I99f0c99c4b15e469605dc43d26871fa43dc36c08
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Fawzi Mohamed <fawzi.mohamed@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-06-18 15:41:50 +02:00
Pavol Markovic 1bae74dfa0 qmlcachegen: Fix typo in command line option description
'resource-file-mapping option' is actually using '=' in code and tools

Change-Id: I0d67e13e9d614bf973a0d4332c6b4dcda4c121a4
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2021-06-12 22:06:07 +12:00
Craig Scott 63a601dc29 CMake: Remove unneeded *.pro and .prev_CMakeLists.txt files
The .pro files corresponding to the .prev_CMakeLists.txt files
have already been removed.

Change-Id: I254eafe4c7de1a516e33bd9cb3d9879e73fa83b4
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2021-05-19 10:46:06 +10:00
Kai Köhne c442542627 Move tools to libexec
Move qmlimportscanner, qmltyperegistrar, qmljsrootgen, qmlcachegen to libexec
These are internal tools that is not supposed to be run by the user directly.

[ChangeLog][Linux] qmlimportscanner, qmltyperegistrar, qmljsrootgen,
qmlcachegen tools got moved from QTDIR/bin into QTDIR/libexec
directory.

Task-number: QTBUG-88791
Change-Id: I2739044e872ec83ef7da7dd857c26395ecfd407d
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Maximilian Goldstein <max.goldstein@qt.io>
2021-05-11 08:48:11 +02:00
Kai Köhne 55fafd6915 Fix regression where qtquickcompiler cannot find rcc
RCC got moved to libexec in 6.1

[ChangeLog][qmake] Fixed regression in Qt 6.1.0 which broke
'QT += qtquickcompiler' on Linux, macOS.

Pick-to: 6.1
Fixes: QTBUG-93563
Change-Id: I5fb661a529c43b3b58316b73f4c62e069d1c7df4
Reviewed-by: Maximilian Goldstein <max.goldstein@qt.io>
2021-05-07 10:59:39 +02:00
Ulf Hermann 5c4e3c44f7 qmlcachegen: Add an ignored option -I
In other implementations this may be used the same way as qmllint's -I
option, to specify additional import paths.

Change-Id: I447712551ff1fb2a7c379712e938f778b37c514a
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2021-03-04 23:35:16 +01:00
Ulf Hermann 74bf3c8c33 Rework QQmlJSResourceFileMapper
We need more generic filtering capabilities so that it can, for example,
retrieve all the .qml files in a directory, both as qrc paths and local
file paths.

Change-Id: I72a72abc6dd39adb41bcd035f7aa6777e50cb5a5
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
2021-02-24 13:01:42 +01:00
Ulf Hermann 1e089ad28d qmlcachegen: Accept both --resource and --resource-path
--resource-path directly specifies the resource path for the file being
compiled and overrides any information we might retrieve from the qrc
file. However, we might still find other relevant information in the qrc
file.

Change-Id: I587c6e4e81f792f62a28b035ee97b33d12eeb06d
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2021-02-23 13:54:33 +01:00
Fabian Kosmale 78ab4b8d8b Remove the qmake project files
Remove all qmake project files, except for examples which are used to
test that qmake continues to work.

Change-Id: Ic4abb72dc2dcd75df7a797c56056b6b3c5fe62ac
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2021-01-15 15:34:22 +01:00
Ulf Hermann 06ab8d790d Add a -i <qmltypes> option to qmlcachegen
qmlcachegen needs to see the qmltypes file for the current project so
that it can query it for C++ types exposed to QML.

This is only relevant when generating C++ code, which qmlcachegen itself
cannot do. However, in order to write a compatible drop-in, we need it.

Also, hide related ignored options from --help in qmlcachegen.

Change-Id: Id2f1b8b1750351c7de8dfe49e4065ef1b29423b7
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2021-01-12 20:58:25 +01:00
Ulf Hermann 9aba23c99e Allow passing --qmljs-runtime to the qmlcachegen implementation
This signals qmlcachegenplus to not paste the whole JavaScript type
system into each generated file. In turn, user projects need to add a
dependency in order to build against the JS runtime.

qmlcachegen ignores the option.

Change-Id: I0f87dedb969e99e94fbb712b7faa23d84f76dfbe
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-12-02 08:59:12 +01:00
Ulf Hermann 7a7edf14ec Allow passing --direct-calls to the qmlcachegen implementation
qmlcachegenplus has an argument --direct-calls which instructs it to
call methods of known C++ types directly rather than through the JS
engine or the metaobject. This is faster but requires that all those
types are visible to the generated code. Introduce a way to pass this
option on a per-target base.

Adjust qmlcachegen to ignore the option.

Change-Id: I474e577e4a197f6ca4c8b8e868dfd39983e77041
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2020-12-01 11:20:24 +01:00
Ulf Hermann 8528bd527f qmlcachegen: Move functions to compile QML/JS files to QmlCompiler
We need to re-use them. Also, provide a way to insert AOT compiled
functions into the C++ code.

Change-Id: I7b0d13cb307e8f979745f096a9614f087d135f68
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2020-10-23 13:31:26 +02:00
Ulf Hermann db13153905 qmlcachegen: Add empty AOT built functions to the loader
This enables us to use the same generateloader.cpp for qmlcachegen and
any replacement that actually produces AOT compiled functions.

Change-Id: I12fe81236e4ef16a627729c644d54b6c171b3860
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2020-10-23 13:31:19 +02:00
Ulf Hermann 2458f07eb5 Move generateloader.cpp to QmlCompiler
We need to be able to generate the loader code from multiple places.

Change-Id: I9e04fd3583b535bc5f7d5fb293cb61309c1e199a
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2020-10-23 13:31:14 +02:00
Ulf Hermann 51f6d418fa qmlcachegen: Move resourcefilter.cpp into QmlCompiler
For backwards compatibility, a replacement for qmlcachegen will need to
provide the same functionality.

Change-Id: I22664230ea636d384190122223d15819ebee930c
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2020-10-20 17:19:26 +02:00
Alexandru Croitor 08adbefa13 CMake: Regenerate projects to use new qt_internal_ API
Modify special case locations to use the new API as well.

Task-number: QTBUG-86815
Change-Id: I3b964e3baf0cc7040830156dac30358ea1152801
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2020-10-06 13:19:37 +02:00