Commit Graph

37 Commits

Author SHA1 Message Date
Alexandru Croitor a6bd1dc3e0 CMake: Add deployment API to our examples
Projects were modified using the tool at:
https://git.qt.io/alcroito/cmake_refactor

A few examples had to be adapted manually, mostly those that build
additional qml modules / plugins.

The INSTALL_EXAMPLESDIR and INSTALL_EXAMPLEDIR assignments were
removed, these are not needed anymore because example directory
selection is handled by the qt_internal_add_example calls.

The install(TARGETS) calls were modified according to our
documentation snippets for qt_generate_deploy_qml_app_script.

A qt_generate_deploy_qml_app_script call was added for each
executable target.

Note that the deployment step will be skipped in the CI for now,
because:
- we enable QT_DEPLOY_MINIMAL_EXAMPLES in the CI instructions and thus
  set QT_INTERNAL_SKIP_DEPLOYMENT to true
- standalone examples feature is not yet enabled in the CI, which
  means we continue to build examples in-tree, and deployment is
  disabled for in-tree prefix builds.
A small list of examples to deploy in the CI will be chosen in the
future, to ensure deployment coverage, without slowing down overall CI
times due to all the *deployqt invocations.

Even if deployment is disabled in the CI, the install(TARGETS) calls
for each example will still run, installing into an
'installed_examples' directory, which will not be archived by the CI.

The QtBundleQmlModuleForMacOS and bundle_shared code was removed,
because we can now depend on the MACOS_BUNDLE_POST_BUILD option of the
deployment api, to ensure macOS bundle examples run properly in the
build dir. This works even in prefix in-tree builds, when installation
deployment is disabled.

Finally, for all examples that build additional qml module libraries or
plugins, the libraries / plugins must be installed into the bin dir of
each project, along with a qmldir file.

This is to support running the installed project for platforms that
don't have deployment api yet, like boot2qt / yocto.

If we want to have super clean install / deployment rules in the
future, we won't be able to avoid adding ugly per-platform conditions.
The current status quo is deemed an improvement over what we had
before.

Pick-to: 6.7
Task-number: QTBUG-101340
Task-number: QTBUG-102056
Task-number: QTBUG-102057
Change-Id: I843d934668c25dbcd1abca52495b393579633fc5
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by:  Alexey Edelev <alexey.edelev@qt.io>
2024-03-27 18:57:34 +01:00
Lucie Gérard 53295d9102 Correct license for examples files
Example takes precedent over build system file type.
According to QUIP-18 [1], all examples file should be
LicenseRef-Qt-Commercial OR BSD-3-Clause

[1]: https://contribute.qt-project.org/quips/18

Pick-to: 6.7 6.7.0
Task-number: QTBUG-121787
Change-Id: Ie8c2539e7659f53a1fd6b48f99ee883ee9aeb0a7
Reviewed-by: Kai Köhne <kai.koehne@qt.io>
2024-03-21 10:41:29 +01:00
Jaishree Vyas 486cc33ce5 Doc: Create separate Graphics and Multimedia example categories
Fixes: QTBUG-117884
Pick-to: 6.6 6.7
Change-Id: Ib0bb6217c29795fe50efdf827aa9902bbd572032
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
2024-01-17 15:36:27 +01:00
Inkamari Harjula e421c21c3b Doc: Add example category to all the files that haven't yet got it
Added example category and also fixed one copy-paste mistake in Vulkan Texture Import.

Task-number: QTBUG-116205
Pick-to: 6.5 6.6
Change-Id: I96692f214849596e9555c635d9996d9b884c5cab
Reviewed-by: Kai Köhne <kai.koehne@qt.io>
2023-09-06 06:55:46 +00:00
Paul Wicking 9e3b681460 Doc: Use sensible argument in `\printto` command
The "Scene Graph - Vulkan Under QML" example includes snippets of code
from the example source file(s) using a combination of the `\skipto` and
`\printto` QDoc commands. The former skips content until the line that
contains the argument passed to the command
(here, "class VulkanSquircle"). The latter prints lines up to, but not
including, the line that contains the argument passed to the command
(here, "public"). I suspect the author's intention was for QDoc to
output lines from the start of the class declaration until the public
access specifier in the member specification of the class. However, the
first instance of `public` QDoc encounters is the base-specifier of the
derived class, which is on the same line as the argument to the
`\skipto` command. Hence, there's nothing for QDoc to output.

Modifying the argument to include the colon that indicates the keyword
is for member-declarations ensures QDoc generates output as expected.

Fixes: QTBUG-116304
Pick-to: 6.6 6.5
Change-Id: Ibfc17fbacd10f902fc2a5f57873fe0990571535e
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
Reviewed-by: Safiyyah Moosa <safiyyah.moosa@qt.io>
2023-08-22 12:38:28 +02:00
Nicholas Bennett 30560d0c33 Docs: Expand Vulcan under QML Example documentation
This was selected as a featured example for Qt for Android, so it has
been given some attention.

