Build examples in isolated sub-builds using ExternalProject

Examples are intended to show how to build against an installed Qt.
Building them as part of the main build means the way the Qt targets
are defined and created are not representative of an end user's build.
By building them as separate projects using ExternalProject, we can
more closely replicate the intended audience's environment. This
should allow us to catch more problems earlier.

Having examples built as part of the main build also creates problems
with some static builds where a tool built by the main build is needed
during configure time. This happens with other repos like qtdeclarative
but not (currently) with qtbase. Converting the examples in qtbase to
be built using ExternalProject is intended as a demonstrator for how
other repos can do similar. Until other repos are converted, they will
continue to work as they did before, with examples as part of the main
build for non-static builds only.

The new build-externally behavior is only supported for non-prefix
builds with this change. Prefix builds will continue to use the old
non-external method. Support for building examples externally in
prefix builds will be a separate change.

Task-number: QTBUG-90820
Fixes: QTBUG-91068
Change-Id: I2304329940568dbdb7da18d54d5595ea7d8668bc
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This commit is contained in:
Craig Scott 2021-05-24 16:35:39 +10:00 committed by Alexandru Croitor
parent 9b5fadb9f8
commit d97fd7af2b
49 changed files with 484 additions and 279 deletions

View File

@ -169,7 +169,4 @@ qt_build_repo_end()
if(NOT QT_BUILD_STANDALONE_TESTS AND QT_BUILD_EXAMPLES)
add_subdirectory(examples)
if(NOT QT_BUILD_EXAMPLES_BY_DEFAULT)
set_property(DIRECTORY examples PROPERTY EXCLUDE_FROM_ALL TRUE)
endif()
endif()

View File

