Create the versioned variant of Qt tools in cross platform build
In cross builds, we are not creating versioned links for qt tools. This patch addresses that. I've changed the signature of the `qt_internal_install_versioned_link` such that it can be used for non-target as well, so in cross build the qmake or qtmake.bat can be processed with the same function. Fixes: QTBUG-109024 Change-Id: I246621c18325d084622ca92b422e815ed06f1381 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This commit is contained in:
parent
d8abcc969b
commit
ca24ee14df
@ -1,2 +1,2 @@
|
||||
@echo off
|
||||
@host_qt_bindir@\@tool_name@.exe -qtconf "%~dp0\target_qt.conf" %*
|
||||
@host_qt_bindir@\@tool_name@@tool_version@.exe -qtconf "%~dp0\target_qt.conf" %*
|
||||
|
@ -4,4 +4,4 @@
|
||||
script_dir_path=`dirname $0`
|
||||
script_dir_path=`(cd "$script_dir_path"; /bin/pwd)`
|
||||
|
||||
@host_qt_bindir@/@tool_name@ -qtconf "$script_dir_path/target_qt.conf" $*
|
||||
@host_qt_bindir@/@tool_name@@tool_version@ -qtconf "$script_dir_path/target_qt.conf" $*
|
||||
|
@ -83,7 +83,8 @@ function(qt_internal_add_app target)
|
||||
|
||||
# Install versioned link if requested.
|
||||
if(NOT arg_NO_INSTALL AND arg_INSTALL_VERSIONED_LINK)
|
||||
qt_internal_install_versioned_link("${arg_INSTALL_DIR}" ${target})
|
||||
qt_internal_install_versioned_link(WORKING_DIRECTORY "${arg_INSTALL_DIR}"
|
||||
TARGETS ${target})
|
||||
endif()
|
||||
|
||||
qt_add_list_file_finalizer(qt_internal_finalize_app ${target})
|
||||
|
@ -95,12 +95,27 @@ function(qt_copy_or_install)
|
||||
qt_non_prefix_copy(COPY ${argv_copy} ${copy_arguments})
|
||||
endfunction()
|
||||
|
||||
# Create a versioned hard-link for the given target.
|
||||
# Create a versioned hard-link for the given target, or a program
|
||||
# E.g. "bin/qmake6" -> "bin/qmake".
|
||||
# If no hard link can be created, make a copy instead.
|
||||
#
|
||||
# One-value Arguments:
|
||||
# WORKING_DIRECTORY
|
||||
# The directory where the original file is already placed.
|
||||
# SUFFIX
|
||||
# The program file extension, only used for PROGRAMS
|
||||
# Multi-value Arguments:
|
||||
# TARGETS
|
||||
# List of targets for which the versioned link will be created.
|
||||
# If targets are given, BASE_NAME and SUFFIX will be derived from it.
|
||||
# PROGRAMS
|
||||
# List of program file names for which the versioned link will be created.
|
||||
#
|
||||
#
|
||||
# NOTE: This assumes that TARGETS, or PROGRAMS are already installed in the
|
||||
# WORKING_DIRECTORY.
|
||||
#
|
||||
# In a multi-config build, create the link for the main config only.
|
||||
function(qt_internal_install_versioned_link install_dir target)
|
||||
function(qt_internal_install_versioned_link)
|
||||
if(NOT QT_WILL_INSTALL)
|
||||
return()
|
||||
endif()
|
||||
@ -109,13 +124,41 @@ function(qt_internal_install_versioned_link install_dir target)
|
||||
return()
|
||||
endif()
|
||||
|
||||
set(options)
|
||||
set(oneValueArgs "WORKING_DIRECTORY;SUFFIX")
|
||||
set(multiValueArgs "TARGETS;PROGRAMS")
|
||||
cmake_parse_arguments(arg "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
|
||||
|
||||
if(arg_TARGETS)
|
||||
foreach(target "${arg_TARGETS}")
|
||||
_qt_internal_create_versioned_link_or_copy("${arg_WORKING_DIRECTORY}"
|
||||
$<TARGET_FILE_BASE_NAME:${target}>
|
||||
$<TARGET_FILE_SUFFIX:${target}>)
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
if(arg_PROGRAMS)
|
||||
foreach(program "${arg_PROGRAMS}")
|
||||
_qt_internal_create_versioned_link_or_copy("${arg_WORKING_DIRECTORY}"
|
||||
"${program}"
|
||||
"${arg_SUFFIX}")
|
||||
endforeach()
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
# Generate a script for creating a hard-link between the base_name, and
|
||||
# base_name${PROJECT_VERSION_MAJOR}.
|
||||
#
|
||||
# If no hard link can be created, make a copy instead.
|
||||
function(_qt_internal_create_versioned_link_or_copy install_dir base_name suffix)
|
||||
qt_path_join(install_base_file_path "$\{qt_full_install_prefix}"
|
||||
"${install_dir}" "$<TARGET_FILE_BASE_NAME:${target}>")
|
||||
set(original "${install_base_file_path}$<TARGET_FILE_SUFFIX:${target}>")
|
||||
set(linkname "${install_base_file_path}${PROJECT_VERSION_MAJOR}$<TARGET_FILE_SUFFIX:${target}>")
|
||||
"${install_dir}" "${base_name}")
|
||||
set(original "${install_base_file_path}${suffix}")
|
||||
set(linkname "${install_base_file_path}${PROJECT_VERSION_MAJOR}${suffix}")
|
||||
set(code "set(qt_full_install_prefix \"$\{CMAKE_INSTALL_PREFIX}\")"
|
||||
" if(NOT \"$ENV\{DESTDIR}\" STREQUAL \"\")"
|
||||
)
|
||||
|
||||
if(CMAKE_HOST_WIN32)
|
||||
list(APPEND code
|
||||
" if(qt_full_install_prefix MATCHES \"^[a-zA-Z]:\")"
|
||||
|
@ -160,6 +160,10 @@ HostSpec=${QT_QMAKE_HOST_MKSPEC}
|
||||
|
||||
set(host_qt_bindir "${host_prefix}/${QT${PROJECT_VERSION_MAJOR}_HOST_INFO_BINDIR}")
|
||||
|
||||
if(QT_CREATE_VERSIONED_HARD_LINK)
|
||||
set(tool_version "${PROJECT_VERSION_MAJOR}")
|
||||
endif()
|
||||
|
||||
foreach(host_type ${hosts})
|
||||
foreach(tool_name qmake qtpaths)
|
||||
set(wrapper_extension)
|
||||
@ -177,6 +181,14 @@ HostSpec=${QT_QMAKE_HOST_MKSPEC}
|
||||
configure_file("${wrapper_in_file}" "${wrapper}" @ONLY NEWLINE_STYLE ${newline_style})
|
||||
qt_copy_or_install(PROGRAMS "${CMAKE_CURRENT_BINARY_DIR}/${wrapper}"
|
||||
DESTINATION "${INSTALL_BINDIR}")
|
||||
|
||||
# Configuring a new wrapper file, this type setting the tool_version
|
||||
if(QT_CREATE_VERSIONED_HARD_LINK)
|
||||
set(versioned_wrapper "preliminary/${wrapper_prefix}${tool_name}${tool_version}${wrapper_extension}")
|
||||
configure_file("${wrapper_in_file}" "${versioned_wrapper}" @ONLY NEWLINE_STYLE ${newline_style})
|
||||
qt_copy_or_install(PROGRAMS "${CMAKE_CURRENT_BINARY_DIR}/${versioned_wrapper}"
|
||||
DESTINATION "${INSTALL_BINDIR}")
|
||||
endif()
|
||||
endforeach()
|
||||
endforeach()
|
||||
endfunction()
|
||||
|
@ -194,7 +194,8 @@ function(qt_internal_add_tool target_name)
|
||||
endforeach()
|
||||
|
||||
if(arg_INSTALL_VERSIONED_LINK)
|
||||
qt_internal_install_versioned_link("${install_dir}" "${target_name}")
|
||||
qt_internal_install_versioned_link(WORKING_DIRECTORY "${install_dir}"
|
||||
TARGETS "${target_name}")
|
||||
endif()
|
||||
|
||||
qt_apply_rpaths(TARGET "${target_name}" INSTALL_PATH "${install_dir}" RELATIVE_RPATH)
|
||||
|
Loading…
Reference in New Issue
Block a user