summaryrefslogtreecommitdiffstats
path: root/libexec
diff options
context:
space:
mode:
authorAlexandru Croitor <alexandru.croitor@qt.io>2024-03-06 17:43:04 +0100
committerAlexandru Croitor <alexandru.croitor@qt.io>2024-03-14 11:44:16 +0100
commit62905163bf887c2c2c9ba7edcd64c96d237a6e95 (patch)
treea2282ce0c3dccce3690bc8ffebdd356679a660f8 /libexec
parentd298a05ed1f86d4789c81877990dfd8965457d74 (diff)
CMake: Allow building all examples as standalone just like tests
Introduce a new libexec/qt-internal-configure-examples script that allows to configure and build "standalone examples" just like "standalone tests". This is a prerequisite for using deployment api in examples for prefix builds, otherwise deployment api gets confused not finding various information that it expects from an installed qt. Because the various conditions in the build system for standalone examples are similar to standalone tests, introduce a new QT_BUILD_STANDALONE_PARTS variable and use that in the conditions. The variable should not be set by the user, and is instead set by the build system whenever QT_BUILD_STANDALONE_TESTS/EXAMPLES is set. Unfortunately due to no common file being available before the first project() call, in qtbase builds, per-repo builds and top-level builds, we need to duplicate the code for setting QT_BUILD_STANDALONE_PARTS for all three cases. Task-number: QTBUG-90820 Task-number: QTBUG-96232 Change-Id: Ia40d03a0e8f5142abe5c7cd4ff3000df4a5f7a8a Reviewed-by: Alexey Edelev <alexey.edelev@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Diffstat (limited to 'libexec')
-rw-r--r--libexec/qt-internal-configure-examples.bat.in34
-rwxr-xr-xlibexec/qt-internal-configure-examples.in5
2 files changed, 39 insertions, 0 deletions
diff --git a/libexec/qt-internal-configure-examples.bat.in b/libexec/qt-internal-configure-examples.bat.in
new file mode 100644
index 0000000000..6b69910c66
--- /dev/null
+++ b/libexec/qt-internal-configure-examples.bat.in
@@ -0,0 +1,34 @@
+@echo off
+setlocal ENABLEDELAYEDEXPANSION ENABLEEXTENSIONS
+set script_dir_path=%~dp0
+set script_dir_path=%script_dir_path:~0,-1%
+
+rem Extracts the source path, make it native, and put it
+rem back again. This is a workaround on Windows LLVM/MINGW
+rem to help CMake find source files when doing Unity Build.
+set args=%*
+set source_dir_path=
+set native_source_dir_path=
+for %%i in (%args%) do (
+ if "%%i"=="-S" (
+ set found=true
+ ) else if defined found (
+ set source_dir_path=%%i
+ set native_source_dir_path=%%~dpnxi
+ set found=
+ )
+)
+
+if NOT "%native_source_dir_path%" == "" (
+ set args=!args:%source_dir_path%=%native_source_dir_path%!
+)
+
+set cmake_scripts_dir=%script_dir_path%
+
+set relative_bin_dir=@relative_path_from_libexec_dir_to_bin_dir@
+if NOT "%relative_bin_dir%" == "" (
+set relative_bin_dir="%relative_bin_dir%"\
+)
+
+call "%script_dir_path%"\%relative_bin_dir%"qt-cmake.bat" ^
+ @script_passed_args@ %args%
diff --git a/libexec/qt-internal-configure-examples.in b/libexec/qt-internal-configure-examples.in
new file mode 100755
index 0000000000..d0bf333ee6
--- /dev/null
+++ b/libexec/qt-internal-configure-examples.in
@@ -0,0 +1,5 @@
+#!/bin/sh
+script_dir_path=`dirname $0`
+script_dir_path=`(cd "$script_dir_path"; /bin/pwd)`
+
+"$script_dir_path/@relative_path_from_libexec_dir_to_bin_dir@/qt-cmake" @script_passed_args@ "$@"