@ -466,10 +466,10 @@ macro(qt_build_repo_end)
endif()
endif()
qt_build_internals_add_toplevel_targets()
if(NOT QT_SUPERBUILD)
qt_print_build_instructions()
else()
qt_build_internals_add_toplevel_targets()
endif()
endmacro()
@ -521,13 +521,10 @@ macro(qt_build_repo_impl_tests)
endmacro()
macro(qt_build_repo_impl_examples)
if(QT_BUILD_EXAMPLES AND BUILD_SHARED_LIBS
if(QT_BUILD_EXAMPLES
AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/examples/CMakeLists.txt"
AND NOT QT_BUILD_STANDALONE_TESTS)
add_subdirectory(examples)
if(NOT QT_BUILD_EXAMPLES_BY_DEFAULT)
set_property(DIRECTORY examples PROPERTY EXCLUDE_FROM_ALL TRUE)
endif()
endif()
endmacro()
@ -659,6 +656,58 @@ macro(qt_internal_set_up_build_dir_package_paths)
endmacro()
macro(qt_examples_build_begin)
set(options EXTERNAL_BUILD)
set(singleOpts "")
set(multiOpts DEPENDS)
cmake_parse_arguments(arg "${options}" "${singleOpts}" "${multiOpts}" ${ARGN})
# FIXME: Support prefix builds as well
if(arg_EXTERNAL_BUILD AND NOT QT_WILL_INSTALL)
# Examples will be built using ExternalProject.
# We always depend on all plugins so as to prevent opportunities for
# weird errors associated with loading out-of-date plugins from
# unrelated Qt modules. We also depend on all targets from this repo
# to ensure that we've built anything that a find_package() call within
# an example might use. Projects can add further dependencies if needed,
# but that should rarely be necessary.
set(QT_EXAMPLE_DEPENDENCIES qt_plugins ${qt_repo_targets_name} ${arg_DEPENDS})
set(QT_EXAMPLE_BASE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
string(TOLOWER ${PROJECT_NAME} project_name_lower)
if(NOT TARGET examples)
if(QT_BUILD_EXAMPLES_BY_DEFAULT)
add_custom_target(examples ALL)
else()
add_custom_target(examples)
endif()
endif()
if(NOT TARGET examples_${project_name_lower})
add_custom_target(examples_${project_name_lower})
add_dependencies(examples examples_${project_name_lower})
endif()
include(ExternalProject)
else()
# This repo has not yet been updated to build examples in a separate
# build from this main build, or we can't use that arrangement yet.
# Build them directly as part of the main build instead for backward
# compatibility.
if(NOT BUILD_SHARED_LIBS)
# Ordinarily, it would be an error to call return() from within a
# macro(), but in this case we specifically want to return from the
# caller's scope if we are doing a static build and the project
# isn't building examples in a separate build from the main build.
# Configuring static builds requires tools that are not available
# until build time.
return()
endif()
if(NOT QT_BUILD_EXAMPLES_BY_DEFAULT)
set_directory_properties(PROPERTIES EXCLUDE_FROM_ALL TRUE)
endif()
endif()
# Examples that are built as part of the Qt build need to use the CMake config files from the
# build dir, because they are not installed yet in a prefix build.
# Appending to CMAKE_PREFIX_PATH helps find the initial Qt6Config.cmake.
@ -677,16 +726,28 @@ macro(qt_examples_build_begin)
endmacro()
macro(qt_examples_build_end)
# We use AUTOMOC/UIC/RCC in the examples. Make sure to not fail on a fresh Qt build, that e.g. the moc binary does not exist yet.
# We use AUTOMOC/UIC/RCC in the examples. When the examples are part of the
# main build rather than being built in their own separate project, make
# sure we do not fail on a fresh Qt build (e.g. the moc binary won't exist
# yet because it is created at build time).
# This function gets all targets below this directory
# This function gets all targets below this directory (excluding custom targets and aliases)
function(get_all_targets _result _dir)
get_property(_subdirs DIRECTORY "${_dir}" PROPERTY SUBDIRECTORIES)
foreach(_subdir IN LISTS _subdirs)
get_all_targets(${_result} "${_subdir}")
endforeach()
get_property(_sub_targets DIRECTORY "${_dir}" PROPERTY BUILDSYSTEM_TARGETS)
set(${_result} ${${_result}} ${_sub_targets} PARENT_SCOPE)
set(_real_targets "")
if(_sub_targets)
foreach(__target IN LISTS _sub_targets)
get_target_property(target_type ${__target} TYPE)
if(NOT target_type STREQUAL "UTILITY" AND NOT target_type STREQUAL "ALIAS")
list(APPEND _real_targets ${__target})
endif()
endforeach()
endif()
set(${_result} ${${_result}} ${_real_targets} PARENT_SCOPE)
endfunction()
get_all_targets(targets "${CMAKE_CURRENT_SOURCE_DIR}")
@ -701,6 +762,156 @@ macro(qt_examples_build_end)
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ${BACKUP_CMAKE_FIND_ROOT_PATH_MODE_PACKAGE})
endmacro()
function(qt_internal_add_example subdir)
# FIXME: Support building examples externally for prefix builds as well.
if(QT_WILL_INSTALL)
# Use old non-external approach
add_subdirectory(${subdir} ${ARGN})
return()
endif()
set(options "")
set(singleOpts NAME)
set(multiOpts "")
cmake_parse_arguments(PARSE_ARGV 1 arg "${options}" "${singleOpts}" "${multiOpts}")
if(NOT arg_NAME)
file(RELATIVE_PATH rel_path ${QT_EXAMPLE_BASE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/${subdir})
string(REPLACE "/" "_" arg_NAME "${rel_path}")
endif()
if(QtBase_BINARY_DIR)
# Always use the copy in the build directory, even for prefix builds.
# We may build examples without installing, so we can't use the
# install or staging area.
set(qt_cmake_dir ${QtBase_BINARY_DIR}/lib/cmake/${QT_CMAKE_EXPORT_NAMESPACE})
else()
# This is a per-repo build that isn't the qtbase repo, so we know that
# qtbase was found via find_package() and Qt6_DIR must be set
set(qt_cmake_dir ${${QT_CMAKE_EXPORT_NAMESPACE}_DIR})
endif()
set(vars_to_pass_if_defined)
set(var_defs)
if(QT_HOST_PATH OR CMAKE_CROSSCOMPILING)
# Android NDK forces CMAKE_FIND_ROOT_PATH_MODE_PACKAGE to ONLY, so we
# can't rely on this setting here making it through to the example
# project.
# TODO: We should probably leave CMAKE_FIND_ROOT_PATH_MODE_PACKAGE
# alone. It may be a leftover from earlier methods that are no
# longer used or that no longer need this.
list(APPEND var_defs
-DCMAKE_TOOLCHAIN_FILE:FILEPATH=${qt_cmake_dir}/qt.toolchain.cmake
-DCMAKE_FIND_ROOT_PATH_MODE_PACKAGE:STRING=BOTH
)
else()
get_filename_component(prefix_dir ${qt_cmake_dir}/../../.. ABSOLUTE)
list(PREPEND CMAKE_PREFIX_PATH ${prefix_dir})
# Setting CMAKE_SYSTEM_NAME affects CMAKE_CROSSCOMPILING, even if it is
# set to the same as the host, so it should only be set if it is different.
# See https://gitlab.kitware.com/cmake/cmake/-/issues/21744
if(NOT DEFINED CMAKE_TOOLCHAIN_FILE AND
NOT CMAKE_SYSTEM_NAME STREQUAL CMAKE_HOST_SYSTEM_NAME)
list(APPEND vars_to_pass_if_defined CMAKE_SYSTEM_NAME:STRING)
endif()
endif()
list(APPEND vars_to_pass_if_defined
CMAKE_BUILD_TYPE:STRING
CMAKE_PREFIX_PATH:STRING
CMAKE_FIND_ROOT_PATH:STRING
CMAKE_FIND_ROOT_PATH_MODE_PACKAGE:STRING
BUILD_SHARED_LIBS:BOOL
CMAKE_OSX_ARCHITECTURES:STRING
CMAKE_OSX_DEPLOYMENT_TARGET:STRING
CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_ALLOWED:BOOL
CMAKE_XCODE_ATTRIBUTE_ONLY_ACTIVE_ARCH:BOOL
CMAKE_C_COMPILER_LAUNCHER:STRING
CMAKE_CXX_COMPILER_LAUNCHER:STRING
CMAKE_OBJC_COMPILER_LAUNCHER:STRING
CMAKE_OBJCXX_COMPILER_LAUNCHER:STRING
)
foreach(var_with_type IN LISTS vars_to_pass_if_defined)
string(REPLACE ":" ";" key_as_list "${var_with_type}")
list(GET key_as_list 0 var)
if(NOT DEFINED ${var})
continue()
endif()
# Preserve lists
string(REPLACE ";" "$<SEMICOLON>" varForGenex "${${var}}")
list(APPEND var_defs -D${var_with_type}=${varForGenex})
endforeach()
set(deps "")
list(REMOVE_DUPLICATES QT_EXAMPLE_DEPENDENCIES)
foreach(dep IN LISTS QT_EXAMPLE_DEPENDENCIES)
if(TARGET ${dep})
list(APPEND deps ${dep})
endif()
endforeach()
set(independent_args)
cmake_policy(PUSH)
if(POLICY CMP0114)
set(independent_args INDEPENDENT TRUE)
cmake_policy(SET CMP0114 NEW)
endif()
# The USES_TERMINAL_BUILD setting forces the build step to the console pool
# when using Ninja. This has two benefits:
#
# - You see build output as it is generated instead of at the end of the
# build step.
# - Only one task can use the console pool at a time, so it effectively
# serializes all example build steps, thereby preventing CPU
# over-commitment.
#
# If the loss of interactivity is not so important, one can allow CPU
# over-commitment for Ninja builds. This may result in better throughput,
# but is not allowed by default because it can make a machine almost
# unusable while a compilation is running.
set(terminal_args USES_TERMINAL_BUILD TRUE)
if(CMAKE_GENERATOR MATCHES "Ninja")
option(QT_BUILD_EXAMPLES_WITH_CPU_OVERCOMMIT
"Allow CPU over-commitment when building examples (Ninja only)"
)
if(QT_BUILD_EXAMPLES_WITH_CPU_OVERCOMMIT)
set(terminal_args)
endif()
endif()
ExternalProject_Add(${arg_NAME}
EXCLUDE_FROM_ALL TRUE
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/${subdir}
INSTALL_COMMAND ""
TEST_COMMAND ""
DEPENDS ${deps}
CMAKE_CACHE_ARGS ${var_defs}
${terminal_args}
)
# Force configure step to re-run after we configure the main project
set(reconfigure_check_file ${CMAKE_CURRENT_BINARY_DIR}/reconfigure_${arg_NAME}.txt)
file(TOUCH ${reconfigure_check_file})
ExternalProject_Add_Step(${arg_NAME} reconfigure-check
DEPENDERS configure
DEPENDS ${reconfigure_check_file}
${independent_args}
)
cmake_policy(POP)
string(TOLOWER ${PROJECT_NAME} project_name_lower)
add_dependencies(examples_${project_name_lower} ${arg_NAME})
endfunction()
if ("STANDALONE_TEST" IN_LIST Qt6BuildInternals_FIND_COMPONENTS)
include(${CMAKE_CURRENT_LIST_DIR}/QtStandaloneTestTemplateProject/Main.cmake)
if (NOT PROJECT_VERSION_MAJOR)

View File

@ -1,6 +1,4 @@
# Generated from examples.pro.
qt_examples_build_begin()
qt_examples_build_begin(EXTERNAL_BUILD)
add_subdirectory(corelib)
add_subdirectory(embedded)

View File

@ -4,9 +4,9 @@ if(NOT TARGET Qt::Widgets)
return()
endif()
if(QT_FEATURE_sharedmemory)
add_subdirectory(sharedmemory)
qt_internal_add_example(sharedmemory)
endif()
if(QT_FEATURE_localserver AND TARGET Qt::Network)
add_subdirectory(localfortuneserver)
add_subdirectory(localfortuneclient)
qt_internal_add_example(localfortuneserver)
qt_internal_add_example(localfortuneclient)
endif()

View File

@ -1,5 +1,5 @@
# Generated from mimetypes.pro.
if(TARGET Qt::Widgets)
add_subdirectory(mimetypebrowser)
qt_internal_add_example(mimetypebrowser)
endif()

View File

@ -1,5 +1,5 @@
# Generated from serialization.pro.
add_subdirectory(cbordump)
add_subdirectory(convert)
add_subdirectory(savegame)
qt_internal_add_example(cbordump)
qt_internal_add_example(convert)
qt_internal_add_example(savegame)

View File

@ -1,8 +1,8 @@
# Generated from threads.pro.
add_subdirectory(semaphores)
add_subdirectory(waitconditions)
qt_internal_add_example(semaphores)
qt_internal_add_example(waitconditions)
if(TARGET Qt::Widgets)
add_subdirectory(mandelbrot)
add_subdirectory(queuedcustomtype)
qt_internal_add_example(mandelbrot)
qt_internal_add_example(queuedcustomtype)
endif()

View File

@ -3,6 +3,6 @@
if(NOT TARGET Qt::Widgets)
return()
endif()
add_subdirectory(contiguouscache)
add_subdirectory(customtype)
add_subdirectory(customtypesending)
qt_internal_add_example(contiguouscache)
qt_internal_add_example(customtype)
qt_internal_add_example(customtypesending)

View File

@ -3,12 +3,12 @@
if(NOT TARGET Qt::DBus)
return()
endif()
add_subdirectory(listnames)
add_subdirectory(pingpong)
qt_internal_add_example(listnames)
qt_internal_add_example(pingpong)
if(QT_FEATURE_process)
add_subdirectory(complexpingpong)
qt_internal_add_example(complexpingpong)
endif()
if(TARGET Qt::Widgets)
add_subdirectory(chat)
qt_internal_add_example(chat)
add_subdirectory(remotecontrolledcar)
endif()

View File

@ -1,4 +1,4 @@
# Generated from remotecontrolledcar.pro.
add_subdirectory(car)
add_subdirectory(controller)
qt_internal_add_example(car)
qt_internal_add_example(controller)

View File

@ -3,9 +3,9 @@
if(NOT TARGET Qt::Gui OR (NOT embedded AND NOT x11))
return()
endif()
add_subdirectory(styleexample)
add_subdirectory(raycasting)
add_subdirectory(flickable)
add_subdirectory(digiflip)
add_subdirectory(lightmaps)
add_subdirectory(flightinfo)
qt_internal_add_example(styleexample)
qt_internal_add_example(raycasting)
qt_internal_add_example(flickable)
qt_internal_add_example(digiflip)
qt_internal_add_example(lightmaps)
qt_internal_add_example(flightinfo)

View File

@ -3,5 +3,5 @@
if(NOT TARGET Qt::Gui)
return()
endif()
add_subdirectory(analogclock)
add_subdirectory(rasterwindow)
qt_internal_add_example(analogclock)
qt_internal_add_example(rasterwindow)

View File

@ -3,36 +3,36 @@
if(NOT TARGET Qt::Network)
return()
endif()
add_subdirectory(download)
add_subdirectory(downloadmanager)
qt_internal_add_example(download)
qt_internal_add_example(downloadmanager)
if(NOT INTEGRITY)
add_subdirectory(dnslookup)
qt_internal_add_example(dnslookup)
endif()
if(TARGET Qt::Widgets)
add_subdirectory(blockingfortuneclient)
add_subdirectory(broadcastreceiver)
add_subdirectory(broadcastsender)
add_subdirectory(http)
add_subdirectory(loopback)
add_subdirectory(threadedfortuneserver)
add_subdirectory(googlesuggest)
add_subdirectory(torrent)
add_subdirectory(multicastreceiver)
add_subdirectory(multicastsender)
add_subdirectory(fortuneclient)
add_subdirectory(fortuneserver)
qt_internal_add_example(blockingfortuneclient)
qt_internal_add_example(broadcastreceiver)
qt_internal_add_example(broadcastsender)
qt_internal_add_example(http)
qt_internal_add_example(loopback)
qt_internal_add_example(threadedfortuneserver)
qt_internal_add_example(googlesuggest)
qt_internal_add_example(torrent)
qt_internal_add_example(multicastreceiver)
qt_internal_add_example(multicastsender)
qt_internal_add_example(fortuneclient)
qt_internal_add_example(fortuneserver)
endif()
if(QT_FEATURE_processenvironment AND TARGET Qt::Widgets)
add_subdirectory(network-chat)
qt_internal_add_example(network-chat)
endif()
if(QT_FEATURE_ssl AND TARGET Qt::Widgets)
add_subdirectory(securesocketclient)
qt_internal_add_example(securesocketclient)
endif()
if(QT_FEATURE_dtls AND TARGET Qt::Widgets)
add_subdirectory(secureudpserver)
add_subdirectory(secureudpclient)
qt_internal_add_example(secureudpserver)
qt_internal_add_example(secureudpclient)
endif()
if(QT_FEATURE_sctp AND TARGET Qt::Widgets)
add_subdirectory(multistreamserver)
add_subdirectory(multistreamclient)
qt_internal_add_example(multistreamserver)
qt_internal_add_example(multistreamclient)
endif()

View File

@ -1,17 +1,17 @@
# Generated from opengl.pro.
add_subdirectory(hellowindow)
add_subdirectory(paintedwindow)
add_subdirectory(openglwindow)
add_subdirectory(qopenglwindow)
qt_internal_add_example(hellowindow)
qt_internal_add_example(paintedwindow)
qt_internal_add_example(openglwindow)
qt_internal_add_example(qopenglwindow)
if(TARGET Qt::Widgets)
add_subdirectory(contextinfo)
add_subdirectory(threadedqopenglwidget)
add_subdirectory(2dpainting)
add_subdirectory(hellogl2)
add_subdirectory(qopenglwidget)
add_subdirectory(cube)
add_subdirectory(textures)
add_subdirectory(hellogles3)
add_subdirectory(computegles31)
qt_internal_add_example(contextinfo)
qt_internal_add_example(threadedqopenglwidget)
qt_internal_add_example(2dpainting)
qt_internal_add_example(hellogl2)
qt_internal_add_example(qopenglwidget)
qt_internal_add_example(cube)
qt_internal_add_example(textures)
qt_internal_add_example(hellogles3)
qt_internal_add_example(computegles31)
endif()

View File

@ -3,5 +3,5 @@
if(NOT TARGET Qt::Gui)
return()
endif()
add_subdirectory(windows)
add_subdirectory(qrasterwindow)
qt_internal_add_example(windows)
qt_internal_add_example(qrasterwindow)

View File

@ -4,11 +4,11 @@ if(NOT TARGET Qt::Concurrent)
return()
endif()
if(TARGET Qt::Widgets)
add_subdirectory(imagescaling)
add_subdirectory(progressdialog)
add_subdirectory(runfunction)
add_subdirectory(wordcount)
qt_internal_add_example(imagescaling)
qt_internal_add_example(progressdialog)
qt_internal_add_example(runfunction)
qt_internal_add_example(wordcount)
endif()
if(TARGET Qt::Gui)
add_subdirectory(map)
qt_internal_add_example(map)
endif()

View File

@ -3,8 +3,8 @@
if(NOT TARGET Qt::Widgets)
return()
endif()
add_subdirectory(tutorial1)
add_subdirectory(tutorial2)
add_subdirectory(tutorial3)
add_subdirectory(tutorial4)
add_subdirectory(tutorial5)
qt_internal_add_example(tutorial1)
qt_internal_add_example(tutorial2)
qt_internal_add_example(tutorial3)
qt_internal_add_example(tutorial4)
qt_internal_add_example(tutorial5)

View File

@ -3,17 +3,17 @@
if(NOT TARGET Qt::Widgets)
return()
endif()
add_subdirectory(books)
add_subdirectory(drilldown)
add_subdirectory(cachedtable)
add_subdirectory(querymodel)
add_subdirectory(relationaltablemodel)
add_subdirectory(sqlwidgetmapper)
add_subdirectory(tablemodel)
qt_internal_add_example(books)
qt_internal_add_example(drilldown)
qt_internal_add_example(cachedtable)
qt_internal_add_example(querymodel)
qt_internal_add_example(relationaltablemodel)
qt_internal_add_example(sqlwidgetmapper)
qt_internal_add_example(tablemodel)
if(TARGET Qt::Xml)
add_subdirectory(masterdetail)
qt_internal_add_example(masterdetail)
endif()
if(NOT CMAKE_CROSSCOMPILING) # special case
add_subdirectory(sqlbrowser)
qt_internal_add_example(sqlbrowser)
endif()

View File

@ -1,11 +1,11 @@
# Generated from vulkan.pro.
add_subdirectory(hellovulkanwindow)
add_subdirectory(hellovulkantriangle)
add_subdirectory(hellovulkantexture)
qt_internal_add_example(hellovulkanwindow)
qt_internal_add_example(hellovulkantriangle)
qt_internal_add_example(hellovulkantexture)
if(TARGET Qt::Widgets)
add_subdirectory(hellovulkanwidget)
qt_internal_add_example(hellovulkanwidget)
endif()
if(TARGET Qt::Concurrent AND TARGET Qt::Widgets)
add_subdirectory(hellovulkancubes)
qt_internal_add_example(hellovulkancubes)
endif()

View File

@ -9,7 +9,7 @@ endif()
add_subdirectory(desktop)
add_subdirectory(dialogs)
add_subdirectory(effects)
add_subdirectory(gallery)
qt_internal_add_example(gallery)
add_subdirectory(gestures)
add_subdirectory(graphicsview)
add_subdirectory(itemviews)
@ -28,5 +28,5 @@ if(QT_FEATURE_cursor) # special case
add_subdirectory(mainwindows)
endif()
if(QT_FEATURE_opengl AND TARGET Qt::Gui)
add_subdirectory(windowcontainer)
qt_internal_add_example(windowcontainer)
endif()

View File

@ -1,3 +1,3 @@
# Generated from animation.pro.
add_subdirectory(easing)
qt_internal_add_example(easing)

View File

@ -1,4 +1,4 @@
# Generated from desktop.pro.
add_subdirectory(screenshot)
add_subdirectory(systray)
qt_internal_add_example(screenshot)
qt_internal_add_example(systray)

View File

@ -1,13 +1,13 @@
# Generated from dialogs.pro.
if(QT_FEATURE_wizard)
add_subdirectory(classwizard)
add_subdirectory(trivialwizard)
qt_internal_add_example(classwizard)
qt_internal_add_example(trivialwizard)
endif()
add_subdirectory(extension)
add_subdirectory(findfiles)
add_subdirectory(standarddialogs)
add_subdirectory(tabdialog)
qt_internal_add_example(extension)
qt_internal_add_example(findfiles)
qt_internal_add_example(standarddialogs)
qt_internal_add_example(tabdialog)
if(QT_FEATURE_wizard AND TARGET Qt::PrintSupport)
add_subdirectory(licensewizard)
qt_internal_add_example(licensewizard)
endif()

View File

@ -1,7 +1,7 @@
# Generated from draganddrop.pro.
add_subdirectory(draggableicons)
add_subdirectory(draggabletext)
add_subdirectory(dropsite)
add_subdirectory(fridgemagnets)
add_subdirectory(puzzle)
qt_internal_add_example(draggableicons)
qt_internal_add_example(draggabletext)
qt_internal_add_example(dropsite)
qt_internal_add_example(fridgemagnets)
qt_internal_add_example(puzzle)

View File

@ -1,4 +1,4 @@
# Generated from effects.pro.
add_subdirectory(blurpicker)
add_subdirectory(fademessage)
qt_internal_add_example(blurpicker)
qt_internal_add_example(fademessage)

View File

@ -3,4 +3,4 @@
if(NOT TARGET Qt::Widgets)
return()
endif()
add_subdirectory(imagegestures)
qt_internal_add_example(imagegestures)

View File

@ -1,15 +1,15 @@
# Generated from graphicsview.pro.
add_subdirectory(chip)
add_subdirectory(elasticnodes)
add_subdirectory(embeddeddialogs)
add_subdirectory(collidingmice)
add_subdirectory(basicgraphicslayouts)
add_subdirectory(diagramscene)
add_subdirectory(flowlayout)
add_subdirectory(anchorlayout)
add_subdirectory(simpleanchorlayout)
add_subdirectory(weatheranchorlayout)
qt_internal_add_example(chip)
qt_internal_add_example(elasticnodes)
qt_internal_add_example(embeddeddialogs)
qt_internal_add_example(collidingmice)
qt_internal_add_example(basicgraphicslayouts)
qt_internal_add_example(diagramscene)
qt_internal_add_example(flowlayout)
qt_internal_add_example(anchorlayout)
qt_internal_add_example(simpleanchorlayout)
qt_internal_add_example(weatheranchorlayout)
if(QT_FEATURE_cursor AND QT_FEATURE_draganddrop)
add_subdirectory(dragdroprobot)
qt_internal_add_example(dragdroprobot)
endif()

View File

@ -1,27 +1,27 @@
# Generated from itemviews.pro.
add_subdirectory(addressbook)
add_subdirectory(basicsortfiltermodel)
add_subdirectory(chart)
add_subdirectory(coloreditorfactory)
add_subdirectory(combowidgetmapper)
add_subdirectory(customsortfiltermodel)
add_subdirectory(dirview)
add_subdirectory(editabletreemodel)
add_subdirectory(fetchmore)
add_subdirectory(flattreeview)
add_subdirectory(frozencolumn)
add_subdirectory(interview)
add_subdirectory(pixelator)
add_subdirectory(simpletreemodel)
add_subdirectory(simplewidgetmapper)
add_subdirectory(spinboxdelegate)
add_subdirectory(spreadsheet)
add_subdirectory(stardelegate)
add_subdirectory(storageview)
qt_internal_add_example(addressbook)
qt_internal_add_example(basicsortfiltermodel)
qt_internal_add_example(chart)
qt_internal_add_example(coloreditorfactory)
qt_internal_add_example(combowidgetmapper)
qt_internal_add_example(customsortfiltermodel)
qt_internal_add_example(dirview)
qt_internal_add_example(editabletreemodel)
qt_internal_add_example(fetchmore)
qt_internal_add_example(flattreeview)
qt_internal_add_example(frozencolumn)
qt_internal_add_example(interview)
qt_internal_add_example(pixelator)
qt_internal_add_example(simpletreemodel)
qt_internal_add_example(simplewidgetmapper)
qt_internal_add_example(spinboxdelegate)
qt_internal_add_example(spreadsheet)
qt_internal_add_example(stardelegate)
qt_internal_add_example(storageview)
if(QT_FEATURE_draganddrop)
add_subdirectory(puzzle)
qt_internal_add_example(puzzle)
endif()
if(TARGET Qt::Xml)
add_subdirectory(simpledommodel)
qt_internal_add_example(simpledommodel)
endif()

View File

@ -1,6 +1,6 @@
# Generated from layouts.pro.
add_subdirectory(basiclayouts)
add_subdirectory(borderlayout)
add_subdirectory(dynamiclayouts)
add_subdirectory(flowlayout)
qt_internal_add_example(basiclayouts)
qt_internal_add_example(borderlayout)
qt_internal_add_example(dynamiclayouts)
qt_internal_add_example(flowlayout)

View File

@ -1,8 +1,8 @@
# Generated from mainwindows.pro.
add_subdirectory(application)
add_subdirectory(dockwidgets)
add_subdirectory(mainwindow)
add_subdirectory(mdi)
add_subdirectory(menus)
add_subdirectory(sdi)
qt_internal_add_example(application)
qt_internal_add_example(dockwidgets)
qt_internal_add_example(mainwindow)
qt_internal_add_example(mdi)
qt_internal_add_example(menus)
qt_internal_add_example(sdi)

View File

@ -1,14 +1,14 @@
# Generated from painting.pro.
add_subdirectory(shared) # special case
add_subdirectory(basicdrawing)
add_subdirectory(concentriccircles)
add_subdirectory(affine)
# add_subdirectory(composition) # special case FIXME: Seems buggy wrt. usesOpenGL function
add_subdirectory(deform)
add_subdirectory(gradients)
add_subdirectory(pathstroke)
add_subdirectory(imagecomposition)
add_subdirectory(painterpaths)
add_subdirectory(transformations)
add_subdirectory(fontsampler)
#add_subdirectory(shared) # special case pulled in by other subdirs as needed
qt_internal_add_example(basicdrawing)
qt_internal_add_example(concentriccircles)
qt_internal_add_example(affine)
# qt_internal_add_example(composition) # special case FIXME: Seems buggy wrt. usesOpenGL function
qt_internal_add_example(deform)
qt_internal_add_example(gradients)
qt_internal_add_example(pathstroke)
qt_internal_add_example(imagecomposition)
qt_internal_add_example(painterpaths)
qt_internal_add_example(transformations)
qt_internal_add_example(fontsampler)

View File

@ -1,6 +1,6 @@
# Generated from richtext.pro.
add_subdirectory(calendar)
add_subdirectory(orderform)
add_subdirectory(syntaxhighlighter)
add_subdirectory(textedit)
qt_internal_add_example(calendar)
qt_internal_add_example(orderform)
qt_internal_add_example(syntaxhighlighter)
qt_internal_add_example(textedit)

View File

@ -1,3 +1,3 @@
# Generated from scroller.pro.
add_subdirectory(graphicsview)
qt_internal_add_example(graphicsview)

View File

@ -1,22 +1,22 @@
# Generated from tools.pro.
add_subdirectory(completer)
add_subdirectory(customcompleter)
qt_internal_add_example(completer)
qt_internal_add_example(customcompleter)
if(QT_FEATURE_translation) # special case
add_subdirectory(i18n)
qt_internal_add_example(i18n)
endif()
add_subdirectory(regularexpression)
add_subdirectory(settingseditor)
add_subdirectory(styleplugin)
add_subdirectory(treemodelcompleter)
add_subdirectory(undo)
add_subdirectory(undoframework)
qt_internal_add_example(regularexpression)
qt_internal_add_example(settingseditor)
qt_internal_add_example(styleplugin)
qt_internal_add_example(treemodelcompleter)
qt_internal_add_example(undo)
qt_internal_add_example(undoframework)
if(QT_FEATURE_library) # special case
add_subdirectory(echoplugin)
# special case begin
if(QT_FEATURE_inputdialog)
add_subdirectory(plugandpaint)
qt_internal_add_example(plugandpaint)
endif()
# special case end
endif()

View File

@ -1,4 +1,4 @@
# Generated from echoplugin.pro.
add_subdirectory(echowindow)
add_subdirectory(plugin)
qt_internal_add_example(echowindow)
qt_internal_add_example(plugin)

View File

@ -3,7 +3,7 @@
if(NOT TARGET Qt::Widgets)
return()
endif()
add_subdirectory(pinchzoom)
add_subdirectory(fingerpaint)
add_subdirectory(knobs)
add_subdirectory(dials)
qt_internal_add_example(pinchzoom)
qt_internal_add_example(fingerpaint)
qt_internal_add_example(knobs)
qt_internal_add_example(dials)

View File

@ -4,4 +4,4 @@ add_subdirectory(addressbook)
add_subdirectory(widgets)
add_subdirectory(modelview)
add_subdirectory(gettingStarted)
add_subdirectory(notepad)
qt_internal_add_example(notepad)

View File

@ -1,9 +1,9 @@
# Generated from addressbook.pro.
add_subdirectory(part1)
add_subdirectory(part2)
add_subdirectory(part3)
add_subdirectory(part4)
add_subdirectory(part5)
add_subdirectory(part6)
add_subdirectory(part7)
qt_internal_add_example(part1)
qt_internal_add_example(part2)
qt_internal_add_example(part3)
qt_internal_add_example(part4)
qt_internal_add_example(part5)
qt_internal_add_example(part6)
qt_internal_add_example(part7)

View File

@ -1,2 +1 @@
# Generated from gettingStarted.pro.
add_subdirectory(gsQt)

View File

@ -1,7 +1,7 @@
# Generated from gsqt.pro.
add_subdirectory(part1)
add_subdirectory(part2)
add_subdirectory(part3)
add_subdirectory(part4)
add_subdirectory(part5)
qt_internal_add_example(part1)
qt_internal_add_example(part2)
qt_internal_add_example(part3)
qt_internal_add_example(part4)
qt_internal_add_example(part5)

View File

@ -1,7 +1,7 @@
# Generated from part1.pro.
cmake_minimum_required(VERSION 3.14)
project(part1 LANGUAGES CXX)
project(getting_started_part1 LANGUAGES CXX)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
@ -19,20 +19,20 @@ find_package(Qt6 COMPONENTS Core)
find_package(Qt6 COMPONENTS Gui)
find_package(Qt6 COMPONENTS Widgets)
qt_add_executable(part1
qt_add_executable(getting_started_part1
main.cpp
)
set_target_properties(part1 PROPERTIES
set_target_properties(getting_started_part1 PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
target_link_libraries(part1 PUBLIC
target_link_libraries(getting_started_part1 PUBLIC
Qt::Core
Qt::Gui
Qt::Widgets
)
install(TARGETS part1
install(TARGETS getting_started_part1
RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"

View File

@ -1,7 +1,7 @@
# Generated from part2.pro.
cmake_minimum_required(VERSION 3.14)
project(part2 LANGUAGES CXX)
project(getting_started_part2 LANGUAGES CXX)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
@ -19,20 +19,20 @@ find_package(Qt6 COMPONENTS Core)
find_package(Qt6 COMPONENTS Gui)
find_package(Qt6 COMPONENTS Widgets)
qt_add_executable(part2
qt_add_executable(getting_started_part2
main.cpp
)
set_target_properties(part2 PROPERTIES
set_target_properties(getting_started_part2 PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
target_link_libraries(part2 PUBLIC
target_link_libraries(getting_started_part2 PUBLIC
Qt::Core
Qt::Gui
Qt::Widgets
)
install(TARGETS part2
install(TARGETS getting_started_part2
RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"

View File

@ -1,7 +1,7 @@
# Generated from part3.pro.
cmake_minimum_required(VERSION 3.14)
project(part3 LANGUAGES CXX)
project(getting_started_part3 LANGUAGES CXX)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
@ -19,20 +19,20 @@ find_package(Qt6 COMPONENTS Core)
find_package(Qt6 COMPONENTS Gui)
find_package(Qt6 COMPONENTS Widgets)
qt_add_executable(part3
qt_add_executable(getting_started_part3
main.cpp
)
set_target_properties(part3 PROPERTIES
set_target_properties(getting_started_part3 PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
target_link_libraries(part3 PUBLIC
target_link_libraries(getting_started_part3 PUBLIC
Qt::Core
Qt::Gui
Qt::Widgets
)
install(TARGETS part3
install(TARGETS getting_started_part3
RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"

View File

@ -1,7 +1,7 @@
# Generated from part4.pro.
cmake_minimum_required(VERSION 3.14)
project(part4 LANGUAGES CXX)
project(getting_started_part4 LANGUAGES CXX)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
@ -19,20 +19,20 @@ find_package(Qt6 COMPONENTS Core)
find_package(Qt6 COMPONENTS Gui)
find_package(Qt6 COMPONENTS Widgets)
qt_add_executable(part4
qt_add_executable(getting_started_part4
main.cpp
)
set_target_properties(part4 PROPERTIES
set_target_properties(getting_started_part4 PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
target_link_libraries(part4 PUBLIC
target_link_libraries(getting_started_part4 PUBLIC
Qt::Core
Qt::Gui
Qt::Widgets
)
install(TARGETS part4
install(TARGETS getting_started_part4
RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"

View File

@ -1,7 +1,7 @@
# Generated from part5.pro.
cmake_minimum_required(VERSION 3.14)
project(part5 LANGUAGES CXX)
project(getting_started_part5 LANGUAGES CXX)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
@ -19,20 +19,20 @@ find_package(Qt6 COMPONENTS Core)
find_package(Qt6 COMPONENTS Gui)
find_package(Qt6 COMPONENTS Widgets)
qt_add_executable(part5
qt_add_executable(getting_started_part5
main.cpp
)
set_target_properties(part5 PROPERTIES
set_target_properties(getting_started_part5 PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
target_link_libraries(part5 PUBLIC
target_link_libraries(getting_started_part5 PUBLIC
Qt::Core
Qt::Gui
Qt::Widgets
)
install(TARGETS part5
install(TARGETS getting_started_part5
RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"

View File

@ -1,9 +1,9 @@
# Generated from modelview.pro.
add_subdirectory(1_readonly)
add_subdirectory(2_formatting)
add_subdirectory(3_changingmodel)
add_subdirectory(4_headers)
add_subdirectory(5_edit)
add_subdirectory(6_treeview)
add_subdirectory(7_selections)
qt_internal_add_example(1_readonly)
qt_internal_add_example(2_formatting)
qt_internal_add_example(3_changingmodel)
qt_internal_add_example(4_headers)
qt_internal_add_example(5_edit)
qt_internal_add_example(6_treeview)
qt_internal_add_example(7_selections)

View File

@ -1,6 +1,6 @@
# Generated from widgets.pro.
add_subdirectory(toplevel)
add_subdirectory(childwidget)
add_subdirectory(windowlayout)
add_subdirectory(nestedlayouts)
qt_internal_add_example(toplevel)
qt_internal_add_example(childwidget)
qt_internal_add_example(windowlayout)
qt_internal_add_example(nestedlayouts)

View File

@ -1,27 +1,27 @@
# Generated from widgets.pro.
add_subdirectory(analogclock)
add_subdirectory(calculator)
add_subdirectory(calendarwidget)
add_subdirectory(charactermap)
add_subdirectory(codeeditor)
add_subdirectory(digitalclock)
add_subdirectory(elidedlabel)
add_subdirectory(groupbox)
add_subdirectory(icons)
add_subdirectory(imageviewer)
add_subdirectory(lineedits)
add_subdirectory(movie)
add_subdirectory(mousebuttons)
add_subdirectory(scribble)
add_subdirectory(shapedclock)
add_subdirectory(sliders)
add_subdirectory(spinboxes)
add_subdirectory(styles)
add_subdirectory(stylesheet)
add_subdirectory(tablet)
add_subdirectory(tetrix)
add_subdirectory(tooltips)
add_subdirectory(validators)
add_subdirectory(wiggly)
add_subdirectory(windowflags)
qt_internal_add_example(analogclock)
qt_internal_add_example(calculator)
qt_internal_add_example(calendarwidget)
qt_internal_add_example(charactermap)
qt_internal_add_example(codeeditor)
qt_internal_add_example(digitalclock)
qt_internal_add_example(elidedlabel)
qt_internal_add_example(groupbox)
qt_internal_add_example(icons)
qt_internal_add_example(imageviewer)
qt_internal_add_example(lineedits)
qt_internal_add_example(movie)
qt_internal_add_example(mousebuttons)
qt_internal_add_example(scribble)
qt_internal_add_example(shapedclock)
qt_internal_add_example(sliders)
qt_internal_add_example(spinboxes)
qt_internal_add_example(styles)
qt_internal_add_example(stylesheet)
qt_internal_add_example(tablet)
qt_internal_add_example(tetrix)
qt_internal_add_example(tooltips)
qt_internal_add_example(validators)
qt_internal_add_example(wiggly)
qt_internal_add_example(windowflags)

View File

@ -1,11 +1,11 @@
# Generated from xml.pro.
add_subdirectory(htmlinfo)
add_subdirectory(xmlstreamlint)
qt_internal_add_example(htmlinfo)
qt_internal_add_example(xmlstreamlint)
if(TARGET Qt::Widgets)
add_subdirectory(dombookmarks)
add_subdirectory(streambookmarks)
qt_internal_add_example(dombookmarks)
qt_internal_add_example(streambookmarks)
endif()
if(TARGET Qt::Network AND TARGET Qt::Widgets)
add_subdirectory(rsslisting)
qt_internal_add_example(rsslisting)
endif()