summaryrefslogtreecommitdiffstats
path: root/tests/CMakeLists.txt
Commit message (Collapse)AuthorAgeFilesLines
* CMake: Refactor optimization flag handling and add optimize_fullAlexandru Croitor2020-10-061-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Introduce a bunch of helper functions to manipulate compiler flags and linker flags for the CMAKE_<LANG>_FLAGS_<CONFIG> and CMAKE_<LINK_TYPE>_LINKER_FLAGS_<CONFIG> CMake variables. These variables can be assigned and modified either in the cache or for a specific subdirectory scope, which will apply the flags only to targets in that scope. Add qt_internal_add_optimize_full_flags() function which mimics qmake's CONFIG += optimize_full behavior. Calling it will force usage of the '-O3' optimization flag on supported platforms (falling back '-O2' where not supported). Use the function for the Core and Gui subdirectories, to enable full optimization for the respective Qt modules as it is done in the qmake projects. To ensure that the global qmake-like compiler flags are assigned eveywhere, qt_internal_set_up_config_optimizations_like_in_qmake() needs to be called after Qt global features like optimize_size and optimize_full are available. This means that qtbase and its standalone tests need some special handling in regards to when to call that function. Task-number: QTBUG-86866 Change-Id: Ic7ac23de0265561cb06a0ba55089b6c0d3347441 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* CMake: Properly handle CONFIG += thread aka Threads::ThreadsAlexandru Croitor2020-08-061-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | mkspecs/features/qt.prf adds a dependency on the system threading library if the Qt Core thread feature is enabled. Because qt.prf is loaded by any public or internal Qt project, it's essentially a public dependency for any Qt consumer. To mimic that in CMake, we check if the thread feature is enabled, and and set the Threads::Threads library as a dependency of Qt6::Platform, which is a public target used by all Qt modules and plugins and Qt consumers. We also need to create a Qt6Dependencies.cmake file so we find_package(Threads) every time find_package(Qt6) is called. For the .prl files to be usable, we have to filter out some CMake implementation specific directory separator tokens 'CMAKE_DIRECTORY_ID_SEP' aka '::@', which are added because we call target_link_libraries() with a target created in a different scope (I think). As a result of this change, we shouldn't have to hardcode Threads::Threads in other projects, because it's now a global public dependency. Task-number: QTBUG-85801 Task-number: QTBUG-85877 Change-Id: Ib5d662c43b28e63f7da49d3bd77d0ad751220b31 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Cristian Adam <cristian.adam@qt.io>
* CMake: Handle finding of OpenSSL headers correctlyAlexandru Croitor2020-04-081-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In Coin when provisioning for Android, we download and configure the OpenSSL package, but don't actually build it. This means that find_package(OpenSSL) can find the headers, but not the library, and thus the package is marked as not found. Previously the openssl_headers feature used the result of finding the OpenSSL package, which led to it being disabled in the above described Android case. Introduce 2 new find scripts FindWrapOpenSSL and FindWrapOpenSSLHeaders. FindWrapOpenSSLHeaders wraps FindOpenSSL, and checks if the headers were found, regardless of the OpenSSL_FOUND value, which can be used for implementing the openssl_headers feature. FindWrapOpenSSL uses FindWrapOpenSSLHeaders, and simply wraps the OpenSSL target if available. The find scripts also have to set CMAKE_FIND_ROOT_PATH for Android. Otherwise when someone passes in an OPENSSL_ROOT_DIR, its value will always be prepended to the Android sysroot, causing the package not to be found. Adjust the mapping in helper.py to use the targets created by these find scripts. This also replaces the openssl/nolink target. Adjust the projects and tests to use the new target names. Adjust the compile tests for dtls and oscp to use the WrapOpenSSLHeaders target, so that the features can be enabled even if the library is dlopen-ed (like on Android). Task-number: QTBUG-83371 Change-Id: I738600e5aafef47a57e1db070be40116ca8ab995 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Make standalone tests build via top level repo projectAlexandru Croitor2019-11-081-14/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously repo/tests/CMakeLists.txt was a standalone project on which CMake could be called. This was useful for Coin to be able to build and package only tests, but was a bit troublesome because that means having to specify the usual boilerplate like minimum CMake version, which packages to find in every tests.pro project. Instead of having a separate standalone project, modify the top level project and associated CMake code to allow passing a special QT_BUILD_STANDALONE_TESTS variable, which causes the top level project to build only tests, and find Qt in the previously installed qt location. This also means that when building a repo, we generate a ${repo_name}TestsConfig.cmake file which does find_package on all the modules that have been built as part of that repo. So that when standalone tests bare built for that repo, the modules are automatically found. qt_set_up_standalone_tests_build() is modified to be a no-op because it is not needed anymore. Its usage should be removed from all the other repos, and then removed from qtbase. Non-adjusted tests/CMakeLists.txt projects in other repositories should still be buildable with the current code, until they are updated to the new format. Adjust the Coin build instructions to build the standalone tests in a separate directory. Adjust pro2cmake to generate new structure for the tests/tests.pro projects. Adjust the qtbase tests project. Fixes: QTBUG-79239 Change-Id: Ib4b66bc772d8876cdcbae1e90ce5a5a5234fa675 Reviewed-by: Qt CMake Build Bot Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Fix handling of _nolink targets for the QtNetwork moduleAlexandru Croitor2019-11-081-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | When a _nolink target is exported, instead of getting the original namespace prefix, it gets the Qt6 prefix (OpenSSL::OpenSSL_nolink -> Qt6::OpenSSL_nolink). There is some special case code in Network autotests which tries to access the former target name, which doesn't exist when building standalone tests. Make sure to create a Qt6:: library alias for _nolink targets during a build (so before the library is exported), and change the Network autotests project to use this Qt6:: namespaced library, which will ensure it is found both in a standalone tests build and in a regular Qt build. Also make sure to actually call find_package to find the OpenSSL library when building standalone tests, otherwise configuration will fail. Change-Id: I3da5b958e72e745a50380f8ab1644459a7c6b005 Reviewed-by: Qt CMake Build Bot Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Convert tests/auto/otherLeander Beernaert2019-10-281-1/+4
| | | | | | | Change-Id: I79ba4f6bbbbede8ddab278dd987d9ad98277a229 Reviewed-by: Liang Qi <liang.qi@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> Reviewed-by: Qt CMake Build Bot
* Convert corelib plugin testsLeander Beernaert2019-10-211-1/+1
| | | | | Change-Id: Ia98f7945a2c5b09a9b4d59e430cf05a7fecb7d55 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* cmake: add corelib/thread/qthreadstorageFrederik Gladhorn2019-10-101-0/+1
| | | | | | | Fixes: QTBUG-78221 Change-Id: Icb4614f8187c16e6b13d9db1dbc6adfcd579db43 Reviewed-by: Leander Beernaert <leander.beernaert@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* cmake: Add find ICU to fix building testFrederik Gladhorn2019-10-041-0/+1
| | | | | | | | | | This fixes building of tests, which are currently all failing in auto/corelib/time/qtimezone. Change-Id: I6183217d51b5636651da9026f71353cdde1e2444 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Qt CMake Build Bot Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Merge remote-tracking branch 'origin/wip/qt6' into wip/cmakeAlexandru Croitor2019-06-141-2/+2
| | | | | | | | | | 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
* Fix OpenGL vs. GLESv2 linkage, attempt number threeSimon Hausmann2019-06-051-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | We introduced WrapOpenGL to link against either desktop GL or GLESv2 depending on the GL feature in QtGui. This works "fine", with two caveats: (1) find_package(WrapOpenGL) must be called after find_package(Qt5Gui) in order for the feature check in FindWrapOpenGL.cmake to work. That's error prone. (2) More and more places are popping up, in particular examples, where GL linkage is required due to inline functions in Qt that forward to GL functions - such as on Android. This in particular explains the qmake behavior of making the GL linkage (desktop _or_ GLES) a public dependency of QtGui, so only Gui linkage is required. Those two aspects combined are the nail in the coffin of FindWrapOpenGL and it would seem much easier to simply make the Desktop GL vs. GLES decision once in Gui's CMakeLists.txt and let Qt5GuiDependencies.cmake propagate this well. This allows us to get rid of plenty of special cases as well. Change-Id: I3a7e8af49537ce5f215f24470e075a4ae9aeb944 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Allow building the tests directory as a standalone CMake projectAlexandru Croitor2019-05-221-1/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | At the moment, Coin builds tests as a separate qmake invocation against an installed Qt. We need to support the same with CMake. Change the tests subdirectory to be a standalone CMake project when CMake does not detect an existing QtTest target while processing the subdirectory. If the target exists, it means we are building the whole repo, if the target does not exist, we need to call find_package to find the installed Qt. Refactor and move around a few things to make standalone tests build successfully: - add a new macro to set up paths to find QtSetup - add a new macro to find all macOS frameworks - add a new macro to set up building tests - add a new macro that actually builds the tests - export the INSTALL_CMAKE_NAMESPACE value into the BuildInternals Config file - export the CMAKE_BUILD_TYPE value, because a test project doesn't have a .git subdir and thus defaults to be built in Release mode, even though qtbase might have been built in Debug, so to avoid the mixing, the propagate the build type - stop overriding INSTALL_CMAKE_NAMESPACE and QT_CMAKE_EXPORT_NAMESPACE inside QtSetup if they are set, because the tests project doesn't specify a major version, and if we override the values, the moc / uic targets don't get the correct major version prefix and configuration fails Change-Id: Ibdb03687302567fe325a15f6d1cb922c76240675 Fixes: QTBUG-75090 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Begin port of qtbase to CMakeSimon Hausmann2018-11-011-0/+1
Done-by: Alexandru Croitor <alexandru.croitor@qt.io> Done-by: Frederik Gladhorn <frederik.gladhorn@qt.io> Done-by: Kevin Funk <kevin.funk@kdab.com> Done-by: Mikhail Svetkin <mikhail.svetkin@qt.io> Done-by: Simon Hausmann <simon.hausmann@qt.io> Done-by: Tobias Hunger <tobias.hunger@qt.io> Done-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Done-by: Volker Krause <volker.krause@kdab.com> Change-Id: Ida4f8bd190f9a4849a1af7b5b7981337a5df5310 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io> Reviewed-by: Tobias Hunger <tobias.hunger@qt.io> Reviewed-by: Mikhail Svetkin <mikhail.svetkin@qt.io>