summaryrefslogtreecommitdiffstats
path: root/util/cmake/configurejson2cmake.py
Commit message (Collapse)AuthorAgeFilesLines
* Fix mapping of features to private featuresSimon Hausmann2019-07-221-3/+10
| | | | | | | | | | | | | | | | | | | | 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>
* Fix some configure.json conditions for qtimageformatsAlexandru Croitor2019-06-061-0/+6
| | | | | | | | | | | | | 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>
* Map module.gui to if TARGET Qt::Gui in configure.cmakeAlexandru Croitor2019-06-051-0/+2
| | | | | | | | | | 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>
* Revert "Map module.gui to if TARGET Qt::Gui in configure.cmake"Alexandru Croitor2019-06-051-2/+0
| | | | | | | | | | It breaks some conditions, and then the build fails not finding some private header files in qpa, etc. This reverts commit 35dc8f496dc324a816dc17e80b744bfe864ec261. Change-Id: I1b51eac06fe9186181d3f0a7c78f22da7be534e2 Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
* Map module.gui to if TARGET Qt::Gui in configure.cmakeAlexandru Croitor2019-06-051-0/+2
| | | | | | | | 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>
* Generate the c++xx standard features instead of skipping themAlexandru Croitor2019-06-031-6/+0
| | | | | | | | | | | 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>
* Enhance the porting scripts with some new functionalityAlexandru Croitor2019-05-281-0/+2
| | | | | | | | | | | | | 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>
* Improve configurejson2cmake.py to handle non-compliant qmake JSONAlexandru Croitor2019-05-271-3/+3
| | | | | | | | | | | | | 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
* Improve configure2cmake to find_package only in certain conditionsAlexandru Croitor2019-05-201-2/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* CMake: scripts: Extract code to write find_package linesTobias Hunger2019-05-091-25/+3
| | | | | | | | 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>
* CMake: pro2cmake.py: Fix library mappingTobias Hunger2019-05-061-5/+5
| | | | | | | | | | | | | 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>
* CMake: Improve mapping of librariesTobias Hunger2019-05-031-97/+28
| | | | | | | | | | | | | 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>
* CMake: configurejson2cmake: Do not generate useless OPTIONALsTobias Hunger2019-05-031-3/+2
| | | | | | | | | | 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>
* Write find_dependency() calls in Qt Module config filesAlexandru Croitor2019-05-021-4/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* Make freetype a required packageAlexandru Croitor2019-05-011-1/+1
| | | | | | | | | 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>
* Merge commit 'dev' into 'wip/cmake-merge'Tobias Hunger2019-04-161-0/+8
| | | | Change-Id: I176c40d031be26a1dd1cf08843e448a660598783
* CMake: Configurejson2cmake: Always enable system-pcre2 and handle dlopenTobias Hunger2019-04-121-2/+4
| | | | | | | Handle dlopen properly. Code is ifdef-ed on it, so we need it:-/ Change-Id: I7f35d24b97530796a4cdcdc1acbe139757170215 Reviewed-by: Albert Astals Cid <albert.astals.cid@kdab.com>
* CMake: Set define for default QPA platformTobias Hunger2019-04-021-3/+0
| | | | | | | | | | This is used to set the default QPA platform and without it all Gui applications trigger an assert in QString:-/ This is way simpler than going through configure.json. Change-Id: I2c053e95c0f7e99e97a0b2918d8e4ac13d3494fd Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Temporarily disable the opengles2 feature on WIN32Alexandru Croitor2019-03-211-0/+3
| | | | | | | | | | | | | | | | | | The feature used to be implicitly enabled because qt source ships with ANGLE sources, and thus ANGLE could always be built. Yet because the CMake port of ANGLE is not done yet, and because the feature is implicitly enabled, the build failed when trying to find GLES headers. To provide a nicer out-of-the-box configuring of the Windows build, disable the opengles2 feature on Windows, to default to a desktop GL build. It can be re-enabled once (if) ANGLE porting is done. After this change, you shouldn't need to pass any additional custom FEATURE_foo options to cmake to build qtbase on Windows. Change-Id: I94c96d8ef70cf671d2ce0198311f70b55fa642b1 Reviewed-by: Liang Qi <liang.qi@qt.io> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Fix sub-architecture (instruction sets / SIMD) handlingAlexandru Croitor2019-03-211-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | In qmake there are at least 2 things to know regarding sub-architectures and instruction sets. Which instruction sets does the compiler know to compile for, represented by the various config.tests and features in qtbase/configure.json. And which instructions sets are enabled by the compiler by default, represented by the configure.json "architecture" test and accessed via QT_CPU_FEATURES.$$arch qmake argument. Before this patch there was some mishandling of the above concepts in CMake code. The former can now be checked in CMake with via TEST_subarch_foo and QT_FEATURE_foo (where foo is sse2, etc). The latter can now be checked by TEST_arch_${TEST_architecture_arch}_subarch_foo (where foo is sse2, etc and the main arch is dynamyicall evaluated). The configurejson2cmake script was adjusted to take care of the above changes, and the cmake files were regenerated as well. Change-Id: Ifbf558242e320cafae50da388eee56fa5de2a50c Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Improve configurejson2cmake feature output generationAlexandru Croitor2019-03-181-30/+72
| | | | | | | | | | | | | | | | | | | There were a few cases of feature outputs that were handled incorrectly before this change, specifically: - publicFeatures and privateFeatures with custom names - privateFeatures that also ended up writing defines into public headers - publicFeatures that ended up in private headers - internal features (that should have no QT_FEATURE_foo defines) that were still written to either public or private headers The change takes care of all those cases by keeping a map of which features need to be written along with any visibility specifications, as well as custom name changes. Change-Id: I37baeaeacdfe4935128a392c72ca71b5c3ca1c8d Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* CMake: configurejson2cmake.py: Fix typoTobias Hunger2019-03-121-1/+1
| | | | | Change-Id: Ib142032577f1d84bfb2402103271db04a4bb25a1 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* cmake: Cleanup harfbuzz featuresМихаил Светкин2019-03-011-0/+6
| | | | | | | Remove system-harfbuzz feature and use harfbuzz feature as system Change-Id: I441345a667450f1c2d19380b0709911011c7ceb7 Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
* CMake: Small unsorted fixes in preparation of upgrading to dev branchTobias Hunger2019-02-271-3/+5
| | | | | | Change-Id: Id4d03558e956c6994dc6a8b701030ba4edf86adf Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> Reviewed-by: Albert Astals Cid <albert.astals.cid@kdab.com>
* CMake: Fix build without double-conversion on macOSMikhail Svetkin2019-02-271-1/+1
| | | | | | Change-Id: I5102e93141eec95044df44884dcf6ecd1b9e8dd0 Reviewed-by: Mikhail Svetkin <mikhail.svetkin@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* cmake: Give the egl_x11 test the necessary libs to compileAlbert Astals Cid2019-02-271-4/+11
| | | | | | | | | | | And add the eglfs_x11 plugin We need to actually try to compile the test as the comment it it says that having x11 and egl is not enough since sometimes they are actually incompatible Change-Id: If6bdc08c21b91fa9c41663f2fa653fd59e5ddd2e Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
* Fix Desktop GL/EGL/GLESv2 linkageSimon Hausmann2019-02-121-1/+2
| | | | | | | | | | | | | | | | This change fixes a few things in one go: * cmake's FindOpenGL cannot be used reliably to detect EGL. So use a custom module for that. * Added a custom module for GLESv2 detection, as cmake's FindOpenGL does not support that. * Map CONFIG += opengl to a WrapOpenGL target, which links against either GLESv2 or libGL - just like mkspecs/features/*/opengl.prf * cmake's FindOpenGL remains in use solely to detect the availability of desktop gl. Change-Id: I9315e5ad1fd88e1b7dc7e920053e98fb51fea7fc Reviewed-by: Volker Krause <volker.krause@kdab.com>
* cmake: Find and build odbc pluginAlbert Astals Cid2019-02-121-0/+1
| | | | | Change-Id: I479d2b1cc897f601ef68b10272c9396e52228201 Reviewed-by: Liang Qi <liang.qi@qt.io>
* cmake: Find and build psql pluginAlbert Astals Cid2019-02-121-0/+1
| | | | | Change-Id: I8cbc8ab0061f67824d78198cbb926f0625fc7e41 Reviewed-by: Liang Qi <liang.qi@qt.io>
* cmake: Search and enable the sqlite[3] pluginAlbert Astals Cid2019-02-121-0/+5
| | | | | | | | Added to QtFeature.cmake a way to be able to run feature_module begin and end without having an actual module by passing NO_MODULE Change-Id: Ib708bd3878e2591da193d18563c8932cc4b75e7f Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Find mtdev and use itAlbert Astals Cid2019-02-121-0/+1
| | | | | Change-Id: I90db48efaa6a23add770fcf69b46c4f4c84866c1 Reviewed-by: Liang Qi <liang.qi@qt.io>
* configurejson2cmake.py: openssl -> OpenSSL mappingAlbert Astals Cid2019-02-121-0/+1
| | | | | Change-Id: I29480dfbd4f144e3d5620b43419ec46fb866cf4b Reviewed-by: Liang Qi <liang.qi@qt.io>
* CMake: Fix build of system jpeg is not availableKai Koehne2019-02-121-0/+3
| | | | | | Change-Id: Ie7462db556d0615e74755fa4fc3b51f625aade2f Reviewed-by: Mikhail Svetkin <mikhail.svetkin@qt.io> Reviewed-by: Liang Qi <liang.qi@qt.io>
* configurejson2cmake.py: Don't emit a fixme for C++11 configAlbert Astals Cid2019-02-121-0/+3
| | | | | Change-Id: I8408f6126115a0f76b0fed2cc42b54e5c148821d Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* configurejson2cmake.py: Support for the two cases that have LIBS +=Albert Astals Cid2019-02-121-2/+22
| | | | | | | | Since there's only two i hardcoded it for the moment instead of trying to parse the line Change-Id: I0da578af64ef9621cbbc78bf6ce15bf8a3f63f1c Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* cmake: also write FIXME on the configure.cmake for 'use'Albert Astals Cid2019-02-121-0/+2
| | | | | | | Since most of the times it means we need to link with some other stuff Change-Id: I06262d4403225bca7a5e68d47145fefcf6702e5a Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* cmake: blacklist xlib test, we can just use X11_FOUNDAlbert Astals Cid2019-02-121-0/+2
| | | | | Change-Id: Ic733c42e11b00fa8bf107f460a0596aeb10ac37b Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* cmake: Find Cups and enable its pluginAlbert Astals Cid2019-02-121-0/+1
| | | | | Change-Id: I44bf176587331d86eb147d106f28deb0a6618ab4 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* cmake: Blacklist the libinput_axis_api testAlbert Astals Cid2019-02-121-0/+3
| | | | | | | We already have a cmake find module for libinput so we know it is there Change-Id: I153544c5c13cb57b1ce258243ede17f4be9507fd Reviewed-by: Liang Qi <liang.qi@qt.io>
* cmake: find gtk3 and build the gtk3 platformthemeAlbert Astals Cid2019-02-111-0/+1
| | | | | Change-Id: I7db7321a2fd5ea0eda1924f3dece3b1c86d87d10 Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
* cmake: Find tslib and build the tslib plugin if foundAlbert Astals Cid2019-02-111-0/+1
| | | | | Change-Id: I7119ddf473a3ede29bbfef23cffb08a4fcbd5681 Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
* CMake: Map dlopen feature to 'ON'Tobias Hunger2019-02-111-1/+1
| | | | | | | | | | | | Map the dlopen feature to 'ON'. The effect is that cmake will figure out whether or not linking to 'dl' is necessary or not. The user-visible feature is 'library' anyway: That enables dynamic library loading -- and will link in 'dl' as needed. Change-Id: I0d68275a7234efba7f926150f120bb37b4a1163f Reviewed-by: Albert Astals Cid <albert.astals.cid@kdab.com> Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
* CMake: Add FindZSTD.cmake and wire it up in configurejson2cmake.pyTobias Hunger2019-01-311-0/+1
| | | | | | | Zstd is used in the dev branch, so prepare for it. Change-Id: I130d98e3888a1eb4c7444728fc5088c5dae9d911 Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
* CMake: Use FindGLIB2 from cmake-extra-modulesTobias Hunger2019-01-311-1/+1
| | | | | | | Use FindGLIB2 from cmake-extra-modules over hand-rolled own version. Change-Id: I1f8e055bc12dd728c033fd88480690643d90159a Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
* CMake: configure2cmake.py: Handle Libproxy and corewlanTobias Hunger2019-01-301-1/+2
| | | | | | | Update to cover more libraries Change-Id: I32a26b0fa0a79531fcb55e7a4646a2e63fec1d5b Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
* CMake: Add support to find LTTng-ustTobias Hunger2018-11-061-0/+1
| | | | | | | CMake comes with a Find module for this, so use it in src/corelib/configure.cmake Change-Id: I8f4abcb32fb10513d67c3c959310eefaf7b56d3d Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
* CMake: Add FindSlog2Tobias Hunger2018-11-061-0/+1
| | | | | | | Add FindSlog2 and use it in src/corelib/configure.cmake. Change-Id: I7e6a696a49df568a41ed1224228ab608db2dbb0e Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
* CMake: Improve handling of the different kinds of iconvTobias Hunger2018-11-061-3/+21
| | | | | | | | | Improve conditions/enable/disable conditions for iconv related features. These are detected a bit different from what qmake does, so adapt to that. Change-Id: I7b3e4baf05dc324507f370d7f651a62f29e42a98 Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
* CMake: Add FindPPS and use it in src/corelib/configure.cmakeTobias Hunger2018-11-061-0/+1
| | | | | | | | Find the PPS library and use the result PPS_FOUND in configure.cmake where needed. Change-Id: I08d3ace421278dc0ae5c3128d4234e6bca906c05 Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
* CMake: Find librtTobias Hunger2018-11-061-0/+1
| | | | | Change-Id: Ibc39ba7a385146cd0428b78e12a793f0ddbfae91 Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>