Prefix by python executable and drop os.nice.
Change-Id: Idd1d0de6695887652db84261da1130a084e5af78
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Qt CMake Build Bot
Change-Id: I8113d7dd4e7967d020d59a5b4104e8366d55283c
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Almost every non-trivial .pro file has line continuations.
Remove the warning as there's nothing the user can do about it.
Change-Id: Ic8a54e5e5cc39a31267800edde4b0ff2b0276a48
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Given HEADERS = $$PUBLIC_HEADERS $$PRIVATE_HEADERS
$$PUBLIC_HEADERS can be expanded into a list of source files
which in turn contain $$PWD/foo.cpp.
The $$PWD needs to be expanded as well.
This is the case for qtwebsockets/src/websockets/websockets.pro
project.
Change-Id: I3aa14203ee8d177fadd12a7e3212c3250970e0a8
Reviewed-by: Liang Qi <liang.qi@qt.io>
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
We should use the new relative path to the project, instead of the old
specified on command line.
Change-Id: I54cb1cefd4df079a95c364b7c7c66c36941add01
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
Some modules define their own manually-maintained lists, and we can rely
on the headers generated by each module to include in the pch as well
e.g. QtCore/QtCore.
There's also e.g. QtWidgetDepends for QtWidgets, but this only
works for modules, not for tools, examples or other applications.
For now we'll use the Qt<Module>/Qt<Module> headers for the
modules we depend on.
Building with PCH can be disabled with -DBUILD_WITH_PCH=NO, and it only
works for versions of CMake newer than 3.15.20190829.
Change-Id: Iae52bd69acfdfd58f4cd20d3cfa3c7f42775f732
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Specifically skip cmake tests projects (because they are only needed
when Qt is built with qmake).
Also skip test qmake projects in qmake's test suite.
We might find more tests to skip in the future.
Change-Id: I4c3a42db669b31e81fd06206652371b6a70fd8ce
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Qt CMake Build Bot
If the project path starts with "examples/" relative to the repo
source directory (which is decided by location of .qmake.conf),
consider the given project file to be an example.
This makes the usage of run_pro2cmake.py easier, specifically by
being able to point it to a repo source directory, and getting most
project conversions correctly.
Change-Id: I93de98f8fc97af509c1f96cdebad3681190a53d1
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
The script now detects whether the project file given is a:
- top level qmake project (qtdeclarative.pro)
- top level tests project (qtdeclarative/tests.pro)
- top level examples project (qtdeclarative/examples.pro)
This is done by finding the .qmake.conf file in parent directories of
the given project, and comparing the project's location to the
.qmake.conf location.
For the top level qmake project and the tests project, the script will
now use a predefined block of code that we usually had to copy paste and
change manually. Now only small bits will have to be adjusted manually
(project name and dependencies).
For the examples project, the content is surrounded by the required
build examples commands.
As a result, developers will have to worry less about knowing where to
copy paste from.
Change-Id: I4f751b371e74eeb86e070d58635c3d99b970ab18
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Change-Id: I8cb97afaaed46ee64b5a133e797179d7ddecdeef
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
We use
qt_find_package(harfbuzz PROVIDED_TARGETS harfbuzz::harfbuzz)
which would set harfbuzz_FOUND. Since variable names are case-sensitive,
this is also the name we must check for in the qt feature condition.
Change-Id: I43420489c3310bc9c3e5cc798a005c8d5b0ab646
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Conditions scopes that had "else" were not handled properly.
The "else" condition should be expanded to its proper negative full
form.
Also every condition "piece" should be wrapped with parentheses before
being passed to sympy simplification, to be sure that boolean
operator precedence is applied properly.
Refactored the code a bit to make it easier to read.
Change-Id: I4726845b867f93c3afbc9362cdce1cd063ccff63
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Essentially pass them through without failing the whole
conversion process.
Change-Id: I7bbd198203f79b45120a7254e2ecdf58e32f9525
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
no-png is an old unused scope that should be mapped to the png
feature instead.
Map contains(QT_CONFIG, shared) to correct variable check.
Sympy doesn't like dashes in indentifiers, so replace all of them
with a _dash_ token which will be replaced again at the end
of the condition simplifying.
When doing sympy preprocessing, fix mapping of target names that
don't contain double colons.
Change-Id: Id3d37800665c96505b7cbb1d80fdbed59c3ae9c0
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Designer components target names need to be prefixed with Qt.
Change-Id: I13037820b080d88cd670f2db97232509eb868daf
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
The libclang test is implemented as a custom FindWrapLibClang module.
The module does mostly the same things as the configure test in qmake
land.
Change-Id: I965f284baf7daef074e22f033047c35a917c8808
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Remove repeating '../' pattern from target names, since we generate
the targets in the correct location with CMake.
Change-Id: I89d527a9ad717f742f8d0e5921f378e6ac0a229d
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Use GLOB_RECURSE for testdata instead of globbing the top level folder.
Although RCC supports scanning directories, it will result in alias
collosions and test not being able to find the files on platforms
where test data is embedded into the binary.
Change-Id: I35d3d46a5d9fcafa5c8dc833eafdd0044ffe355f
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Update all public Qt macros to use qt6/QT6 instead of qt5/QT6.
Change-Id: Ib178f4fa21f37dfb8da7d4d8c097aa0e96c9d9f9
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Also add support for modules that have no private module counterpart.
Both are needed for Designer's QtUiPlugin in qttools.
Change-Id: Ia7e9d8837140e1de5cd59e196b4f63481ab68298
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
Reviewed-by: Qt CMake Build Bot
Update pro2cmake to generate CMake projects where resources are handled
via the QT5_ADD_RESOURCES command.
Change-Id: I66dc2174a45fc652fd8c9b7e3c0f46f58ae02c0c
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Qt CMake Build Bot
Add command line argument to make run_pro2cmake invoke pro2cmake with
the --is-example option so we can convert examples in bulk.
Change-Id: I162eddffc509f16a97de5517698e8daca5207b74
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Teach pro2cmake to use add_qt_test_helper instead of
add_qt_executable when the qmake 'qt_test_helper' feature is used.
Don't use macOS bundles when building tests on macOS, because that
breaks path assumptions for certain tests.
Introduce a new OVERRIDE_OUTPUT_DIRECTORY option for add_qt_test_helper
that allows placing the binary into a folder other than the test parent
folder. I considered changing the default behavior not to place into the
parent folder, but that would break all existing tests, so I opted for
override approach instead. Ultimately we might want to revisit this
later.
Change-Id: I68fd1dea608333c2af0d3896050b40a6964dd87f
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Rename the alias property used by add_qt_resource() to QT_RESOURCE_ALIAS
to match property naming conventions.
Change-Id: I97b12b0b794e158f03dabeed5ec23a3b7d56cfbb
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Support translating the QTQUICK_COMPILER_RETAINED_RESOURCES variable.
Fix missing PROPERTIES keyword for set_source_files_properties() commands.
Apply source file properties to standalone source files as they appear
in the project as it was possible for them to inherit values that were
not meant for them.
When creating resource lists, prefix them with the resource name
to avoid collisions.
Change-Id: I69ef85ea9414c0e7c07b1ebfb76d24bd878ce70f
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
This is required for paths that contain spaces, otherwise the .qrc
file generated by the build system is invalid, and the RCC run fails
at build time.
Change-Id: I887100b08052b49dd7ea4dd92b94f357a7d9d16e
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Add QT_QML_DEBUG to target when we have qml_debug in qmake's CONFIG
variable.
Change-Id: I266c7313db12667498d4f770c73aec9e79c0b50e
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
tools/qml/qml.qrc uses prefix="something", which means that the leading
slash is implied.
Change-Id: Ia856fcef36873442a84b9162f1901cb31ca37b49
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
When DESTDIR has relative paths as a parameter we should prefix those
with ${CMAKE_CURRENT_BINARY_DIR} in order for them to be placed in
the correct location.
Change-Id: Ie9e9d656cbb54457bdf99425e3e1b05e09f20d7c
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Collect files passed to RESOURCES and write out an add_qt_resources()
call. Similarly, for each "object" passed to RESOURCES (not a file),
write add_qt_resources(), too.
Change-Id: Idbb368ebb4d003a48e7c47ebaf53a78f65ebf9b9
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This change makes the PREFIX parameter a required parameter if the
target does not specify a default. This way the behavior is clear when
reading the code: add_qt_resource() without PREFIX means it must come
frmo the target.
Change-Id: I79024e70e7b4d32a5164b93aa08ec9ff409b2d39
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
* Add support for a QT_RESOURCE_PREFIX target property, that
add_qt_resource respects. This makes it convenient to add files
to the resource system for a project without the need to repeat
prefixes. In qmake land with multiple resources they're repeated
in the foo.prefix variables or in the prefix attribute in .qrc
files.
* Since /qt-project.org/imports is in the default QML import search path
and the hierarchy under the import search paths is "regulated",
we might as well make add_qml_module set QT_RESOURCE_PREFIX on
the target. We can compute the correct value for that. This
allows removing the redundant prefix from the add_qt_resource()
calls for the qml files.
Change-Id: Ic15130dc9e432340fc3edf93e35f2a803b4b40eb
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Qt CMake Build Bot
Detect this in the conversion script and map it to a source file
property. When that's the case, avoid repeating the file list but
instead store it in a variable.
Change-Id: If3119d83914bb798766e27351746b4e867bd3ab3
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Extend the hanlding of special condtions outside single line statements.
Conditions such as 'qtHaveModule(gui):qtConfig(opengl(es1|es2)?)' would
not be handled properly.
Change-Id: I992f75311b82d84c574c9cb4ef6d7d648f425d81
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Add support to pro2cmake to handle variable assignments via functions,
e.g: TARGET = $$qtTargetLibrary($$TARGET). The evalulation of the
functions happens during parsing and is very rudementary in nature.
Currently it only covers the qtTargetLibrary(), required for certain
projects, and quote(), required for passing unit tests.
If we run into any unhanlded function an exception will be thrown.
This patch also changes the TARGET property on Scope to expand the
value.
Change-Id: I678b7058067348a3972944bdba110f556cf22447
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Qt CMake Build Bot
This patch fixes the processing of pro files that do not reside in
the current directory. Before this patch statements such as SUBDIRS +=
Foo/Bar/z.pro would cause z.pro to be parsed in the current
CMakeLists.txt. What we want instead is a call to
add_subdirectory(Foo/Bar). Failing to do so leads to issues with
relative paths specified in z.pro being invalid.
Change-Id: I7bfa7837d54877e5340081d1c9aebe855cf6796d
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Set OUTPUT_DIRECTORY on a target when DESTDIR is specified.
Change-Id: I72061ae8156356fcb2aa9ba6cb87049fcef600c7
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Qt CMake Build Bot
In some tests in qtdeclarative we have projects that are built
as a lib with CONFIG=plugin. Without these changes they would be
translated to an add_qt_module call.
Change-Id: I208d31d43b087ed0b87eb4715f6c49b218fcc2c5
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
There are project files that not only do SUBDIRS -= foo depending on
some condition, but also SUBDIRS += foo. To handle these cases
correctly we need to do a whole pass across all scopes and collect
all addition and subtraction conditions.
Once we have that information, we can compute a final condition for a
particular subdirectory. After we have the condition information for
all subdirectories, we can simplify all those conditions using SimPy,
and group all subdirectories that have the same simplified condition.
Finally we print out the subdirectories grouped by the simplified
condition.
The end result is similar to how we have extend_target() calls with
multiple sources grouped into a single conditional call, except in
this case it's subdirectories.
Amends b26b1455d7.
Change-Id: I5b648ac67264ba9a940561baee5b49c43c13b721
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Qt CMake Build Bot
Values such as Foo.2 would no longer be converted into Foo due to an
error in the regular expression.
Change-Id: I6a11d02662782094f5b264f86a930d9aaf002c77
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>