mirror of
https://github.com/QuasarApp/CQtDeployer.git
synced 2025-04-26 01:34:33 +00:00
fix qtTest
This commit is contained in:
parent
99c03a50c8
commit
c9e271c3f1
2
.gitignore
vendored
2
.gitignore
vendored
@ -87,7 +87,7 @@ CTestTestfile.cmake
|
||||
_deps
|
||||
|
||||
# cmake configured files
|
||||
src/LibDeploy/src/deploy_global.h
|
||||
src/Deploy/src/deploy_global.h
|
||||
src/QtELFReader/src/elfreader_global.h
|
||||
src/CQtDeployer/Deploy/CQtDeployer.json
|
||||
src/CQtDeployer/Deploy/QIFWTemplate/packages/CQtDeployer/meta/package.xml
|
||||
|
@ -60,7 +60,7 @@ option(BUILD_COMMAND_LINE_TOOLS "Build Command Line Tools" OFF)
|
||||
add_subdirectory(submodules/pe-parse)
|
||||
add_subdirectory(submodules/zip)
|
||||
|
||||
add_subdirectory(src/LibDeploy)
|
||||
add_subdirectory(src/Deploy)
|
||||
|
||||
if (DEFINED CQT_DEPLOYER_TOOL)
|
||||
add_subdirectory(src/CQtDeployer)
|
||||
|
@ -42,7 +42,7 @@ else()
|
||||
|
||||
endif()
|
||||
|
||||
target_link_libraries(${CURRENT_PROJECT} PUBLIC LibDeploy)
|
||||
target_link_libraries(${CURRENT_PROJECT} PUBLIC Deploy)
|
||||
|
||||
target_include_directories(${CURRENT_PROJECT} PUBLIC ${PUBLIC_INCUDE_DIR})
|
||||
target_include_directories(${CURRENT_PROJECT} PRIVATE ${PRIVATE_INCUDE_DIR})
|
||||
|
Before Width: | Height: | Size: 35 KiB After Width: | Height: | Size: 35 KiB |
Before Width: | Height: | Size: 108 KiB After Width: | Height: | Size: 108 KiB |
@ -840,12 +840,12 @@ bool ConfigParser::parseClearMode() {
|
||||
return true;
|
||||
}
|
||||
|
||||
QSet<QString> ConfigParser::getQtPathesFromTargets() {
|
||||
QSet<QString> res;
|
||||
QString ConfigParser::getRPathFromTargets() {
|
||||
QString res;
|
||||
|
||||
for (const auto &i: _config.targets()) {
|
||||
if (i.isValid() && !i.getQtPath().isEmpty()) {
|
||||
res.insert(i.getQtPath());
|
||||
if (i.isValid()) {
|
||||
res += i.getRPath() + DeployCore::getEnvSeparator();
|
||||
}
|
||||
}
|
||||
|
||||
@ -1175,9 +1175,9 @@ bool ConfigParser::initQmake() {
|
||||
|
||||
if (!info.isFile() || (info.baseName() != "qmake")) {
|
||||
|
||||
auto qtList = getQtPathesFromTargets();
|
||||
QString qmakeFromRPath = DeployCore::findProcess(getRPathFromTargets(), "qmake");
|
||||
|
||||
if (qtList.isEmpty()) {
|
||||
if (qmakeFromRPath.isEmpty()) {
|
||||
|
||||
if (!QuasarAppUtils::Params::isEndable("noCheckPATH")) {
|
||||
auto env = QProcessEnvironment::systemEnvironment();
|
||||
@ -1190,6 +1190,14 @@ bool ConfigParser::initQmake() {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
QuasarAppUtils::Params::log(QString("The qmake was found in the PATH variable. qmake : %0"
|
||||
" If you want to disable search qmake executable in PATH variable,"
|
||||
" use the noCheckPATH option").
|
||||
arg(proc),
|
||||
QuasarAppUtils::Info);
|
||||
|
||||
|
||||
return initQmakePrivate(proc);
|
||||
}
|
||||
|
||||
@ -1203,21 +1211,15 @@ bool ConfigParser::initQmake() {
|
||||
|
||||
}
|
||||
|
||||
if (qtList.size() > 1) {
|
||||
QuasarAppUtils::Params::log("Your deployment targets were compiled by different qmakes, "
|
||||
"auto-capture of the Qt libraries is not possible. "
|
||||
"Please use the -qmake flag to solve this problem.",
|
||||
QuasarAppUtils::Error);
|
||||
return false;
|
||||
}
|
||||
|
||||
auto qt = *qtList.begin();
|
||||
QuasarAppUtils::Params::log(QString("The qmake was found in the RPATH variable. qmake : %0"
|
||||
" If you want to disable search qmake executable in RPATH variable,"
|
||||
" use the noCheckRPATH option").
|
||||
arg(qmakeFromRPath),
|
||||
QuasarAppUtils::Info);
|
||||
|
||||
if (qt.right(3).compare(QString("lib"), Qt::CaseInsensitive)) {
|
||||
return initQmakePrivate(QFileInfo(qt + "/../bin/qmake").absoluteFilePath());
|
||||
}
|
||||
return initQmakePrivate(qmakeFromRPath);
|
||||
|
||||
return initQmakePrivate(QFileInfo(qt + "/qmake").absoluteFilePath());
|
||||
}
|
||||
|
||||
return initQmakePrivate(qmake);
|
@ -62,7 +62,7 @@ private:
|
||||
|
||||
bool parseClearMode();
|
||||
|
||||
QSet<QString> getQtPathesFromTargets();
|
||||
QString getRPathFromTargets();
|
||||
|
||||
void setTargetDir(const QString &target = "");
|
||||
bool setTargets(const QStringList &value);
|
@ -50,6 +50,37 @@ int ELF::getVersionOfTag(const QByteArray& tag, QByteArray& source) const {
|
||||
return ver;
|
||||
}
|
||||
|
||||
QString ELF::extractRPath(ElfReader& reader) const {
|
||||
|
||||
QString result;
|
||||
if (!QuasarAppUtils::Params::isEndable("noCheckRPATH")) {
|
||||
auto dynStr = getDynamicString(reader);
|
||||
|
||||
for (auto i = dynStr.rbegin(); i != dynStr.rend(); ++i) {
|
||||
|
||||
if (i->contains("end_")) {
|
||||
return result;
|
||||
}
|
||||
|
||||
const auto pathes = i->split(DeployCore::getEnvSeparator());
|
||||
for (const auto &path: pathes) {
|
||||
if (path.contains("/")) {
|
||||
if (result.size()) {
|
||||
result += DeployCore::getEnvSeparator() + DeployCore::transportPathToSnapRoot(path);
|
||||
} else {
|
||||
result += DeployCore::transportPathToSnapRoot(path);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (result.size())
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
bool ELF::getLibInfo(const QString &lib, LibInfo &info) const {
|
||||
ElfReader reader(lib);
|
||||
|
||||
@ -82,25 +113,10 @@ bool ELF::getLibInfo(const QString &lib, LibInfo &info) const {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!QuasarAppUtils::Params::isEndable("noCheckRPATH")) {
|
||||
auto dynStr = getDynamicString(reader);
|
||||
|
||||
for (auto i = dynStr.rbegin(); i != dynStr.rend(); ++i) {
|
||||
|
||||
if (i->contains("end_")) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (QFileInfo(*i).isDir()) {
|
||||
info.setQtPath(DeployCore::transportPathToSnapRoot(*i));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
QFileInfo infolib(lib);
|
||||
info.setName(infolib.fileName());
|
||||
info.setPath(infolib.absolutePath());
|
||||
info.setRPath(extractRPath(reader));
|
||||
|
||||
auto dep = reader.dependencies();
|
||||
for (const auto &i : dep) {
|
@ -14,15 +14,18 @@
|
||||
class ELF : public IGetLibInfo
|
||||
{
|
||||
|
||||
public:
|
||||
ELF();
|
||||
|
||||
bool getLibInfo(const QString &lib, LibInfo &info) const override;
|
||||
|
||||
|
||||
private:
|
||||
QByteArrayList getDynamicString(ElfReader &reader) const;
|
||||
|
||||
int getVersionOfTag(const QByteArray &tag, QByteArray &source) const;
|
||||
|
||||
public:
|
||||
ELF();
|
||||
|
||||
bool getLibInfo(const QString &lib, LibInfo &info) const override;
|
||||
QString extractRPath(ElfReader &reader) const;
|
||||
};
|
||||
|
||||
#endif // ELF_H
|
@ -473,10 +473,23 @@ bool Extracter::extractQml() {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
QStringList toCopyQmlFiles;
|
||||
for (const auto& plugin: qAsConst(plugins)) {
|
||||
const auto qmlFiles = QDir(plugin).entryInfoList(QDir::Files);
|
||||
for (const auto& qmlFile: qmlFiles) {
|
||||
toCopyQmlFiles.push_back(qmlFile.absoluteFilePath());
|
||||
}
|
||||
}
|
||||
|
||||
// This function works very slow because use list mask
|
||||
// solution: use the QSet and restriction comparese of the pathes for the mask argument.
|
||||
// to-do optimise this function
|
||||
if (!_fileManager->copyFolder(cnf->qtDir.getQmls(),
|
||||
targetPath + distro.getQmlOutDir(),
|
||||
DeployCore::debugExtensions() ,
|
||||
&listItems, &plugins)) {
|
||||
&listItems,
|
||||
&toCopyQmlFiles)) {
|
||||
return false;
|
||||
}
|
||||
|
@ -84,14 +84,14 @@ void LibInfo::setPriority(const LibPriority &value) {
|
||||
_priority = value;
|
||||
}
|
||||
|
||||
QString LibInfo::getQtPath() const
|
||||
const QString &LibInfo::getRPath() const
|
||||
{
|
||||
return _qtPath;
|
||||
return _rpath;
|
||||
}
|
||||
|
||||
void LibInfo::setQtPath(const QString &value)
|
||||
void LibInfo::setRPath(const QString &value)
|
||||
{
|
||||
_qtPath = value;
|
||||
_rpath = value;
|
||||
}
|
||||
|
||||
WinAPI LibInfo::getWinApi() const {
|
||||
@ -124,7 +124,7 @@ QString LibInfo::toString() const {
|
||||
return QString("LibInfo: path: '%0', name: '%1', qtPath: '%2', platform: '%3', dependencies: '%4'").
|
||||
arg(_path,
|
||||
_name,
|
||||
_qtPath,
|
||||
_rpath,
|
||||
DeployCore::platformToString(_platform),
|
||||
dependenciesList.join(", "));
|
||||
}
|
||||
@ -136,7 +136,7 @@ QString LibInfo::fullPath() const {
|
||||
void LibInfo::clear() {
|
||||
_path = "";
|
||||
_name = "";
|
||||
_qtPath = "";
|
||||
_rpath = "";
|
||||
_platform = Platform::UnknownPlatform;
|
||||
_dependncies.clear();
|
||||
_allDep.clear();
|
@ -42,8 +42,8 @@ public:
|
||||
|
||||
LibPriority getPriority() const;
|
||||
void setPriority(const LibPriority &value);
|
||||
QString getQtPath() const;
|
||||
void setQtPath(const QString &value);
|
||||
const QString& getRPath() const;
|
||||
void setRPath(const QString &value);
|
||||
WinAPI getWinApi() const;
|
||||
void setWinApi(WinAPI winApi);
|
||||
QtMajorVersion isDependetOfQt() const;
|
||||
@ -60,7 +60,7 @@ private:
|
||||
QString _path;
|
||||
QSet<QString> _dependncies;
|
||||
bool _dependsOfGui;
|
||||
QString _qtPath;
|
||||
QString _rpath;
|
||||
LibPriority _priority = NotFile;
|
||||
WinAPI _winApi = WinAPI::NoWinAPI;
|
||||
|
@ -46,6 +46,11 @@ QStringList QML::extractImportsFromFile(const QString &filepath) const {
|
||||
|
||||
matcher.setPattern("/\\*(.*)\\*/");
|
||||
content.remove(matcher);
|
||||
|
||||
// Replace optional imports to restrict option, because before Qt 6.3 The Qml app needee of optional qml packas.
|
||||
content.replace("optional import", "import");
|
||||
|
||||
|
||||
const auto list = content.split("\n");
|
||||
for (const QString &line : list)
|
||||
for (QString &word : line.split(";", splitbehavior))
|
||||
@ -77,18 +82,19 @@ bool QML::extractImportsFromDir(const QString &path, bool recursive) {
|
||||
for (const auto &import : qAsConst(imports)) {
|
||||
if (!_imports.contains(import)) {
|
||||
_imports.insert(import);
|
||||
extractImportsFromDir(getPathFromImport(import), recursive);
|
||||
extractImportsFromDir(getPathFromImport(import), false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (const auto& module: qAsConst(qmlmodule)) {
|
||||
QStringList imports = extractImportsFromQmlModule(module.absoluteFilePath());
|
||||
imports += extractImportsFromFile(module.absoluteFilePath());
|
||||
|
||||
for (const auto &import : qAsConst(imports)) {
|
||||
if (!_imports.contains(import)) {
|
||||
_imports.insert(import);
|
||||
extractImportsFromDir(getPathFromImport(import), recursive);
|
||||
extractImportsFromDir(getPathFromImport(import), false);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -99,7 +105,7 @@ bool QML::extractImportsFromDir(const QString &path, bool recursive) {
|
||||
auto importQtQml = "QtQml";
|
||||
if (!_imports.contains(importQtQml)) {
|
||||
_imports.insert(importQtQml);
|
||||
extractImportsFromDir(getPathFromImport(importQtQml), recursive);
|
||||
extractImportsFromDir(getPathFromImport(importQtQml), false);
|
||||
}
|
||||
}
|
||||
|
@ -12,6 +12,9 @@ set(CMAKE_AUTOMOC ON)
|
||||
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Core Gui Qml Quick)
|
||||
set(CURRENT_PROJECT "TestQMLWidgets")
|
||||
|
||||
# needed for test RPATH functions
|
||||
get_filename_component(QT_QT_ROOT "${Qt${QT_VERSION_MAJOR}Core_DIR}/../../.." ABSOLUTE)
|
||||
set(CMAKE_BUILD_RPATH ${QT_QT_ROOT}/bin)
|
||||
|
||||
file(GLOB_RECURSE SOURCE_CPP
|
||||
"*.cpp" "*.h"
|
||||
|
@ -1,4 +1,3 @@
|
||||
import QtQuick 2.10
|
||||
import QtQuick.Controls 2.3
|
||||
|
||||
Page {
|
||||
|
@ -1,4 +1,3 @@
|
||||
import QtQuick 2.10
|
||||
import QtQuick.Controls 2.3
|
||||
|
||||
Page {
|
||||
|
@ -1,4 +1,3 @@
|
||||
import QtQuick 2.10
|
||||
import QtQuick.Controls 2.3
|
||||
|
||||
Page {
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user