CMake: Make qt-internal-configure-tests relocatable
It's important for conan CI builds where the correct installation location of Qt should be used when configuring standalone tests. Task-number: QTBUG-93037 Change-Id: I2465a439aea6826dedfb3217d1c909ad639d4ac0 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
This commit is contained in:
parent
d81a9206ac
commit
adf29329ea
@ -3,6 +3,7 @@ qt_path_join(__GlobalConfig_build_dir ${QT_CONFIG_BUILD_DIR} ${__GlobalConfig_pa
|
|||||||
qt_path_join(__GlobalConfig_install_dir ${QT_CONFIG_INSTALL_DIR} ${__GlobalConfig_path_suffix})
|
qt_path_join(__GlobalConfig_install_dir ${QT_CONFIG_INSTALL_DIR} ${__GlobalConfig_path_suffix})
|
||||||
set(__GlobalConfig_install_dir_absolute "${__GlobalConfig_install_dir}")
|
set(__GlobalConfig_install_dir_absolute "${__GlobalConfig_install_dir}")
|
||||||
set(__qt_bin_dir_absolute "${QT_INSTALL_DIR}/${INSTALL_BINDIR}")
|
set(__qt_bin_dir_absolute "${QT_INSTALL_DIR}/${INSTALL_BINDIR}")
|
||||||
|
set(__qt_libexec_dir_absolute "${QT_INSTALL_DIR}/${INSTALL_LIBEXECDIR}")
|
||||||
if(QT_WILL_INSTALL)
|
if(QT_WILL_INSTALL)
|
||||||
# Need to prepend the install prefix when doing prefix builds, because the config install dir
|
# Need to prepend the install prefix when doing prefix builds, because the config install dir
|
||||||
# is relative then.
|
# is relative then.
|
||||||
@ -11,6 +12,8 @@ if(QT_WILL_INSTALL)
|
|||||||
${__GlobalConfig_install_dir_absolute})
|
${__GlobalConfig_install_dir_absolute})
|
||||||
qt_path_join(__qt_bin_dir_absolute
|
qt_path_join(__qt_bin_dir_absolute
|
||||||
${QT_BUILD_INTERNALS_RELOCATABLE_INSTALL_PREFIX} ${__qt_bin_dir_absolute})
|
${QT_BUILD_INTERNALS_RELOCATABLE_INSTALL_PREFIX} ${__qt_bin_dir_absolute})
|
||||||
|
qt_path_join(__qt_libexec_dir_absolute
|
||||||
|
${QT_BUILD_INTERNALS_RELOCATABLE_INSTALL_PREFIX} ${__qt_libexec_dir_absolute})
|
||||||
endif()
|
endif()
|
||||||
# Compute relative path from $qt_prefix/bin dir to global CMake config install dir, to use in the
|
# Compute relative path from $qt_prefix/bin dir to global CMake config install dir, to use in the
|
||||||
# unix-y qt-cmake shell script, to make it work even if the installed Qt is relocated.
|
# unix-y qt-cmake shell script, to make it work even if the installed Qt is relocated.
|
||||||
|
@ -138,24 +138,28 @@ function(qt_internal_create_qt_configure_tests_wrapper_script)
|
|||||||
#
|
#
|
||||||
# The script takes a path to the repo for which the standalone tests will be configured.
|
# The script takes a path to the repo for which the standalone tests will be configured.
|
||||||
set(script_name "qt-internal-configure-tests")
|
set(script_name "qt-internal-configure-tests")
|
||||||
set(qt_cmake_path
|
|
||||||
"${QT_STAGING_PREFIX}/${INSTALL_BINDIR}/qt-cmake")
|
|
||||||
|
|
||||||
set(common_args "-DQT_BUILD_STANDALONE_TESTS=ON")
|
set(script_passed_args "-DQT_BUILD_STANDALONE_TESTS=ON")
|
||||||
|
|
||||||
|
file(RELATIVE_PATH relative_path_from_libexec_dir_to_bin_dir
|
||||||
|
${__qt_libexec_dir_absolute}
|
||||||
|
${__qt_bin_dir_absolute})
|
||||||
|
file(TO_NATIVE_PATH "${relative_path_from_libexec_dir_to_bin_dir}"
|
||||||
|
relative_path_from_libexec_dir_to_bin_dir)
|
||||||
|
|
||||||
if(CMAKE_HOST_UNIX)
|
if(CMAKE_HOST_UNIX)
|
||||||
set(script_os_prelude "#!/bin/sh")
|
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/libexec/${script_name}.in"
|
||||||
string(PREPEND qt_cmake_path "exec ")
|
"${QT_BUILD_DIR}/${INSTALL_LIBEXECDIR}/${script_name}" @ONLY)
|
||||||
set(script_passed_args "${common_args} \"$@\"")
|
|
||||||
|
qt_install(PROGRAMS "${QT_BUILD_DIR}/${INSTALL_LIBEXECDIR}/${script_name}"
|
||||||
|
DESTINATION "${INSTALL_LIBEXECDIR}")
|
||||||
else()
|
else()
|
||||||
set(script_os_prelude "@echo off")
|
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/libexec/${script_name}.bat.in"
|
||||||
string(APPEND script_name ".bat")
|
"${QT_BUILD_DIR}/${INSTALL_LIBEXECDIR}/${script_name}.bat" @ONLY)
|
||||||
string(APPEND qt_cmake_path ".bat")
|
|
||||||
set(script_passed_args "${common_args} %*")
|
qt_install(PROGRAMS "${QT_BUILD_DIR}/${INSTALL_LIBEXECDIR}/${script_name}.bat"
|
||||||
|
DESTINATION "${INSTALL_LIBEXECDIR}")
|
||||||
endif()
|
endif()
|
||||||
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/libexec/qt-internal-configure-tests.in"
|
|
||||||
"${QT_BUILD_DIR}/${INSTALL_LIBEXECDIR}/${script_name}")
|
|
||||||
qt_install(PROGRAMS "${QT_BUILD_DIR}/${INSTALL_LIBEXECDIR}/${script_name}"
|
|
||||||
DESTINATION "${INSTALL_LIBEXECDIR}")
|
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
function(qt_internal_install_android_helper_scripts)
|
function(qt_internal_install_android_helper_scripts)
|
||||||
|
9
libexec/qt-internal-configure-tests.bat.in
Normal file
9
libexec/qt-internal-configure-tests.bat.in
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
@echo off
|
||||||
|
setlocal ENABLEDELAYEDEXPANSION ENABLEEXTENSIONS
|
||||||
|
set script_dir_path=%~dp0
|
||||||
|
set script_dir_path=%script_dir_path:~0,-1%
|
||||||
|
|
||||||
|
set cmake_scripts_dir=%script_dir_path%
|
||||||
|
|
||||||
|
call "%script_dir_path%"\"@relative_path_from_libexec_dir_to_bin_dir@"\qt-cmake.bat ^
|
||||||
|
@script_passed_args@ %*
|
@ -1,3 +1,5 @@
|
|||||||
@script_os_prelude@
|
#!/bin/sh
|
||||||
|
script_dir_path=`dirname $0`
|
||||||
|
script_dir_path=`(cd "$script_dir_path"; /bin/pwd)`
|
||||||
|
|
||||||
@qt_cmake_path@ @script_passed_args@
|
"$script_dir_path/@relative_path_from_libexec_dir_to_bin_dir@/qt-cmake" @script_passed_args@ "$@"
|
||||||
|
Loading…
Reference in New Issue
Block a user