Commit Graph

513 Commits

Author SHA1 Message Date
Alexandru Croitor
1307736c7d Fix testdata handling
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>
2019-07-29 13:14:44 +00:00
Leander Beernaert
88bf485f91 Add EMBED_QML_FILES option to add_qml_module
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>
2019-07-25 09:44:03 +00:00
Leander Beernaert
a92f029e2a Fix QML_FILES conversion
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>
2019-07-25 09:42:09 +00:00
Leander Beernaert
2cc865b943 Extend add_qt_test to support qmltestcase
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>
2019-07-24 10:49:20 +00:00
Alexandru Croitor
e86509016c Fix mapping of Apple platforms in pro2cmake.py
"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
2019-07-23 10:31:15 +00:00
Leander Beernaert
31341ad63a Simplify add_qml_module code
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>
2019-07-22 14:28:19 +00:00
Leander Beernaert
ff5a75a60e Process private libraries set in QT_PRIVATE
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>
2019-07-22 08:34:54 +00:00
Simon Hausmann
fecefdd369 Fix mapping of features to private features
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>
2019-07-22 08:29:33 +00:00
Leander Beernaert
3212f1b866 Add special case handling for corelib mimetypes resources
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>
2019-07-18 08:05:58 +00:00
Leander Beernaert
341ccc3b59 Enable recursive expansion of simple qmake variables
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>
2019-07-18 07:26:01 +00:00
Leander Beernaert
ec1546afc4 Handle TESTDATA for Qt Tests
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>
2019-07-16 06:48:56 +00:00
Leander Beernaert
30b3746370 Add support for QML plugins
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
2019-07-15 12:28:12 +00:00
Leander Beernaert
faac0ef8c6 Add missing expansion for $$_PRO_FILE_PWD_
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>
2019-07-15 09:36:46 +00:00
Alexandru Croitor
4dac45c9ee Merge remote-tracking branch 'origin/wip/qt6' into wip/cmake
Change-Id: I715b1d743d5f11560e7b3fbeb8fd64a5e5ddb277
2019-07-11 17:17:51 +02:00
Edward Welbourne
a9aa206b7b Move text-related code out of corelib/tools/ to corelib/text/
This includes byte array, string, char, unicode, locale, collation and
regular expressions.

Change-Id: I8b125fa52c8c513eb57a0f1298b91910e5a0d786
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2019-07-10 17:05:30 +02:00
Edward Welbourne
8bfae093ed Add data for Windows Time-Zone IDs added in the last two years
We've not run util/locale_database/cldr2qtimezone.py for a while, so
CLDR has had time to add several more zones.  Catch up, inserting the
new entries in order.

Change-Id: I8625548b0f7775958230eccbd89b897d7afed9e9
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2019-07-01 17:48:53 +02:00
Edward Welbourne
13242673cf Tidy up in cldr2qtimezone.py and document the need to run it
It wasn't mentioned in cldr2qlocalexml.py's instructions, so I didn't
know to run it.  The data it used in an illustration was out of date.
Two tests could be combined with no loss.

Change-Id: I26e619e6210ea5b1258326fc4bc2b6aee9d6a999
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2019-07-01 17:48:32 +02:00
Edward Welbourne
bbd64f64b2 cldr2qtimezone.py: report all missing zones, rather than just the first
When scanning the CLDR data, the script raised an exception if it
didn't recognize a zone ID.  Instead, collect up such unrecognized IDs
in a list and report them all at the end, so that whoever runs this
can do them all in one go, rather than doing one, running the script,
doing the next, running the script, ad nauseam.

Change-Id: Ia659f1d1c7e1c1b4ccb87cc23828a0588a5bf958
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2019-07-01 17:48:16 +02:00
Edward Welbourne
2f19a3053e Use simpler data structures in cldr2qtimezone.py
Use tuples for the fixed data.  The numbering of rows in the data
tables isn't part of any public API, so we can change it freely; it is
thus unnecessary, as we can just enumerate a tuple of the data values
to generate sequential indices on the fly.  (Updates to the data shall
no longer need to renumber in order to insert entries.)