Fixes: QTBUG-112517
Pick-to: 6.5 6.5.1
Change-Id: Ic8b5f2c92930f9135bf0bcfff8ca564f393d781d
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2023-05-16 10:46:55 +03:00
Kai Köhne 2e6403f8bf Examples: Use versioned CMake targets for Qt modules
Use e.g. Qt6::Core instead of Qt::Core. This is better matching the
find_package(Qt6 ...) call, and also avoids issues that the versionless
targets have.

Pick-to: 6.5
Task-number: QTBUG-113277
Change-Id: Ib80f885e9f73fb9ad54b9e9b22cae2318877dc07
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-05-02 12:12:35 +02:00
Ulf Hermann 2d44365f69 CMake: Allow omitting the version of QML modules
Also, drop all the VERSION 1.0 lines from the examples and tests. 1.0 is
actually a bad default version since it's before all the Qt versions.

[ChangeLog][QML] You can now omit the VERSION argument to
qt_add_qml_module(). This will automatically generate the highest
possible version.

Pick-to: 6.5
Task-number: QTBUG-99146
Change-Id: Ic10ec69b87c224e0e94e1785f65653815d4c778c
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
2023-01-27 19:16:39 +01:00
Oliver Eftevaag 1c6afffc94 Quick scenegraph examples: use qsTr() for user facing strings
All user facing strings should use qsTr()

Pick-to: 6.5
Change-Id: I2f776fe088b05bb046ceafbc6c29528212a2c1a0
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
2023-01-17 16:45:12 +01:00
Oliver Eftevaag 7409c217e8 Quick examples: Modernize cmake files according to our guidelines
The following changes are made to the CMakeLists.txt files in all
quick examples:

- Use PRIVATE linkage when possible.
- Use qt_standard_project_setup()
- Set WIN32 and MACOSX_BUNDLE in qt_add_executable() instead of
  set_target_properties()

Pick-to: 6.5
Change-Id: I18217585aec56794b327f103d6959879df59d68a
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2023-01-16 16:16:47 +01:00
Oliver Eftevaag ae4a0c34c0 Remove spurious qDebug() statement
The qDebug() doesn't add any value to the example.

Fixes: 6.5
Change-Id: I73c1af251f342e3ed542f683dd0b3d71d92a3f58
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2023-01-11 13:44:35 +01: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
Kai Köhne b7f448f864 Examples: Do not use import version numbers anymore
Pick-to: 6.4
Change-Id: I1f4d4920bb9d132a846ac2dbcfdb8b660759d540
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2022-08-31 16:37:35 +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
Lucie Gérard 0dc4fd240a Use SPDX license identifiers
Replace the current license disclaimer in files by
a SPDX-License-Identifier.
Files that have to be modified by hand are modified.
License files are organized under LICENSES directory.

Pick-to: 6.4
Task-number: QTBUG-67283
Change-Id: I63563bbeb6f60f89d2c99660400dca7fab78a294
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2022-06-11 08:05:15 +02:00
Kai Köhne e2138561df Use QSGRendererInterface::OpenGL in documentation and examples
QSGRendererInterface::OpenGLRhi is only an (undocumented) alias to
...::OpenGL, so let's use that instead.

Amends 0b2311a62b

Pick-to: 6.2 6.3
Change-Id: I4acdd39dc1d9b75bed5c474667a43b4ad86e7f47
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2022-02-14 11:38:10 +00:00
Kai Köhne 9d82f4bff8 Improve examples CMakeLists.txt
- Remove # generated from xyz.pro comment from pro2cmake
- Remove "# special case" markers for pro2cmake
- Remove automatic use of CMAKE_AUTORCC
- Only opt into CMAKE_AUTOUIC if .ui files are involved
- Remove explicit setting of CMAKE_INCLUDE_CURRENT_DIR
- Combine multiple find_package(Qt6 ... calls)
 - use REQUIRED COMPONENTS
 - sort components alphabetically
- Fix wrong indentations
- Use (only) one empty line after multi-line commands

Pick-to: 6.3
Change-Id: I0d6bfb06c4b25e9921d3d2bf31d977150f12b31b
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2022-01-24 13:25:13 +01:00
Edward Welbourne d8ce3b7f61 Fix typo: alignment has an n in it
Change-Id: Ibe0ef16609a704042b964b4c29078c462820e602
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2021-10-13 18:58:22 +02:00
Craig Scott a86fd709dd Update quick examples to new QML CMake API
This is a pre-requisite to being able to make
qt6_qml_type_registration() an internal rather than public command.
Not all examples have been updated, only those that were using the
qt6_qml_type_registration() command.

Task-number: QTBUG-95093
Pick-to: 6.2
Change-Id: I3f1814a29af608461daa90477eca0aa2304eb9d1
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-08-24 16:08:21 +10:00
Joerg Bornemann b4ab58d791 Raise cmake_minimum_required to VERSION 3.16 in examples
Pick-to: 6.2
Task-number: QTBUG-95636
Change-Id: I9f76b787533dad1c469fbb8c69df6c27b20a9aa3
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-08-17 13:48:14 +02:00
Alexandru Croitor 20d5e2d7ef CMake: Regenerate examples to set the WIN32_EXECUTABLE property
As well as the MACOSX_BUNDLE properties as necessary.

