diff options
| author | Alexandru Croitor <alexandru.croitor@qt.io> | 2024-03-18 13:21:08 +0100 |
|---|---|---|
| committer | Alexandru Croitor <alexandru.croitor@qt.io> | 2024-03-22 20:23:52 +0100 |
| commit | 3b30b0fc2e1cda30b83bd2de1f70b3ee0c83ba46 (patch) | |
| tree | f6ad0c88ee352de901fafbf56aa948e8bb78aad7 /examples/opengl | |
| parent | 84dc1f21235db7d0ea59a7f20fa9e811958cef1f (diff) | |
CMake: Add deployment API to our examples
Projects were modified using the tool at:
https://git.qt.io/alcroito/cmake_refactor
A couple of examples had to be adapted manually, due to them including
more than one app per example subdirectory.
The INSTALL_EXAMPLESDIR and INSTALL_EXAMPLEDIR assignments were
removed.
The install(TARGETS) calls were modified according to our
documentation snippets for qt_generate_deploy_app_script.
A qt_generate_deploy_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 and thus
QT_INTERNAL_SKIP_DEPLOYMENT, and also because standalone examples
are not enabled yet, and deployment is disabled for in-tree (so
no-standalone-example) prefix builds.
The install(TARGETS) calls for each example will still run,
installing the examples into an installed_examples directory, that
will not be archived by the CI.
Pick-to: 6.7
Task-number: QTBUG-102056
Task-number: QTBUG-102057
Change-Id: Ida389bbad41710b2ae5da4d95e2d85be9e0cd9ce
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Diffstat (limited to 'examples/opengl')
| -rw-r--r-- | examples/opengl/2dpainting/CMakeLists.txt | 19 | ||||
| -rw-r--r-- | examples/opengl/cube/CMakeLists.txt | 19 | ||||
| -rw-r--r-- | examples/opengl/hellogl2/CMakeLists.txt | 19 | ||||
| -rw-r--r-- | examples/opengl/hellogles3/CMakeLists.txt | 19 | ||||
| -rw-r--r-- | examples/opengl/openglwindow/CMakeLists.txt | 19 | ||||
| -rw-r--r-- | examples/opengl/stereoqopenglwidget/CMakeLists.txt | 19 | ||||
| -rw-r--r-- | examples/opengl/textures/CMakeLists.txt | 19 |
7 files changed, 70 insertions, 63 deletions
diff --git a/examples/opengl/2dpainting/CMakeLists.txt b/examples/opengl/2dpainting/CMakeLists.txt index 0ae6c87f785..b4ae3aa313e 100644 --- a/examples/opengl/2dpainting/CMakeLists.txt +++ b/examples/opengl/2dpainting/CMakeLists.txt @@ -4,12 +4,6 @@ cmake_minimum_required(VERSION 3.16) project(2dpainting LANGUAGES CXX) -if(NOT DEFINED INSTALL_EXAMPLESDIR) - set(INSTALL_EXAMPLESDIR "examples") -endif() - -set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/opengl/2dpainting") - find_package(Qt6 REQUIRED COMPONENTS Core Gui OpenGL OpenGLWidgets Widgets) qt_standard_project_setup() @@ -36,7 +30,14 @@ target_link_libraries(2dpainting PRIVATE ) install(TARGETS 2dpainting - RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" - BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" - LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" + BUNDLE DESTINATION . + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} +) + +qt_generate_deploy_app_script( + TARGET 2dpainting + OUTPUT_SCRIPT deploy_script + NO_UNSUPPORTED_PLATFORM_ERROR ) +install(SCRIPT ${deploy_script}) diff --git a/examples/opengl/cube/CMakeLists.txt b/examples/opengl/cube/CMakeLists.txt index 49ae695de83..7486d058a47 100644 --- a/examples/opengl/cube/CMakeLists.txt +++ b/examples/opengl/cube/CMakeLists.txt @@ -4,12 +4,6 @@ cmake_minimum_required(VERSION 3.16) project(cube LANGUAGES CXX) -if(NOT DEFINED INSTALL_EXAMPLESDIR) - set(INSTALL_EXAMPLESDIR "examples") -endif() - -set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/opengl/cube") - find_package(Qt6 REQUIRED COMPONENTS Core Gui OpenGL OpenGLWidgets Widgets) qt_standard_project_setup() @@ -58,7 +52,14 @@ qt6_add_resources(cube "textures" ) install(TARGETS cube - RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" - BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" - LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" + BUNDLE DESTINATION . + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} +) + +qt_generate_deploy_app_script( + TARGET cube + OUTPUT_SCRIPT deploy_script + NO_UNSUPPORTED_PLATFORM_ERROR ) +install(SCRIPT ${deploy_script}) diff --git a/examples/opengl/hellogl2/CMakeLists.txt b/examples/opengl/hellogl2/CMakeLists.txt index 06b794c37d9..74ef4a8c24f 100644 --- a/examples/opengl/hellogl2/CMakeLists.txt +++ b/examples/opengl/hellogl2/CMakeLists.txt @@ -4,12 +4,6 @@ cmake_minimum_required(VERSION 3.16) project(hellogl2 LANGUAGES CXX) -if(NOT DEFINED INSTALL_EXAMPLESDIR) - set(INSTALL_EXAMPLESDIR "examples") -endif() - -set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/opengl/hellogl2") - find_package(Qt6 REQUIRED COMPONENTS Core Gui OpenGL OpenGLWidgets Widgets) qt_standard_project_setup() @@ -36,7 +30,14 @@ target_link_libraries(hellogl2 PRIVATE ) install(TARGETS hellogl2 - RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" - BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" - LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" + BUNDLE DESTINATION . + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} +) + +qt_generate_deploy_app_script( + TARGET hellogl2 + OUTPUT_SCRIPT deploy_script + NO_UNSUPPORTED_PLATFORM_ERROR ) +install(SCRIPT ${deploy_script}) diff --git a/examples/opengl/hellogles3/CMakeLists.txt b/examples/opengl/hellogles3/CMakeLists.txt index 7908808a843..07df173a47b 100644 --- a/examples/opengl/hellogles3/CMakeLists.txt +++ b/examples/opengl/hellogles3/CMakeLists.txt @@ -4,12 +4,6 @@ cmake_minimum_required(VERSION 3.16) project(hellogles3 LANGUAGES CXX) -if(NOT DEFINED INSTALL_EXAMPLESDIR) - set(INSTALL_EXAMPLESDIR "examples") -endif() - -set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/opengl/hellogles3") - find_package(Qt6 REQUIRED COMPONENTS Core Gui OpenGL) qt_standard_project_setup() @@ -44,7 +38,14 @@ qt_add_resources(hellogles3 "hellogles3" ) install(TARGETS hellogles3 - RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" - BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" - LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" + BUNDLE DESTINATION . + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} +) + +qt_generate_deploy_app_script( + TARGET hellogles3 + OUTPUT_SCRIPT deploy_script + NO_UNSUPPORTED_PLATFORM_ERROR ) +install(SCRIPT ${deploy_script}) diff --git a/examples/opengl/openglwindow/CMakeLists.txt b/examples/opengl/openglwindow/CMakeLists.txt index 6da59a909ec..0258a428228 100644 --- a/examples/opengl/openglwindow/CMakeLists.txt +++ b/examples/opengl/openglwindow/CMakeLists.txt @@ -4,12 +4,6 @@ cmake_minimum_required(VERSION 3.16) project(openglwindow LANGUAGES CXX) -if(NOT DEFINED INSTALL_EXAMPLESDIR) - set(INSTALL_EXAMPLESDIR "examples") -endif() - -set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/opengl/openglwindow") - find_package(Qt6 REQUIRED COMPONENTS Core Gui OpenGL) qt_standard_project_setup() @@ -31,7 +25,14 @@ target_link_libraries(openglwindow PRIVATE ) install(TARGETS openglwindow - RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" - BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" - LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" + BUNDLE DESTINATION . + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} +) + +qt_generate_deploy_app_script( + TARGET openglwindow + OUTPUT_SCRIPT deploy_script + NO_UNSUPPORTED_PLATFORM_ERROR ) +install(SCRIPT ${deploy_script}) diff --git a/examples/opengl/stereoqopenglwidget/CMakeLists.txt b/examples/opengl/stereoqopenglwidget/CMakeLists.txt index c0d1195ed2c..d0fb7a03451 100644 --- a/examples/opengl/stereoqopenglwidget/CMakeLists.txt +++ b/examples/opengl/stereoqopenglwidget/CMakeLists.txt @@ -6,12 +6,6 @@ project(stereoqopenglwidget LANGUAGES CXX) set(CMAKE_AUTOMOC ON) -if(NOT DEFINED INSTALL_EXAMPLESDIR) - set(INSTALL_EXAMPLESDIR "examples") -endif() - -set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/opengl/stereoqopenglwidget") - find_package(Qt6 REQUIRED COMPONENTS Core Gui OpenGL OpenGLWidgets Widgets) qt_add_executable(stereoqopenglwidget @@ -35,7 +29,14 @@ target_link_libraries(stereoqopenglwidget PUBLIC install(TARGETS stereoqopenglwidget - RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" - BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" - LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" + BUNDLE DESTINATION . + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} +) + +qt_generate_deploy_app_script( + TARGET stereoqopenglwidget + OUTPUT_SCRIPT deploy_script + NO_UNSUPPORTED_PLATFORM_ERROR ) +install(SCRIPT ${deploy_script}) diff --git a/examples/opengl/textures/CMakeLists.txt b/examples/opengl/textures/CMakeLists.txt index 6d9621f10a9..2765355c5ae 100644 --- a/examples/opengl/textures/CMakeLists.txt +++ b/examples/opengl/textures/CMakeLists.txt @@ -4,12 +4,6 @@ cmake_minimum_required(VERSION 3.16) project(textures LANGUAGES CXX) -if(NOT DEFINED INSTALL_EXAMPLESDIR) - set(INSTALL_EXAMPLESDIR "examples") -endif() - -set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/opengl/textures") - find_package(Qt6 REQUIRED COMPONENTS Core Gui OpenGL OpenGLWidgets Widgets) qt_standard_project_setup() @@ -51,7 +45,14 @@ qt6_add_resources(textures "textures" ) install(TARGETS textures - RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" - BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" - LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" + BUNDLE DESTINATION . + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} +) + +qt_generate_deploy_app_script( + TARGET textures + OUTPUT_SCRIPT deploy_script + NO_UNSUPPORTED_PLATFORM_ERROR ) +install(SCRIPT ${deploy_script}) |