Restore ordering of the data tables, and remove wanton spacing from
inside parens, in the process.

Change-Id: I59956cfb6191fe729300b57070671b7e66bd0379
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2019-07-01 17:47:51 +02:00
Sona Kurazyan
ff2b2032a0 Remove usages of deprecated APIs from QtAlgorithms
Task-number: QTBUG-76491
Change-Id: I9dab736a0cbd2e86588919640c26e8ce6b3674d0
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
2019-06-29 21:58:36 +02:00
Simon Hausmann
8c60782124 Fix XCB feature detection
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>
2019-06-26 09:07:20 +00:00
Leander Beernaert
a9d2c5b6d7 Android: Final changes for APK generation
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>
2019-06-26 08:34:37 +00:00
Alexandru Croitor
fe3bd212fc Merge remote-tracking branch 'origin/wip/qt6' into wip/cmake
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
2019-06-14 16:31:09 +02:00
Simon Hausmann
efa9998521 Fix compiling of examples on Android
* 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
2019-06-12 14:19:53 +00:00
Simon Hausmann
6732fa3a29 Fix linking of examples
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>
2019-06-12 14:19:34 +00:00
Alexandru Croitor
118e04013a Improve special case handler to work on Windows
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>
2019-06-11 14:09:54 +00:00
Alexandru Croitor
44c9ad5617 Improve pro2cmake.py more
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>
2019-06-08 08:23:06 +00:00
Alexandru Croitor
38b1474c51 Handle minimal_syncqt as not running syncqt for now
This is needed for QmlDevTools in qtdeclarative.

Change-Id: I41adec15f292c91192e171b45d1e5d48764c37c4
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-06-07 09:49:15 +00:00
Alexandru Croitor
4e907f1f62 Fix comment fixup in pro2cmake
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>
2019-06-06 08:38:08 +00:00
Alexandru Croitor
82941a3f1b Fix some configure.json conditions for qtimageformats
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>
2019-06-06 06:59:48 +00:00
Simon Hausmann
a6c11d3e09 Add support for private module .pri files
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>
2019-06-05 14:39:11 +00:00
Cristian Adam
527f3bb31c CMake: Add WrapPCRE2 package
The WrapPCRE2 package handles the PCRE2 packages that have targets,
and reuse them.

Change-Id: I24b0b51f507703cd8287f845f7e425f62dd2c3d6
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-06-05 09:42:55 +00:00
Alexandru Croitor
2401435d89 Map module.gui to if TARGET Qt::Gui in configure.cmake
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>
2019-06-05 09:15:04 +00:00
Albert Astals Cid
bfa209dfa5 cmake: build with exceptions disabled by default
Only re-enable exceptions for the modules that do
CONFIG+=exceptions
in qmake

