Commit Graph

28 Commits

Author SHA1 Message Date
Alexey Edelev bb8163a533 Add the use of the qt_internal_project_setup function
The function sets the required CMake variables and policies.

Pick-to: 6.5
Task-number: QTBUG-112685
Change-Id: Idae8f19eca28bac764480130dc679df1c1273598
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2023-04-28 12:51:39 +02:00
Lucie Gérard 1b9808737a Change the license of all CMakeLists.txt and *.cmake files to BSD
Task-number: QTBUG-105718
Change-Id: Id89ed14990804a5024183e75382cc539d4293da1
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2022-09-07 17:01:30 +02:00
Lucie Gérard 5a7b716474 Add license headers to cmake files
CMakeLists.txt and .cmake files of significant size
(more than 2 lines according to our check in tst_license.pl)
now have the copyright and license header.

Existing copyright statements remain intact

Task-number: QTBUG-88621
Change-Id: I72c89a98c42bbc9234d8495e9e503bec81d11037
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2022-07-08 10:41:06 +02:00
Fabian Kosmale 612d988243 Add cmake support for examples
qml-i18n needed to be ported to CMake first. It uses qt_add_translations
introduced in 6.2

As a drive-by, move find_package calls from examples' CML to the top
level CML, and make the QtSql dependency optional. Also make sure that
we only add the dynamicscene example when the Quick target is available.

Pick-to: 6.2 6.3
Fixes: QTBUG-90964
Change-Id: Id357eb14e4704753386e01393300966eb89b4e86
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-03-29 22:12:43 +02:00
Christophe Giboudeaux 9ebd7caa20 CMake: Look for QtLanguageServerPrivate
The module was renamed to match the CMake target name.

Pick-to: 6.3
Change-Id: I67e2191b91ed2293dc652432c0fd786d43052cf4
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-03-28 15:17:23 +02:00
Fawzi Mohamed 25ac957f6d qmlls: qml language server implementation
This is the initial commit, with just qmllint integration, but
many of the tricky bits and the architecture are already there,
see the description in qqmllanguageserver.cpp and qqmlcodemodel.cpp

Pick-to: 6.3
Change-Id: Ie493fed02276f938fde641e8d91c67aed0514d1f
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
2021-12-21 12:25:41 +01:00
Alexandru Croitor 828cbe57a1 CMake: Fix warning about ShaderTools not being found when building examples
When building examples in-tree in a prefix build, we set QT_NO_CREATE_TARGETS
to TRUE and that causes find_package(QtFoo) calls in example projects
not to define targets.

If the targets were not found previously as part of the find_package calls
in qtdeclarative/CMakeLists.txt, this generates warnings like

 CMake Warning at lib/cmake/Qt6/Qt6Config.cmake:176 (find_package):
   Found package configuration file:
     lib/cmake/Qt6ShaderTools/Qt6ShaderToolsConfig.cmake
   but it set Qt6ShaderTools_FOUND to FALSE so package "Qt6ShaderTools" is
   considered to be NOT FOUND.  Reason given by package:
   Target "Qt6::ShaderTools" was not found.  Possibly due to
   QT_NO_CREATE_TARGETS being set to TRUE and thus
    lib/cmake/Qt6ShaderTools/Qt6ShaderToolsTargets.cmake
   was not included to define the target.

To avoid the warnings, search for the target ShaderTools package as an
optional component.

Amends 0d517b553b

Pick-to: 6.2
Fixes: QTBUG-96358
Change-Id: I50c2f1516ca26c099559001e74b7e25c625be6e6
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2021-09-28 08:14:21 +02:00
Alexandru Croitor 5a8b5f59e4 CMake: Bump almost all cmake_minimum_required calls to 3.16
Needed for subsequent change that will check and error out if the
version is lower than 3.16. We do that to ensure all policies
introduced by CMake up to version 3.16 have their behavior set to
NEW.

Pick-to: 6.2
Task-number: QTBUG-95018
Change-Id: Ic92ef51132db78f07891d3bab190078e9d3078b6
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
2021-09-22 20:39:52 +02:00
Alexey Edelev 25ea9bbec2 Use _qt_internal_collect_qml_root_paths to collect android dependencies
Add the _qt_internal_collect_qml_root_paths function that collects
qml root paths and sets the QT_QML_ROOT_PATH property to the target
based on the provided qml source files.
Call _qt_internal_collect_qml_root_paths when adding QML source
files to collect QML root paths for the qmlimportscanner when building
Android applications.

