Move build tools to libexec instead of the bin dir

[ChangeLog][Build System] Tools that are called by the build system and
are unlikely to be called by the user are now installed to the libexec
directory.

This is a step towards easier co-installability of different Qt
versions.

Pick-to: 6.1
Task-number: QTBUG-88791
Change-Id: Id19575b5ba27795f7715e4ea6a09391b26dd4942
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
This commit is contained in:
Joerg Bornemann 2021-01-25 11:12:37 +01:00
parent 700d1037aa
commit 1f30bcf336
21 changed files with 40 additions and 15 deletions

View File

@ -504,7 +504,7 @@ function(qt_internal_create_tracepoints name tracepoints_file)
if(NOT "${QT_HOST_PATH}" STREQUAL "") if(NOT "${QT_HOST_PATH}" STREQUAL "")
qt_path_join(tracegen qt_path_join(tracegen
"${QT_HOST_PATH}" "${QT_HOST_PATH}"
"${QT${PROJECT_VERSION_MAJOR}_HOST_INFO_BINDIR}" "${QT${PROJECT_VERSION_MAJOR}_HOST_INFO_LIBEXECDIR}"
"tracegen") "tracegen")
else() else()
set(tracegen "${QT_CMAKE_EXPORT_NAMESPACE}::tracegen") set(tracegen "${QT_CMAKE_EXPORT_NAMESPACE}::tracegen")

View File

@ -1,6 +1,6 @@
#global defaults #global defaults
qtPrepareTool(QMAKE_MOC, moc) qtPrepareLibExecTool(QMAKE_MOC, moc)
isEmpty(MOC_DIR):MOC_DIR = . isEmpty(MOC_DIR):MOC_DIR = .
isEmpty(QMAKE_H_MOD_MOC):QMAKE_H_MOD_MOC = moc_ isEmpty(QMAKE_H_MOD_MOC):QMAKE_H_MOD_MOC = moc_
isEmpty(QMAKE_EXT_CPP_MOC):QMAKE_EXT_CPP_MOC = .moc isEmpty(QMAKE_EXT_CPP_MOC):QMAKE_EXT_CPP_MOC = .moc

View File

@ -1,4 +1,4 @@
qtPrepareTool(QMAKE_QLALR, qlalr) qtPrepareLibExecTool(QMAKE_QLALR, qlalr)
isEmpty(QLALR_DIR): QLALR_DIR = . isEmpty(QLALR_DIR): QLALR_DIR = .

View File