Change-Id: I9f19078adbdc1b8fa3d4102fb51a099e7e35522e
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-06-05 09:10:51 +00:00
Alexandru Croitor
9ad193cc3d Fix write_all_source_file_lists type annotation
Change-Id: I6e22d21562a0923079b90cf9b3e6d15dfe16ff29
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-06-05 08:36:51 +00:00
Alexandru Croitor
38b7ee3533 Revert "Map module.gui to if TARGET Qt::Gui in configure.cmake"
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>
2019-06-05 08:33:21 +00:00
Alexandru Croitor
35dc8f496d Map module.gui to if TARGET Qt::Gui in configure.cmake
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>
2019-06-05 08:13:42 +00:00
Alexandru Croitor
d0eb985f74 Improve run_pro2cmake.py
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
2019-06-05 07:41:46 +00:00
Alexandru Croitor
9231204e2c Fix extra_keys in write_all_source_file_lists to be optional
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
2019-06-05 07:39:10 +00:00
Alexandru Croitor
b64e8e721f Fix special_case_handler to handle git add prev_CMakeLists.txt better
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>
2019-06-04 20:46:45 +00:00
Alexandru Croitor
8842cb5337 Improve special_case_helper.py
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>
2019-06-04 20:18:21 +00:00
Kevin Funk
75bb0b6cd1 pro2cmake: Add PUBLIC to target_include_directories
Change-Id: Ie4e882a5713022bfaec7182172be69616ff8b91c
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-06-04 15:34:33 +00:00
Kevin Funk
772f5dbf1c pro2cmake: Always add a newline after func calls
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>
2019-06-04 15:34:27 +00:00
Kevin Funk
8fea3ec4e7 pro2cmake: A couple more fixes regarding examples
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>
2019-06-04 15:34:21 +00:00
Jean-Michaël Celerier
0900298d46 cmake: register plug-ins, create dependencies file
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>
2019-06-04 10:08:07 +00:00
Albert Astals Cid
9e6781b69e cmake: Fix xcb build
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>
2019-06-04 08:45:46 +00:00
Alexandru Croitor
962ee4ea37 Handle a few more condition types in pro2cmake
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>
2019-06-04 08:37:26 +00:00
Thiago Macieira
041a5ff076 gen_qfloat16_tables: add a comment explaining what the tool is
For our future selves.

Change-Id: I2b1955a995ad40f3b89afffd15a4c127686662bc
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2019-06-03 10:42:55 -07:00
Thiago Macieira
5e40d3d982 qfloat16: Check in the tables to Git
It's a 38k source file, which makes it MUCH smaller than other generated
files like qlocale_data_p.h (982k) and qunicodetables.cpp (718k). The
constants are platform-independent, since they are defined by IEEE 754,
so they will never change.

The generator tool is moved to util/ and removed from the build. That's
one fewer bootstrapped tool to have to worry about.

The output file is committed as .cpp so it won't get installed.

Fixes: QTBUG-76165
Change-Id: I2b1955a995ad40f3b89afffd15a3ded58dc3e35f
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2019-06-03 10:42:53 -07:00
Alexandru Croitor
0a96302dc1 More fixes to conversion script while porting qtdeclarative
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
2019-06-03 14:41:52 +00:00
Alexandru Croitor
e88864578a Generate the c++xx standard features instead of skipping them
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>
2019-06-03 14:41:28 +00:00
Alexandru Croitor
e4079eca49 Merge remote-tracking branch 'origin/dev' into wip/cmake
Take 5.

Change-Id: Ifb2d20e95ba824e45e667fba6c2ba45389991cc3
2019-06-03 15:14:42 +02:00
Simon Hausmann
8fa646dbe2 Add basic support for compiling applications with qmake
* 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>
2019-05-31 12:53:09 +00:00
Leander Beernaert
d908e0a47d Fix uncessary relative dir suffix in pro2cmake.py
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>
2019-05-29 08:58:52 +00:00
Leander Beernaert
d843bceb0c Add Library Mapping for QtNetworkAuth
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>
2019-05-28 15:07:25 +00:00
Alexandru Croitor
499771f3ea Enhance the porting scripts with some new functionality
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>
2019-05-28 14:04:40 +00:00
Alexandru Croitor
cbb143e9f1 Improve configurejson2cmake.py to handle non-compliant qmake JSON
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
2019-05-27 07:48:51 +00:00
Edward Welbourne
548513a4bd Separate out the time, zone, date code from corelib/tools/
We'll be adding calendar code here as well, and tools/ was getting
rather crowded, so it looks like time to move out a reasonably
coherent sub-bundle of it all.