Pick-to: 6.2
Task-number: QTBUG-93340
Change-Id: Ica996e6043b5d1b403665a1316eff23dc97fdf44
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2021-09-09 14:30:22 +02:00
Alexandru Croitor 689ac8b2a1 CMake: Look for ShaderTools package in additional package paths
This is needed for Conan Qt builds because the usual locations
(CMAKE_PREFIX_PATH as set by the qt.toolchain.cmake file) will
not contain the location of qtshadertools, qtsvg, etc.

Each of those are in separate Conan package dirs which are passed
via the QT_ADDITIONAL_PACKAGES_PREFIX_PATH variable.

Those paths are searched by Qt6Config.cmake and other files, but the
initial find_package call here also needs those paths.

The change likely won't help with cross-builds and will need
additional changes in qtbase.

Task-number: QTBUG-94524
Change-Id: I6f4c10065948a3bf0e36410fd52139dfd42b5c0c
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2021-06-23 11:38:14 +02:00
Joerg Bornemann d65c5e8f79 Remove unneeded CMake variable assignments
Remove assignments to the transitionary variables
QT_NO_INTERNAL_COMPATIBILITY_FUNCTIONS and
QT_USE_FIXED_QT_ADD_RESOURCE_BASE.
Both are not needed anymore.

Task-number: QTBUG-94444
Change-Id: I9236056e5e2a4386242a8437580255d0713fd1bf
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-06-14 11:43:36 +02:00
Joerg Bornemann 1917a868d9 Use fixed qt_add_resource BASE argument
Pick-to: 6.1
Task-number: QTBUG-86726
Change-Id: If6e1033642d98ccd40daeb57a453c0e5bc2985da
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2021-05-21 00:21:26 +02:00
Alexandru Croitor 0d517b553b CMake: Make qtdeclarative depend only on host qtshadertools package
When building QtQuick, it only needs qsb and the
qt_internal_add_shaders CMake API from qtshadertools, it doesn't need
the ShaderTools library.

Look for the ShaderToolsTools package which is created by the host
qtshadertools build.

This will allow building target qtdeclarative without having to build
target qtshadertools first.

For the ShaderToolsTools package to be found when cross-compiling, we
need to add the QT_HOST_PATH to both CMAKE_FIND_ROOT_PATH and
CMAKE_PREFIX_PATH temporarily.

Amends 4fb84137f1

Fixes: QTBUG-92050
Change-Id: Ided9189e23b2c60bf7d9f189d94f4bf9fb142218
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2021-05-11 16:20:55 +02:00
Laszlo Agocs 4fb84137f1 Bake shaders at build time
Change-Id: Ia6879ca75750ceb54f145dab9d25ac1ed78289a2
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2021-03-17 08:30:46 +01:00
Alexandru Croitor 8ba6cf600e CMake: Fix no-widgets build
Task-number: QTBUG-86053
Change-Id: If58d5b69ed58ae1aa3d50737683e682d70c26c23
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2020-10-21 11:25:26 +02:00
Alexandru Croitor 4dcbdf422f CMake: Disable usage of CMake API compatibility wrappers
Setting the QT_NO_INTERNAL_COMPATIBILITY_FUNCTIONS variable
in the project ensures we ported away from old API calls.

Task-number: QTBUG-86815
Change-Id: I3d80bf0ffcfe765472b2cd01ffc43d3af04d0261
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2020-10-06 13:19:45 +02:00
Alexandru Croitor 25ae2045b6 CMake: Regenerate qtdeclarative/src
Includes
 - renaming of internal plugin api call
 - generation of QT_QMLTYPES_FILENAME
 - addition of a few TARGET_DESCRIPTION

Change-Id: I72b5647b8c16af9945795ead62a075322b6bb2f6
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2020-05-29 10:01:16 +02:00
Alexandru Croitor ea592334fd CMake: Add optional dependency on OpenGLWidgets
Needed for some benchmarks.

