Resources shared by tests were incorrectly setup. Resources would
always be registered with BASE/filename as alias. In these cases the
fix is to set the alias with the original file name.
Change-Id: I667ce7b74ae5f86740c8bb8a040cc2895a3dc116
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Make sure the URI name for qml modules correctly strips out the version
number for instances such as QtQuick.Controls.2.
Change-Id: I18e706b371323eeefdd6d7564b922265fa5cad3f
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Always install qml files regardless of whether the install_qml_files
configuration is present in qmake. This was causing most unit tests to
fail due to missing qml files.
Change-Id: I53c7200cfa66805d0e459190ef105c1a73c34a5f
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Qt CMake Build Bot
PRO_FILE_PWD should return CMAKE_CURRENT_SOURCE dir without any
compenstation for mistmatching directory locations as we are doing with
PWD.
There are test that use a shared .pri project file which gets included
into the .pro file of test. In this .pri file we have a statement such
as DEFINES += QT_QMLTEST_DATADIR=\\\"$${_PRO_FILE_PWD_}/data\\\".
Since the .pri project file is located in ../../shared/shared.pri the
substitution would result in
${CMAKE_CURRENT_SOURCE_DIR}/../../shared/data instead of the expected
${CMAKE_CURRENT_SOURCE_DIR}/data.
Change-Id: Id899d6a624acc45425af47ca9aa1b332cf63e659
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This makes the SUBDIRS -= foo conditions simplified and nice to look
at.
Amends b26b1455d7.
Change-Id: I9ffe3db1e358f94fb65a885cc90c44218482825b
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Qt CMake Build Bot
Setting the "QT" SetOperation which defaults to "core" and "gui",
should only be done once on the top-level .pro scope. To distinguish
the top level scope, we need to check for both an empty parent_scope
and an empty base_dir.
Amends 9e96c38426
Change-Id: I9db1cbf0e6592c8c195d11b97b3eff40b1adbcbd
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Dictionaries are mutable, and should not be assigned as a default
parameter.
Change-Id: Id08c17f89c17b404560241849603e1e1a0ec6562
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
It has been decided, that going forward all qml files are to be added
to a module via the resource system. This patch does the ground work
to make sure all qml modules in the qt codebase follow these new
conventions.
New properties on targets have been added so that we can't track all the
qml related information for later use.
To make sure it is still possible to install qml files we added the
qt_install_qml_files() command.
Pro2cmake has been adjusted to handle the special cases of versioned
qml modules (e.g: QtQuick.2). It will now insert a TARGET_PATH
override to avoid the default conversion from the URI parameter.
Finally, this patch temporarliy disables the quick compiler by moving
all relevant code into a dummy function. This will be removed in a
follow up patch where the quick compiler will be enable for all
qml files present in resource files.
Change-Id: I09fe4517fad26ec96122d9c7c777dbfbd214905c
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
If unset QT by default has value: "core gui". This patch adds this
behavior by pre-defining the value in the root scope.
qmimedata CMakeList.txt was re-generated.
Change-Id: Ib8b6064bc46c72d829e0077d09f21bbfb494e137
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Liang Qi <liang.qi@qt.io>
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
CMake doesn't support removing subdirectories therefore one need to
convert all removal to conditional adds. The resulting code doesn't
win a beauty contest. That is because handle_subdir works on already
processed strings which means it doesn't have access to the boolean
operations. As such it can not minimize the expressions, but it works
and in the most simple cases it is pretty good.
The patch re-generates CMakeLists.txt under tests/auto/corelib/kernel
excluding qcoreapplication, qmetatype, qmimedata, qobject, qtimer,
which are suffering from unrelated problems, like for example Gui,
pthread linkage issues.
Change-Id: I18a02f6eda7a3b41b1313211c8bc9ce277bb67be
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This patch adds support for the qtquick compiler feature, which
will embed the compiled qml files as resources along with the
respective qml_loader.
This patch also changes the add_qml_module call to require either
EMBED_QML_FILES and/or INSTALL_QML_FILES to be specified.
Change-Id: I32d29c9b554b8286ed3b980027a56dd4abe11c92
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
QT_SOURCE_TREE is a variable that is set in qtbase/.qmake.conf.
In qtbase, it's used throughout various
projects to find cpp sources when building standalone tests (among
other things).
Everything works fine with qmake, because even if qmake is invoked
on the tests subfolder, qmake searches up the source directory tree
until it finds a .qmake.conf file, and uses that.
When building qttools with qmake, the qdoc project expects
to have a QT_SOURCE_TREE value, but it's not actually set in the
qttools/.qmake.conf file, so the generated include paths that use
that value are incorrect. Curiously the build still succeeds.
Now in CMake land we replaced QT_SOURCE_TREE with
CMAKE_SOURCE_DIR, but that does not work properly when doing a
standalone tests build, because the project in that case is the
tests one, and not the qtbase one, so configuration fails in a
developer build when trying to configure some private tests.
So far I've found that only qtbase actively uses this value.
A temporary fix is to save the qtbase source directory into a
QT_SOURCE_TREE variable inside the generated
BuildInternalsExtra.cmake file.
The pro2cmake script is changed to handle presence of QT_SOURCE_TREE
in a qrc file path. This is handled by finding the location of a
.qmake.conf file starting from the project file absolute path.
This is needed to stop the script from crashing when handling
the mimedatabase test projects for example.
The change also regenerates the relevant failing test projects, and
thus standalone tests (when doing developer builds aka private_tests
enabled) now configure and build successfully.
Change-Id: I15adc6f4ab6e3056c43ed850196204e2229c4d98
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Make sure to handle glob expressions in the entire path given, not just
the end of the path. This handles tests like qsslkey and qnetworkreply.
Also copy/install the testdata in the final test directory path under
a "testdata" subdir.
Previously INSTALL_TESTDIR was used, which was never set to anything.
Change-Id: I2408e12f586cadeb524ffa249e851a4179324b23
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Some projects in QtQuickControls force the qml files to embedded into
the binary. This change exposes an option to mimic that bevhavior.
Change-Id: I4cbf0c21c05ca03b8dd1189eb7d81e43279c7157
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Use a the more appropriate scope.get_files() to retrieve the qml file
list from the qmake project. This makes it more consitent with the
rest of the conversion script and fixes some issues with incorrect
aliases in qrc files.
Change-Id: I8907516be9457ba0d60d14af53d241197637aa9f
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Extend add_qt_test for qmltest by setting the option QMLTEST
when we detect the config qmltestcase.
We also forwards the GUI option to the tests when detected.
This is a requirement for some QtQuickControls2 tests.
Finally when doing a prefix build, we add the install directory
to the QT_PLUGIN_PATH environment variable.
Change-Id: I3b2ecb494955976e98abbcf3d03925c314336122
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
"mac" scope in qmake actually means all mac platforms,
just like "darwin", aka macOS, iOS, watchOS, etc.
Regenerate corelib, gui and testlib after this modification.
This is a requirement for the iOS port.
Change-Id: I029c7e907d13f6ec31816a08602a5930f9ac16a7
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Qt CMake Build Bot
Reduce the amount of code required to add a qml plugin to cmake
by making add_qml_module wrap the add_qt_plugin code where required.
add_qml_module will also create a dummy target so that qml files
will appear as source files in an IDE when no cpp files are present.
CXX_MODULE qmake parameter has been dropped in favor of an
explicit IMPORT_VERSION parameter, since it was only used to
determine the version when the IMPORT_VERSION was not specified.
Change-Id: I4a4b626566720d04c62d246ca521db8c4a95b10f
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
The pro2cmake conversion was not processing private libraries specified
with the QT_PRIVATE variable.
Change-Id: I0c44595bb8e1ed9a748af51a2a859bee62e7d264
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
When a feature generates a private feature, we should not just repeat
the condition but also make it depend on the original feature. In qmake
features had different outputs, while we have a 1:1 mapping. For example
the developer_build feature had "private_tests" as an output feature.
There's no condition attached to the feature and auto-detect is off, so
we'd generate
qt_feature("developer_build" AUTODETECT OFF)
qt_feature("private_tests" AUTODETECT OFF)
and that's wrong, because when the user enables the visible feature
(developer_build) we want it to propagate to the private_tests feature.
Change-Id: Id8408864802fa1e1ed9e67a5f47d1d2fde38d321
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
We have to treat the resources from mimetypes in corelibs specially
as they are reused for two test cases. Since we no longer use the qrc
files, we have wrapped the relevant code in a function that can be
called for every target that depends on it.
This change also corrects formatting for the generate CMake code
regarding resource commands.
Change-Id: I50a05c81151d75aefc9ca165f5ffeb9f5cd77162
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Allow _expand_value to expand variables that may have more than
one level of expansion when the regular expression covers all
of the input. E.g.:
A = Foo
B = $$A/Bar
scope.expand('$$B')
While the original code was able to expand the string '$$B/source.cpp' to
'Foo/Bar/source.cpp', it could not expand the string '$$B' completely.
The latter would always return '$$A/Bar' instead of the expected 'Foo/Bar'
string.
A test case has been added which coveres the above example.
Change-Id: Ie3b5739c24ecbeb67d408dd204b0f54bab1d0f3f
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
These changes enable the support to handle test data and install or
package them as resources when appropriate.
This change does not handle the GENERATED_TESTDATA or
TEST_HELPER_INSTALLS since there are very few occurrences of these and
we can handle those as special cases.
Finally, in add_qt_test, only append CMAKE_CURRENT_SOURCE_DIR if
the path is not absolute.
Change-Id: Ic20b9749d10e2a09916f2797606116471c64850b
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Add the necessary code to both the QtBuild and pro2cmake to be able
to handle qml plugins in qt declarative.
Add condition replacement for QTDIR_build to QT_BUILDING_QT so that
certain qml examples work correctly when being built in the build
directory.
Fix add_qt_resources not being updated during build after changes
were made. Files list used as dependencies were not populated.
Add missing module mappings for qtdeclarative.
Change-Id: I0f71d0a3a0e7e97ba96807950d11cffaee04d9b2
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Qt CMake Build Bot
Tests in qtdeclarative were failing because the above variable was
expanded to an empty string. This causes the tests to be unable to
locate their test data when executed.
Change-Id: Ibc3c094123f25d688a73c11886ac1673b6930c54
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@qt.io>
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
The xcb feature controls whether to build the xcb platform plugin. The
feature depends among other things on
qt_find_package(XCB 1.9 PROVIDED_TARGETS XCB::XCB)
to succeed. This means at the moment setting XCB_FOUND to true, that's
what the condition checks.
Later on, in configure.cmake, we also check for other components in the
XCB package, for example:
qt_find_package(XCB COMPONENTS XINPUT PROVIDED_TARGETS XCB::XINPUT)
If this component is not available, the xcb platform plugin has perhaps
reduce functionality, but it should be built and the feature should be
abled. However it isn't, because when that find_package call fails,
XCB_FOUND will be set to false. And that in turn will disable the
feature as the condition fails.
Therefore this patch changes the condition to check for the presence of
the XCB::XCB target instead.
Change-Id: I534087d8c3b7ff5edf81a5ffcf16cc0bb78b9fb7
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Generate the ${MODULE}-android-dependencies.xml for the androiddeployqt
tool. This will ensure all the right plugins and dependencies are
packaged when generating the apk.
This change also changes the visibility for executable to default/public.
Not having this will cause the application to crash as we can't locate
main() in the executable (shared library).
Additionally pro2cmake conversion script has been updated to perform
the required conversions for the Android settings.
Finally, the 6 projects in QtBase that have Android dependencies have
been updated with the new script and the step that produces the xml
files in run at the end in QtPostProcess.cmake.
Change-Id: I9774ba1b123bc11cae972fa37054ef2c51988498
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
This changes many different CMake places to mention Qt6 instead of
Qt5.
Note that some old qt5 cmake config files in corelib are probably not
needed anymore, but I still renamed and kept them for now.
Change-Id: Ie69e81540386a5af153f76c0242e18d48211bec4
* Simplify add_qt_gui_executable() to not require WIN32/MACOSX_BUNDLE
but provide it implicitly. It's redundant :)
* When on Android, build a module (shared library), just like qmake.
This requires an additional library destination in the install() call,
but that's ignored on other platforms.
* Fix typos in the android deployment generation settings function
* Use the correct cache variable to determine whether we're inside a Qt
build or not. Right now this only works inside Qt builds anyway as
QtPlatformAndroid.cmake is not publically accessible.
Change-Id: If1c763c31a7a83d0e0d854362ba7901657f63eb5
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Qt CMake Build Bot
Provide add_qt_gui_executable() as function in our public API that takes
care of automaticWinMain linkage. We can use this in the future to
encapsulate similarplatform-specific behavior and adjustments, such as
module generation onAndroid.
In order for the examples to see the function in Qt5CoreMacros, three more
additional fixes were required:
* Do the build_repo_end() call _before_ attempting to build the
examples, as we need the build_repo_end() to include QtPostProcess
and complete the creation of all the target config files.
Otherwise the find_package() calls in the examples see something
incomplete.
* Add more QT_NO_CREATE_TARGET guards
* Always call find_dependency on the dependencies, regardless of the
target creation mode. This way a find_package(Qt5 COMPONENTS
Widgets) will still load Qt5CoreMacros.
Change-Id: I03ce856e2f4312a050fe8043b8331cbe8a6c93e6
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
There were some issues with not finding the git executable and
trying to remove read-only files / files that are still held
by a process.
Change-Id: I7f587c4e96cff763cc0b3438d9ed2249da8f122f
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Fix incorrect usage of CMAKE_CURRENT_BUILD_DIR, there is no such
CMake variable, it's actually CMAKE_CURRENT_BINARY_DIR.
Also if the host_build option is set when building a module,
the library should be a static library.
Change-Id: I9fb39905118dbd7f33d9821960eaed11f20b30c6
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
This is needed for QmlDevTools in qtdeclarative.
Change-Id: I41adec15f292c91192e171b45d1e5d48764c37c4
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Comments should be removed before line continuations, otherwise
the semantics of an assignment change.
Found this during reconversion of qtimageformats.
Adjust test to specifically test for all the expected values.
Amends 76f5b784ce.
Change-Id: Iaa46bbc9cbd7b2390fe9b5f0078ac33d225a9258
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
The auto-generated add_subdirectory conditions in qtimageformats use
QT_FEATURE_foo and not QT_FEATURE_system_foo.
But the non-system ones don't actually check if the respective
qt_find_package(TIFF) got found.
Fix the conditions of the non system features to be the same as the
system ones.
Change-Id: I96f889cf7061721b829d562707c42aa0e29720df
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Generate a pri file for public and private interfaces, but map CONFIG +=
internal_module to a cmake option and skip the former if set.
Task-number: QTBUG-75666
Change-Id: I3f4baf1277094f4c22149a9e8769734baf9a235f
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
The WrapPCRE2 package handles the PCRE2 packages that have targets,
and reuse them.
Change-Id: I24b0b51f507703cd8287f845f7e425f62dd2c3d6
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Some features check for module / target existence. Adapt conversion
script to handle that.
Reland after fixing it.
Change-Id: If4fb942c2e0d16e76a0b9b767bf478527851b0f7
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Only re-enable exceptions for the modules that do
CONFIG+=exceptions
in qmake
Change-Id: I9f19078adbdc1b8fa3d4102fb51a099e7e35522e
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
It breaks some conditions, and then the build fails not finding
some private header files in qpa, etc.
This reverts commit 35dc8f496d.
Change-Id: I1b51eac06fe9186181d3f0a7c78f22da7be534e2
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
Some features check for module existence. Adapt conversion script
and QtBuild feature condition parser to handle that.
Change-Id: I063e49a6fe9f8e9cf3aec985fd78ed4430398586
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Add two new options:
If you pass --only-existing, the pro2cmake script will only be
executed on .pro files that already have a CMakeLists.txt next
to them. This is useful if you modify pro2cmake, and only want
to regenerate existing files.
If you pass --only-qtbase-main-modules, the script will be
executed on the main modules in qtbase/src. This is useful
if you want to check if your pro2cmake modification
works correctly on the more complicated projects.
Change-Id: I5228411a252dbef6d77f01ca742a7b98583c5a75
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Qt CMake Build Bot
Initially it was added as a required argument, but not all usages of
the function where adjusted, so the script failed. Make it optional.
Also change the styling of the argument to be snake cased.
Amends 8fea3ec4e7.
Change-Id: I568800401bb5af153b7bb5229f134c2f74b87468
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Qt CMake Build Bot
When using run_pro2cmake.py, it spawns multiple instances of
pro2cmake.py.
If more than 1 of the instances need to git add prev_CMakeLists.txt at
the same time, git add might fail due to the acquired index.lock.
The cleaner solution would be to use a file lock as a mutex, but that
requires an external pypi package.
Use a poor man solution of retrying the git add with a time delay for a
finite amount of times.
Change-Id: I2031f6e29ae499526cb4f1753e4387e7f4fab0ab
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Make sure to set the author user and email for the temporary git repo,
so that the commits succeed on systems that don't have a global git
author.
Also fix run_process_quiet to print stderr and stdout in case if the
execution failed for some reason.
Change-Id: I0ddb61730114b3e9c59e2d23480df0ced8d6e772
Reviewed-by: Albert Astals Cid <albert.astals.cid@kdab.com>
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Fixes the situation where we end up with e.g.:
```
target_link_libraries(...
)target_link_libraries(...
)
```
Change-Id: I455563b24850db7f389746385af53cd606343274
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Changes:
- Make sure the footer is passed along to callees
- Make sure RESOURCES are part of add_executable(...) for AUTORCC
Change-Id: I4546bacd2e41ca8acc1a9351af54d325afb715ab
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
This commit introduces infrastructure work to allow static builds of Qt
to handle importing of plug-ins.
Change-Id: Ife0ca3ca7276ea8ec96fe0eb6adf934fad7620ec
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Need
qt_find_package(X11_XCB)
in src/gui/configure.cmake since we're using it in the file
qt_feature("xcb_xlib" PRIVATE
LABEL "XCB Xlib"
CONDITION QT_FEATURE_xlib AND X11_XCB_FOUND
)
Need
qt_find_package(XRender PROVIDED_TARGETS PkgConfig::xrender)
in src/plugins/platforms/xcb/CMakeLists.tx since we're using it in the
file
extend_target(XcbQpa CONDITION QT_FEATURE_xcb_native_painting AND QT_FEATURE_xrender
PUBLIC_LIBRARIES
PkgConfig::xrender
)
Use capital XRender in pkgconfig to be more consistent on how XRender is
called everywhere else
Change-Id: I403ead2cc123b08f741c5142f20db88987657ba8
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
qtdeclarative has a few conditions that check the gcc version
via variables like QT_GCC_MAJOR_VERSION.
To handle that, parse the CMake compiler version using
qt_parse_version_string() into separate variables like
QT_COMPILER_VERSION_MAJOR, QT_COMPILER_VERSION_MINOR and
QT_COMPILER_VERSION_PATCH. We can then map the conditions
appropriately.
Also, handle isEqual(foo, bar), which is equivalent equals(foo,bar).
Change-Id: I74575c733b44f1f42451e00038b3f113fd353915
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Hardcode a few cases regarding scopes containing "qtConfig(opengl)".
These arew few, and contain regular expressions, to just manually
check and replace them.
Add a new entry to _qt_library_map for handling QmlModels module.
Fix Scope.children property to recursively access the .children
property on included scopes (instead of just ._children) so that
we get the full list of scopes from included children that include
other scopes. This is needed for nested .pri files.
Fix mapping of "win*" to WIN32.
Change-Id: If949a8051f517683e56cda605733719daadb384a
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
Reviewed-by: Qt CMake Build Bot
The features are reused in qtdeclarative (and maybe somewhere else
too), so they should be present. We can still map the conditions
to proper CMake compile feature tests.
Change-Id: I4d307d29d4d293cc23ab005b195ea346087c7162
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Generate module .pri files
* Generate qconfig.pri
* Propagate MODULE_CONFIG from the .pro files
This enables the basic use-case of simple application builds that for
example use the moc. Omitted from the patch is support for private
module configurations, prl files (should we do this?) and possibly more
hidden gems that need to be implemented to for example support building
Qt modules with qmake.
Task-number: QTBUG-75666
Change-Id: Icbf0d9ccea4cd683e4c38340b9a2320bf7951d0d
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
When we replace the PWD key from qmake files and both the base and
current directory are the same, there's no need to add an extra './' to
the current working directory.
This also fixes a unit test in qtsvg as it requires the passed in path
to match exactly to the one outputed in the log files.
Change-Id: Ide9ca6a70493e8039d3af84a9e576d8f6a313f2a
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Added library mapping information for any projects referencing the
QtNetworkAuth project.
Change-Id: I9c4309d26ee9895f94995d4844ffde4ee4444766
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
These were some hard requirements while porting QtQml .pro files so
that the generated CMake code is syntactically correct and the result
buildable.
This include handling of a few more different condition scopes
and disabling the c++ make_unique feature test.
Change-Id: Iae875ffaf8d100296e8b56b57d076455e5d72006
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Some configure.json files contain new lines inside quoted strings,
which is not conformant with the JSON spec.
Add a new json_parser python module which uses pyparsing to preprocess
the json files to remove the new lines inside the quoted strings, and
then hands over the preprocessed content to the regular json module.
Change-Id: I5f8938492068dda5640465cc78f5a7b6be0e709a
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Qt CMake Build Bot
We constantly had to adjust the qmake grammar to handle line
continuations (\\\n) in weird places. Instead of doing that,
just do a preprocess step to remove all the LCs like we do with
comments, and simplify the grammar not to take into account the
LCs.
From some manual testing it doesn't look like we get any regressions.
Change-Id: I2017d59396004cf67b6cb54977583db65c65e7d3
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
setName() and setDebug() need to be called on a parser element before
the parser element is used as a sub-element in another parser element,
otherwise the debug output is not shown.
Hence the "iterate over all locals" approach works only partially.
Instead add a new decorating function add_element() for the
construction of each parser element, and make sure to enable debugging
inside that function.
Unfortunately there is no clean way to avoid duplicating the parser
element name both in the local variable and in the function argument.
Change-Id: Iaa9ed9b7dbb22ec084070b9c049cf51c841d442c
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
Some qtdeclarative pro files caused exceptions when trying to parse
them using the script. This included the following:
- handling conditions divided by newlines and backslashes
- handling conditions that have no scope
The parser has been fixed to deal with those cases and relevant
tests were added.
After the change, all qtdeclarative project files are parseable by
the script.
Change-Id: Ib9736423f7fb3bcc1944b26cfb3114306b4db9a7
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
Override the default debug actions to be decorated with proper
indentation for easier reading.
The setup only has to be done once, and not on each QMakeParser
creation.
Change-Id: If5f965b462c782c654ee8ebfdd33570e8f94b084
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
Before this patch we enabled AUTOMOC, AUTORCC, AUTOUIC for all targets
that did not opt out.
Aside from being wasteful from a performance point of view,
this also caused issues when trying to build qtimageformats which
does not depend on Widgets which is the package that exposes uic.
To avoid this, enable only AUTOMOC for all targets by default, and
UIC and RCC can be opted in via the ENABLE_AUTOGEN_TOOLS option.
To facilitate this some refactoring had to be done, like moving some
common setup for all autogen tools into a separate call, and making
sure that extend_target understands the autogen options, because some
ui files are only added conditionally.
Also the conversion script has been adapted to output the
ENABLE_AUTOGEN_TOOLS option whenever a .pro file contains at least
one FORMS += foo assignment.
Note that we don't really use AUTORCC while building Qt, so nothing
opts into that at the moment.
Task-number: QTBUG-75875
Change-Id: I889c4980e9fb1b74ba361abed4044737f8842ea4
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Handle a few more libraries that are used in qtimageformats repi.
Change-Id: Ia3b9a845bc6cb8ce98a477b9355011bbadc32c1a
Reviewed-by: Liang Qi <liang.qi@qt.io>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
The previous fix where the Grammar comment style was changed to
remove the newlines was incorrect, because if you have
foo=1#comment
bar=2
after the Grammar comment ignoring, it would transform into
foo=1bar=2
which will clearly fail to parse, so the new line has to stay.
But we would still have the following case which would fail:
foo=a \
# comment
b
Apparently qmake things that's the equivalent of
foo=a b
but the grammar parses it as
foo=a \
\n (newline)
b
Thus the parsing fails because there's a newline and then some
weird 'b' token which the grammar does not expect.
The best fix I found is to preprocess the source, to remove
completely commented out lines.
So:
foo=a \
# comment
b
gets transformed into
foo=a \
b
Change-Id: I2487a0dbf94a6ad4d917d0a0ce05247341e9b7da
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
It doesn't make much sense to look for X11 related packages on
macOS and Windows by default. Usually they would not be there, and
as a result the configuration step would show a long list of scary
not found packages, and also eat precious configure time.
Change the conversion script to allow putting conditions around
generated find_package calls.
These conditions can be manually set in the conversion script
library mapping, using the emit_if argument,
which we do for the X11 and Wayland related packages.
They are also computed by checking which features use a given library,
and if the feature is protected by a simple emitIf condition like
config.linux, the relevant library find_package call will be protected
by the same condition.
If a developer still wishes to look for all packages, they can define
the CACHE variable QT_FIND_ALL_PACKAGES_ALWAYS to ON.
The relevant configure.cmake files are regenerated in this patch.
Change-Id: I6f918a94f50257ec41d6216305dae9774933389a
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
cmdline implies console, so use that also to determine if a binary
should get a GUI flag.
Change-Id: I084e0a45785df96a7dc2c101af5305fbb39efbc3
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
There are still call sites that call Operation.__init__ with a string
instead of a list. Restore the handling of such a case.
Amends 5fe8a38af3
Change-Id: I2a4d5c5cb5b460bf02b6da02d42d8cc8d5eb4192
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
and plugins.
src/network/network.pro for instance depends on core-private, but
because we ignore adding QtCore as a public dependency, the exported
Config file for Network doesn't depend on QtCore anymore, so if a user
only links against Network, they won't automatically link against
Core.
Change-Id: I4a60ffae7e071927360b8ccf6b1b7479ab391060
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
For some reason the python comment regex that we used does not ignore
the line break at the end of a comment line.
This caused issues when parsing multi line assignments with comments
in between.
Use our own regex for comments to circumvent the issue. It was found
while trying to port the qtimageformats repo.
Added a pytest as well.
Change-Id: Ie4bbdac2d1e1c133bc787a995224d0bbd8238204
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
Fix test_operations and do some small mypy cleanups along the way
Change-Id: I6586b5d3491e5dcf44252c098516f0922fa60420
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
DBus1 (1.12) configuration file breaks PKG_CONFIG environment
variables and will thus prevent other libraries to be picked up
by pkgconfig. Main sympthom is that xproto is not getting picked
up anymore, which results in hundreds of lines of warnings about
this being printed.
Work around that by wrapping the call to find_package(DBus1) and
restoring the environment.
Change-Id: Ia69f10b014dddc32045b40972500a843e5d29b38
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
The pro2cmake.py file is now smarter, and can reapply "special case"
modifications after regenerating a CMakeLists.txt file.
This substantially lowers the maintenance burden when regenerating
many files at once.
See the special_case_helper.py file for details on how it works.
Make sure to commit the generated .prev_CMakeLists.txt file alongside
your CMakeLists.txt changes.
To disable the preservation behavior, you can pass -s or
--skip-special-case-preservation to the script.
To keep around temporary files that are created during this process,
you can pass -k or --keep-temporary-files.
To get more debug output, pass --debug-special-case-preservation.
Fixes: QTBUG-75619
Change-Id: I6d8ba52ac5feb5020f31d47841203104c2a061d8
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
Extract code to write find_package lines from configurejson2cmake.py
and move this over into helper.py.
Change-Id: Iefd313b2a56cb78a99a7f3151c3f6c6284482f79
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Separate the logic to find all used libraries from the code that writes out
the link_library information into the CMakeLists(.gen)?.txt files.
This patch will remove some "PUBLIC_LIBRARIES Qt::Core" from generated files.
This is due to us handling some Qt libraries in special ways in some of our
add_qt_* helpers. These special libraries were added to the LIBRARIES section,
but actually they should be added to the PUBLIC_LIBRARIES section instead. Do
so now, so that the newly generated files do not break things again.
Change-Id: I588781087a8aecc4d879e949735671d8085f0698
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Extract the actual functionality to write a list of "things" below
headers and/or cmake parameter and followed by a footer.
Reuse this functionality everywhere we write a list of things.
Change-Id: Ia7647be465b4788a2b1e6a5dbede1ca868f24ae2
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Examples need to be built stand-alone and as part of Qt, so they
need a special CMakeLists.txt file that supports both use-cases.
Add an --is-example switch to pro2cmake to make it generate these special
CMakeLists.txt files.
This is basic support only and is currently still missing the necessary
find_package calls.
Change-Id: Ie770287350fb8a41e872cb0ea607923caa33073d
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
vcpkg and upstream CMake find module define different target names for
the same package. To circumvent this, create our own Wrap find module,
and link against it. Inside the find module, try both target names.
Change-Id: Iba488bce0fb410ddb83f6414244f86ad367de72b
Reviewed-by: Liang Qi <liang.qi@qt.io>
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
Otherwise if you call the script from a different directory, path
handling becomes broken and certain files are not found.
Change-Id: Ia2f60abbd312a771330b3d5e928e1ccd0b4a845b
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
This detects doubleconversion as a 3rd party library.
This fixes defaulting QT_FEATURE_system_doubleconversion to 'ON'.
Change-Id: I9d18dbbb6f7a99f6a5c674bed3013b96f19bf6e0
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Fix library substitution again which broke when I merged all the
library related pieces of information.
Keep Qt and 3rdparty libraries separate so that dbus does not get
mapped into Qt::DBus (or the other way around).
Make names in helper.py more consistent while at it.
Change-Id: I5e5bf02bdabf8bafe991c5701deca76bde4df2c3
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Merge all data related to mapping libraries into one data structure
in helper.py.
Use that data for everything related to library mapping.
This change enables way more features now like e.g. adding find_package
calls into generated files.
Change-Id: Ibbd2a1063cbeb65277582d434a6a672d62fc170b
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Do not set properties of packages to type OPTIONAL. That is the default
anyway.
Update generator script and generated files.
Change-Id: I7a4d043b69c93ce8c2929a2e27ac6a07e4e6d8cc
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
This change introduces a new function called qt_find_package()
which can take an extra option called PROVIDED_TARGETS, which
associates targets with the package that defines those targets.
This is done by setting the INTERFACE_QT_PACKAGE_NAME and
INTERFACE_QT_PACKAGE_VERSION properties on the imported targets.
This information allows us to generate appropriate find_dependency()
calls in a module's Config file for third party libraries.
For example when an application links against QtCore, it should also
link against zlib and atomic libraries. In order to do that, the
library locations first have to be found by CMake. This is achieved by
embedding find_dependency(ZLIB) and find_dependency(Atomic) in
Qt5CoreDependencies.cmake which is included by Qt5CoreConfig.cmake.
The latter is picked up when an application project contains
find_package(Qt5Core), and thus all linking dependencies are resolved.
The information 'which package provides which targets' is contained
in the python json2cmake conversion script. The generated output of
the script contains qt_find_package() calls that represent that
information.
The Qt5CoreDependencies.cmake file and which which dependencies it
contains is generated at the QtPostProcess stop.
Note that for non-static Qt builds, we only need to propagate public
3rd party libraries. For static builds, we need all third party
libraries.
In order for the INTERFACE_QT_PACKAGE_NAME property to be read in any
scope, the targets on which the property is set, have to be GLOBAL.
Also for applications and other modules to find all required third
party libraries, we have to install all our custom Find modules, and
make sure they define INTERFACE IMPORTED libraries, and not just
IMPORTED libraries.
Change-Id: I694d6e32d05b96d5e241df0156fc79d0029426aa
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
With qmake if we don't find a system package, we use the bundled one.
With CMake we don't provide a bundle freetype, hence it's required
to find a system one (or custom provided one).
Change-Id: I00a5e2ac55459957dae0729f89bafa792a102152
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Qt 5.12 comes with xkbcommon_support now. Map that accordingly.
Change-Id: Id10708349d377f6bdfed654428ebcef0b533bd69
Reviewed-by: Albert Astals Cid <albert.astals.cid@kdab.com>