Change-Id: I7e8030f38c31aa307f519dd918a43fc44baa6aa1
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2019-06-06 15:54:32 +02:00
Alexandru Croitor
bfed22e3b7 Remove all line continuations when processing qmake syntax
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>
2019-05-23 14:19:22 +00:00
Alexandru Croitor
a2e0f19b61 Make debug token output actually work for the pro2cmake qmake parser
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>
2019-05-23 14:19:11 +00:00
Alexandru Croitor
6dfeb81bcb Improve qmake syntax parser in pro2cmake.py
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>
2019-05-23 14:17:46 +00:00
Alexandru Croitor
80271e8280 Improve qmake parser debug output in pro2cmake
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>
2019-05-23 14:17:34 +00:00
Alexandru Croitor
0425ee0610 Change the default enabled AUTOGEN tools list to contain only moc
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>
2019-05-22 14:58:08 +00:00
Alexandru Croitor
4e7756a6cd Add a few more 3rd party libraries to helper.py
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>
2019-05-21 15:28:24 +00:00
Alexandru Croitor
76f5b784ce Fix the fix to correctly handle comments in multi-line assignments
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>
2019-05-20 13:18:11 +00:00
Alexandru Croitor
e4b8c488bd Improve configure2cmake to find_package only in certain conditions
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>
2019-05-20 13:15:16 +00:00
Alexandru Croitor
846adfe079 Handle the new cmdline config feature in pro2cmake
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>
2019-05-20 09:23:14 +00:00
Alexandru Croitor
826821658d Workaround fix in pro2cmake Operation __init__ method
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>
2019-05-20 09:18:56 +00:00
Alexandru Croitor
c454e622a1 Don't exclude QtCore from dependencies when generating modules
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>
2019-05-20 09:15:31 +00:00
Alexandru Croitor
e0a6e9f3aa Fix parsing qmake assignments that have comments in between
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>
2019-05-17 13:31:03 +00:00
Tobias Hunger
14bf7e952e CMake: Fix test_scope_handling
Adapt to updated APIs in pro2cmake.py

Change-Id: I39898b675e27d6295ef6cfa049c82b245d71188a
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-05-17 13:26:29 +00:00
Tobias Hunger
5fe8a38af3 CMake: Fix test_operations
Fix test_operations and do some small mypy cleanups along the way

Change-Id: I6586b5d3491e5dcf44252c098516f0922fa60420
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-05-17 13:26:26 +00:00
Edward Welbourne
5b672693e7 Add locale support for Cebuano and Erzya languages (new in CLDR v35.1)
Change-Id: I5d0ee7bc27eeca1c046d442b0410128ea5abbdb3
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
2019-05-20 20:42:11 +02:00
Edward Welbourne
b7d8169f02 Suggest name, when available, for unknown codes
When parsing the CLDR data, we only handle language, script and
territory (which we call country) codes if they are known to our
enumdata.py tables.  When reporting the rest as unknown, in the
content of an actual locale definition (not the likely subtag data),
check whether en.xml can resolve the code for us; if it can, report
the full name it provides, as a hint to whoever's running the script
that an update to enumdata.py may be in order.

Change-Id: I9ca1d6922a91d45bc436f4b622e5557261897d7f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
2019-05-20 20:42:11 +02:00
Edward Welbourne
248b6756da Rename util/locale_database/ to include the e that was missing
It was misnamed local_database, quite missing the point of its name.