Task-number: QTBUG-87664
Task-number: QTBUG-86827
Change-Id: I46769fb543acb2cbeba122470b5e44ad478fbe4e
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2020-10-26 23:38:39 +01:00
Alexandru Croitor 903252b240 CMake: Regenerate examples to use qt_add_executable
Task-number: QTBUG-87661
Change-Id: Ie5bba408000211b24694aa0143bdf79c4a298f42
Reviewed-by: Daniel Smith <Daniel.Smith@qt.io>
2020-10-20 09:32:34 +02:00
Ulf Hermann b030b4a1f2 examples: include QQuickWindow in squircle headers
This is required because QQuickWindow is passed as a signal parameter.

Change-Id: Ied10beded7253558d080af4806d1b95880bf2d98
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-09-13 08:15:15 +02:00
Laszlo Agocs 4e266103ad Rename setSceneGraphBackend to setGraphicsApi
...and fix up the docs.

The string-based setSceneGraphBackend() stays of course (the docs have
been enhanced, however). The GraphicsApi enum-based overload is now
renamed to setGraphicsApi().

Using the same name for both functions is a historical artifact, reflecting
the evolution (5.0 - 5.8 - 5.14). In 6.0 we can give it a more appropriate
name, since it does not have much to do with "backends" from the user's
perspective.

Change-Id: Id75dbf81f50a148797e5b5de9be4000153737473
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2020-06-22 16:10:52 +02:00
Alexandru Croitor a7c7e7ceaa CMake: Don't install .qmltypes for Qt tests, examples and tools
that don't have an explicit QT_QML_MODULE_INSTALL_DIR path
specified. We don't want to pollute the Qt qml import path with
these files.

Task-number: QTBUG-84403
Change-Id: I768267e0e79daa8090d882c301648cce14e1a809
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2020-05-29 10:01:40 +02:00
Alexandru Croitor 965984771d CMake: Regenerate qtdeclarative/examples
Includes
- new example installation paths
- one case of QT_QMLTYPES_FILENAME addition

Change-Id: I24423da9b04b6ecc8445017fa35f148dd43b1829
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2020-05-29 10:01:22 +02: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
Alexandru Croitor 26c5243491 Merge remote-tracking branch 'origin/dev' into wip/cmake
Conflicts:
	dependencies.yaml
	src/qml/qml/qqmlengine.cpp

Change-Id: I6a73fd1064286f4a2232de85c2ce7f80452d4641
2020-03-12 15:03:03 +01:00
Fabian Kosmale b1fc5666de vulkan examples: fix missing include
Change-Id: Ib60218f59fc04a93aa6b7923c4b0ceb875cf78ad
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2020-03-09 18:50:47 +01:00
Ulf Hermann c398e6701d Modernize type registration in new examples
Change-Id: I26671d47d663c126e2bff41e8db7b0945db78643
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2020-02-11 19:26:44 +01:00
Frederik Gladhorn 82525a2b38 cmake: Add missing examples
Compilation fails when vulkan headers are found but the example has no
CMakeLists.txt. I assume it's the same for metal.

Change-Id: Ib93b5ff84fb801a5a6801bf600b712579fac8df5
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2019-11-06 16:02:45 +00:00
Laszlo Agocs af623414ec Add guards in .pro of platform/api-specific scenegraph examples
Task-number: QTBUG-78783
Change-Id: Icda60d4358c35de311552fd7562c3cf0c3425b7b
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
2019-10-10 09:54:22 +02:00
Laszlo Agocs 89d654fcd4 Clean up GraphicsStateInfo after API review
Change-Id: I715ad71153151a0e6521bc182227d9fa2dc0a3ea
Reviewed-by: Christian Strømme <christian.stromme@qt.io>
2019-09-18 02:27:10 +00:00
Laszlo Agocs d38bac5969 Fix gcc warnings in vulkanunderqml example
Change-Id: Iea81662f39d2a128cea0e83a766395e0fb1e9896
Reviewed-by: Christian Strømme <christian.stromme@qt.io>
2019-09-11 15:10:25 +02:00
Laszlo Agocs ba3e72ab7e Clarify docs and comments regarding under and overlays
Change-Id: I8973798996b6c775f425819af1d6a09f1773a9dc
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2019-09-08 09:42:11 +02:00
Laszlo Agocs ee702d9436 Make vulkanunderqml work and update docs
What we are doing for now is setting ExternalContentsInPass always.
This way vulkanunderqml works as expected. For applications that do
not integrate external rendering this means that there is now an
additional secondary command buffer per render pass, but we can
live with this for now.

Later (Qt 6) there should be a way to declare this (that the application
will want to issue native rendering stuff) up front in QQuickWindow or
somewhere.

Change-Id: I736741f9b0eee2f8295b046bacdce862e6a546f5
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2019-09-08 09:41:27 +02:00
Laszlo Agocs 76bec768a5 Add vulkanunderqml example
Change-Id: I61e8b50f560d1f4c68731fb19eb13071992040c9
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2019-09-08 09:41:13 +02:00