@ -83,11 +83,19 @@ defineTest(qtHaveModule) {
return(false) return(false)
} }
# variable, default, [suffix for variable for system() use], [prepare primary variable for system() use] # Arguments:
# variable, default, [suffix for variable for system() use],
# [prepare primary variable for system() use],
# [installation location; default: $$[QT_HOST_BINS]]
defineTest(qtPrepareTool) { defineTest(qtPrepareTool) {
cmd = $$eval(QT_TOOL.$${2}.binary) cmd = $$eval(QT_TOOL.$${2}.binary)
isEmpty(cmd) { isEmpty(cmd) {
cmd = $$[QT_HOST_BINS]/$$2 isEmpty(5) {
instloc = $$[QT_HOST_BINS]
} else {
instloc = $$5
}
cmd = $$instloc/$$2
exists($${cmd}.pl) { exists($${cmd}.pl) {
$${1}_EXE = $${cmd}.pl $${1}_EXE = $${cmd}.pl
cmd = perl -w $$system_path($${cmd}.pl) cmd = perl -w $$system_path($${cmd}.pl)
@ -123,6 +131,15 @@ defineTest(qtPrepareTool) {
} }
} }
# Prepare a tool that's not supposed to be called manually by users but by the build system.
#
# Forwards its arguments to qtPrepareTool but defaults the installation location to
# $$[QT_HOST_LIBEXECS]
defineTest(qtPrepareLibExecTool) {
isEmpty(instloc): instloc = "$$[QT_HOST_LIBEXECS]"
qtPrepareTool($$1, $$2, $$3, $$4, $$instloc)
}
# target variable, list of env var names, [non-empty: prepare for system(), not make] # target variable, list of env var names, [non-empty: prepare for system(), not make]
defineTest(qtAddToolEnv) { defineTest(qtAddToolEnv) {
isEmpty(3): \ isEmpty(3): \

View File

@ -8,7 +8,7 @@
# We mean it. # We mean it.
# #
qtPrepareTool(QMAKE_TRACEGEN, tracegen) qtPrepareLibExecTool(QMAKE_TRACEGEN, tracegen)
isEmpty(TRACEGEN_DIR): TRACEGEN_DIR = . isEmpty(TRACEGEN_DIR): TRACEGEN_DIR = .

View File

@ -1,4 +1,4 @@
qtPrepareTool(QMAKE_RCC, rcc, _DEP) qtPrepareLibExecTool(QMAKE_RCC, rcc, _DEP)
isEmpty(QMAKE_MOD_RCC):QMAKE_MOD_RCC = qrc isEmpty(QMAKE_MOD_RCC):QMAKE_MOD_RCC = qrc

View File

@ -1,4 +1,4 @@
qtPrepareTool(QMAKE_UIC, uic, _DEP) qtPrepareLibExecTool(QMAKE_UIC, uic, _DEP)
isEmpty(UI_DIR):UI_DIR = . isEmpty(UI_DIR):UI_DIR = .
isEmpty(QMAKE_MOD_UIC):QMAKE_MOD_UIC = ui_ isEmpty(QMAKE_MOD_UIC):QMAKE_MOD_UIC = ui_

View File

@ -191,7 +191,7 @@ function(qt6_android_generate_deployment_settings target)
" \"qml-importscanner-binary\" : \"${qml_importscanner_binary_path_native}\",\n") " \"qml-importscanner-binary\" : \"${qml_importscanner_binary_path_native}\",\n")
# Override rcc binary path # Override rcc binary path
set(rcc_binary_path "${QT_HOST_PATH}/${QT6_HOST_INFO_BINDIR}/rcc") set(rcc_binary_path "${QT_HOST_PATH}/${QT6_HOST_INFO_LIBEXECDIR}/rcc")
if (WIN32) if (WIN32)
string(APPEND rcc_binary_path ".exe") string(APPEND rcc_binary_path ".exe")
endif() endif()

View File

@ -889,7 +889,7 @@ if (QT_FEATURE_vulkan)
if(NOT "${QT_HOST_PATH}" STREQUAL "") if(NOT "${QT_HOST_PATH}" STREQUAL "")
qt_path_join(qvkgen qt_path_join(qvkgen
"${QT_HOST_PATH}" "${QT_HOST_PATH}"
"${QT${PROJECT_VERSION_MAJOR}_HOST_INFO_BINDIR}" "${QT${PROJECT_VERSION_MAJOR}_HOST_INFO_LIBEXECDIR}"
"qvkgen") "qvkgen")
else() else()
set(qvkgen "${QT_CMAKE_EXPORT_NAMESPACE}::qvkgen") set(qvkgen "${QT_CMAKE_EXPORT_NAMESPACE}::qvkgen")

View File

@ -5,6 +5,7 @@
qt_get_tool_target_name(target_name cmake_automoc_parser) qt_get_tool_target_name(target_name cmake_automoc_parser)
qt_internal_add_tool(${target_name} qt_internal_add_tool(${target_name}
BOOTSTRAP BOOTSTRAP
INSTALL_DIR "${INSTALL_LIBEXECDIR}"
TOOLS_TARGET Core # special case TOOLS_TARGET Core # special case
SOURCES SOURCES
main.cpp main.cpp

View File

@ -8,6 +8,7 @@ qt_get_tool_target_name(target_name moc)
qt_internal_add_tool(${target_name} qt_internal_add_tool(${target_name}
BOOTSTRAP BOOTSTRAP
TARGET_DESCRIPTION "Qt Meta Object Compiler" TARGET_DESCRIPTION "Qt Meta Object Compiler"
INSTALL_DIR "${INSTALL_LIBEXECDIR}"
TOOLS_TARGET Core # special case TOOLS_TARGET Core # special case
SOURCES SOURCES
cbordevice.h cbordevice.h

View File

@ -7,6 +7,7 @@
qt_get_tool_target_name(target_name qlalr) qt_get_tool_target_name(target_name qlalr)
qt_internal_add_tool(${target_name} qt_internal_add_tool(${target_name}
TARGET_DESCRIPTION "Qt Look Ahead LR Parser Generator" TARGET_DESCRIPTION "Qt Look Ahead LR Parser Generator"
INSTALL_DIR "${INSTALL_LIBEXECDIR}"
TOOLS_TARGET Core # special case TOOLS_TARGET Core # special case
SOURCES SOURCES
compress.cpp compress.h compress.cpp compress.h

View File

@ -7,6 +7,7 @@
qt_get_tool_target_name(target_name qvkgen) qt_get_tool_target_name(target_name qvkgen)
qt_internal_add_tool(${target_name} qt_internal_add_tool(${target_name}
TARGET_DESCRIPTION "Qt Vulkan Header Generator" TARGET_DESCRIPTION "Qt Vulkan Header Generator"
INSTALL_DIR "${INSTALL_LIBEXECDIR}"
TOOLS_TARGET Gui # special case TOOLS_TARGET Gui # special case
SOURCES SOURCES
qvkgen.cpp qvkgen.cpp

View File

@ -8,6 +8,7 @@ qt_get_tool_target_name(target_name rcc)
qt_internal_add_tool(${target_name} qt_internal_add_tool(${target_name}
BOOTSTRAP BOOTSTRAP
TARGET_DESCRIPTION "Qt Resource Compiler" TARGET_DESCRIPTION "Qt Resource Compiler"
INSTALL_DIR "${INSTALL_LIBEXECDIR}"
TOOLS_TARGET Core # special case TOOLS_TARGET Core # special case
SOURCES SOURCES
main.cpp main.cpp

View File

@ -7,6 +7,7 @@
qt_get_tool_target_name(target_name tracegen) qt_get_tool_target_name(target_name tracegen)
qt_internal_add_tool(${target_name} qt_internal_add_tool(${target_name}
BOOTSTRAP BOOTSTRAP
INSTALL_DIR "${INSTALL_LIBEXECDIR}"
TOOLS_TARGET Core # special case TOOLS_TARGET Core # special case
SOURCES SOURCES
etw.cpp etw.h etw.cpp etw.h

View File

@ -7,6 +7,7 @@
qt_get_tool_target_name(target_name uic) qt_get_tool_target_name(target_name uic)
qt_internal_add_tool(${target_name} qt_internal_add_tool(${target_name}
TARGET_DESCRIPTION "Qt User Interface Compiler" TARGET_DESCRIPTION "Qt User Interface Compiler"
INSTALL_DIR "${INSTALL_LIBEXECDIR}"
TOOLS_TARGET Widgets # special case TOOLS_TARGET Widgets # special case
SOURCES SOURCES
cpp/cppwritedeclaration.cpp cpp/cppwritedeclaration.h cpp/cppwritedeclaration.cpp cpp/cppwritedeclaration.h

View File

@ -775,7 +775,8 @@ void tst_Moc::initTestCase()
{ {
QString binpath = QLibraryInfo::path(QLibraryInfo::BinariesPath); QString binpath = QLibraryInfo::path(QLibraryInfo::BinariesPath);
QString qmake = QString("%1/qmake").arg(binpath); QString qmake = QString("%1/qmake").arg(binpath);
m_moc = QString("%1/moc").arg(binpath); QString libexecPath = QLibraryInfo::path(QLibraryInfo::LibraryExecutablesPath);
m_moc = QString("%1/moc").arg(libexecPath);
const QString testHeader = QFINDTESTDATA("backslash-newlines.h"); const QString testHeader = QFINDTESTDATA("backslash-newlines.h");
QVERIFY(!testHeader.isEmpty()); QVERIFY(!testHeader.isEmpty());

View File

@ -9,7 +9,7 @@ INCLUDEPATH += "include folder"
RCCINPUT = "rc folder/test.qrc" RCCINPUT = "rc folder/test.qrc"
RCCOUTPUT = "cpp folder/test.cpp" RCCOUTPUT = "cpp folder/test.cpp"
qtPrepareTool(QMAKE_RCC, rcc) qtPrepareLibExecTool(QMAKE_RCC, rcc)
rcc_test.commands = $$QMAKE_RCC -o ${QMAKE_FILE_OUT} ${QMAKE_FILE_IN} rcc_test.commands = $$QMAKE_RCC -o ${QMAKE_FILE_OUT} ${QMAKE_FILE_IN}
rcc_test.output = $$RCCOUTPUT rcc_test.output = $$RCCOUTPUT

View File

@ -667,7 +667,7 @@ void tst_qmake::qinstall()
// install an executable file // install an executable file
{ {
const QString mocFilePath = QLibraryInfo::path(QLibraryInfo::BinariesPath) const QString mocFilePath = QLibraryInfo::path(QLibraryInfo::LibraryExecutablesPath)
+ "/moc" + "/moc"
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
+ ".exe" + ".exe"

View File

@ -104,7 +104,7 @@ private:
void tst_rcc::initTestCase() void tst_rcc::initTestCase()
{ {
m_rcc = QLibraryInfo::path(QLibraryInfo::BinariesPath) + QLatin1String("/rcc"); m_rcc = QLibraryInfo::path(QLibraryInfo::LibraryExecutablesPath) + QLatin1String("/rcc");
m_dataPath = QFINDTESTDATA("data"); m_dataPath = QFINDTESTDATA("data");
QVERIFY(!m_dataPath.isEmpty()); QVERIFY(!m_dataPath.isEmpty());

View File

@ -105,7 +105,7 @@ static const char versionRegexp[] =
R"([*#][*#] Created by: Qt User Interface Compiler version \d{1,2}\.\d{1,2}\.\d{1,2})"; R"([*#][*#] Created by: Qt User Interface Compiler version \d{1,2}\.\d{1,2}\.\d{1,2})";
tst_uic::tst_uic() tst_uic::tst_uic()
: m_command(QLibraryInfo::path(QLibraryInfo::BinariesPath) + QLatin1String("/uic")) : m_command(QLibraryInfo::path(QLibraryInfo::LibraryExecutablesPath) + QLatin1String("/uic"))
, m_versionRegexp(QLatin1String(versionRegexp)) , m_versionRegexp(QLatin1String(versionRegexp))
{ {
} }