Change-Id: I795112bd795bd230fb4852e0aab466547bf56cb2
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-03-16 14:04:24 +01:00
Alexandru Croitor 14492ecee2 CMake: Regenerate and adapt to merge from dev
Change-Id: If8daa6152a563d4309d7342414780ef75b9f5589
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
2020-03-12 14:05:23 +00:00
Samuli Piippo 49dbef650e Move OpenGL to optional component
Parts of declarative is still buildable without OpenGL

Change-Id: If76be1eaca03a4754d1d6a86c3d8fba3329bc773
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-02-05 09:45:33 +00:00
Alexandru Croitor b134476cdb Post-merge fixes
Change-Id: I2350df5368ee34d6c7072d456806e518ce533839
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2020-01-30 20:45:49 +00:00
Leander Beernaert ec57196980 Add qt6_add_qml_module() public API
Add qt6_add_qml_module() as a public API for building QML modules.

Since the shared implementation details are small, it was easier
to just reimplement the shared code than to unmangle the more
complicated version we use to build Qt from QtBuild.

This patch includes an example conversion. Changes for pro2cmake
will follow in a separate patch in qtbase.

Change-Id: I942526cc7d978e2d8309b506e785f9c1509d0bbc
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-09-19 08:06:24 +00:00
Simon Hausmann f6229fea92 Fix top-level build with examples enabled
One of our examples depends on QtQuickTest, which has a public
dependency to QtTest. So the example does find_package(Qt6 COMPONENTS
QuickTest), which will end up calling find_dependency(QtTest). The
Qt6Test cmake config files will import the module's feature, which
requires the Qt6::Test target to exist. That however was not created
because we set the QT_NO_CREATE_TARGETS. So if we set that (which is
correct), then we do need to find Qt6::Test at the top-level.

Other modules shouldn't need this as they don't create modules that in
turn have a public dependency to testlib.

Change-Id: Ia82aaa2b2462feec81659c6e532d0a185e6819a6
Done-with: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-09-17 14:56:09 +00:00
Liang Qi 729addd82e Support standalone tests building
Also fix some build issues regarding tests.

Change-Id: Ie9ba8a0b7932ae2b542614b6c824c4071ad0b548
Reviewed-by: Liang Qi <liang.qi@qt.io>
2019-09-02 11:23:38 +00:00
Alexandru Croitor b9a263faec Bump minimum CMake version to 3.15.0 as it is done in qtbase
We decided this in a workshop a while ago, where we noticed
that the find_dependency() macro was broken in regards to finding
additional components. 3.15.0 was the version that fixed it.

Change-Id: Icdb161c983aea4f61fe705856428e5c3d443c05f
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-08-27 08:24:18 +00:00
Leander Beernaert 4e14f6e70a Add QtDeclarative Test Coverage
All tests compile and run on a developer build.

These tests are failing:
tst_qqmlsqldatabase Fails due to missing sql driver
tst_qqmlsqldatabase Fails in wip/qt6
tst_ququicklayouts Fails in wip/qt6
tst_flickableinterop Fails in wip/qt6
tst_qquickpinchandler Fails in wip/qt6
tst_qquickflickable Fails in wip/qt6
tst_qquickgridview Fails in wip/qt6
tst_qquickimage Fails due to missing jpeg plugin
tst_qquicklistview Fails in wip/qt6
tst_qquicktext Fails in wip/qt6
tst_qquickcanvasitem Fails in wip/qt6
tst_scenegraph Fails due to missing jpeg plugin
tst_TestFiltering Fails in wip/qt6

Change-Id: I4b9d69c118e23c095cb72ad5a67653fc30943bb1
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-08-14 14:01:58 +00:00
Frederik Gladhorn ae47deba4c CMake: switch version to 6.0.0
Change-Id: I633338f4d75f48213019b3b88fe1b6402c6005fd
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-06-17 15:53:09 +00:00
Alexandru Croitor 6c69a6ab7c Initial CMake port
Crude port of QtQml, QtQmlModels, QtQuick and a few tests and a few
examples.

Task-number: QTBUG-74136
Change-Id: I5de4d8215b33d1a4a72c2c0e7951e4b384f27e3e
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-06-03 11:03:46 +00:00