Change-Id: I73a4fdf24f53daac12304de1f443636d89afacb2
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
2019-05-20 20:42:10 +02:00
Tobias Hunger
400f94109d CMake: Wrap DBus1 find_package call to fix xproto not being picked up
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>
2019-05-10 15:09:49 +00:00
Tobias Hunger
e9085f4162 CMake: pro2cmake.py: Add target_link_libraries to examples
Change-Id: Ic7054f0c88e228496b7f4855bffa5620ed717f9b
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-05-09 13:14:45 +00:00
Tobias Hunger
35ed41e547 CMake: pro2cmake.py: Generate find_package information into examples
Change-Id: I6dab13ebea4386019f14be5f29a143d194268aac
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-05-09 13:14:37 +00:00
Alexandru Croitor
bc4687f5bb Keep "special case" modifications when regenerating project files
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>
2019-05-09 11:29:54 +00:00
Tobias Hunger
862ebbf7ea CMake: scripts: Extract code to write find_package lines
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>
2019-05-09 11:29:35 +00:00
Tobias Hunger
80e0c615a9 CMake: pro2cmake.py: Separate library extraction logic from writing out data
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>
2019-05-09 11:29:25 +00:00
Tobias Hunger
c4dd1a8fe3 CMake: pro2cmake.py: Extract writing lists into cmake files
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>
2019-05-09 07:38:17 +00:00
Tobias Hunger
ee3d9a8b67 CMake: scripts: Fix mypy issues
Change-Id: I706740be79eccd6bf08213fdaf747dde08cd053a
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-05-09 07:37:58 +00:00
Tobias Hunger
5608bf3cba CMake: pro2cmake.py: Add basic support for examples
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>
2019-05-09 07:37:42 +00:00
Tobias Hunger
0c498ef4ff CMake: pro2cmake.py: Do not fail when run from .pro-file directory
Change-Id: I285b05986e3a58efc060ca0b5732f6e3f5121476
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-05-08 11:25:58 +00:00
Alexandru Croitor
9d96c8da78 Fix freetype target not being found when using vcpkg
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>
2019-05-08 10:54:15 +00:00
Alexandru Croitor
aed2c1f5ae Force pro2cmake.py to always change the dir to the converted pro file
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>
2019-05-07 17:08:28 +00:00
Tobias Hunger
5ec3baa67a CMake: scripts: Make xcb_qpa_lib known as a Qt module
Change-Id: I65f48d86c4ec946b38004b945078f29625e32d93
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-05-07 14:45:22 +00:00
Tobias Hunger
d5018720db CMake: scripts: Treat libraries mapped to None as known
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>
2019-05-07 14:41:31 +00:00
Tobias Hunger
9ffcc76188 CMake: Scripts: Fix double entries in 3rd party library mapping
Change-Id: I35f29876874d6083d19382800d194e417d57bca1
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-05-06 14:29:20 +00:00
Tobias Hunger
059f4ade7f CMake: pro2cmake.py: Fix library mapping
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>
2019-05-06 14:20:50 +00:00
Alexandru Croitor
6b2de61bf9 Make zlib a required package for QtCore
Change-Id: Ifbb969fafe05e355d6874d8bebe2e8f1e80510ff
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-05-03 14:16:23 +00:00
Tobias Hunger
7874ce7801 CMake: Improve mapping of libraries
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>
2019-05-03 13:42:25 +00:00
Tobias Hunger
9618434de5 CMake: configurejson2cmake: Do not generate useless OPTIONALs
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>
2019-05-03 13:39:48 +00:00
Albert Astals Cid
64b31cafa1 cmake: Fix xcb_glx build
Use the actual cmake library target name

Change-Id: Icda1d232e3b920bf33ebceb00f39682050f7dedd
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-05-03 08:13:56 +00:00
Alexandru Croitor
9b0b464e82 Write find_dependency() calls in Qt Module config files
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>
2019-05-02 07:30:42 +00:00
Alexandru Croitor
5668522413 Make freetype a required package
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>
2019-05-01 19:05:38 +00:00
Tobias Hunger
6630937e63 Merge commit 'dev' into 'wip/cmake-merge'
Change-Id: I176c40d031be26a1dd1cf08843e448a660598783
2019-04-16 16:32:08 +02:00
Tobias Hunger
37ed6dae00 CMake: Map xkbcommon_support
Qt 5.12 comes with xkbcommon_support now. Map that accordingly.

Change-Id: Id10708349d377f6bdfed654428ebcef0b533bd69
Reviewed-by: Albert Astals Cid <albert.astals.cid@kdab.com>
2019-04-12 14:06:07 +00:00
Tobias Hunger
ce809cab29 CMake: pro2cmake.py: Fix handling of libraries in QT
Change-Id: I5737a285ca0575a454e60fad231435d96b2f1be7
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-04-12 11:35:18 +00:00