forked from qt-creator/qt-creator
CMakePM: Skip .obj/.o for static qml plugins in PATH
Amends 5d159e6185
This commit reverts to Qt Creator 12 behavior, plus skipping .obj/.o
parts which are needed for linking but not for finding out library paths
that need to be added to PATH environment.
Tested with https://code.qt.io/cgit/qt/qtdeclarative.git/tree/examples/
qml/tutorials/extending-qml/chapter6-plugins
Without the patch (Qt Creator 12 behavior):
"C:/Projects/chapter6-plugins/build/Desktop_Qt_6_7_1_MinGW_64_bit-Debug/
Charts/CMakeFiles/chartsplugin_resources_1.dir/.qt/rcc",
"C:/Projects/chapter6-plugins/build/Desktop_Qt_6_7_1_MinGW_64_bit-Debug/
Charts/CMakeFiles/chartsplugin_init.dir/chartsplugin_init_autogen",
"C:/Projects/chapter6-plugins/build/Desktop_Qt_6_7_1_MinGW_64_bit-Debug/
Charts/CMakeFiles/chartsplugin_init.dir",
"C:/Projects/chapter6-plugins/build/Desktop_Qt_6_7_1_MinGW_64_bit-Debug/
Charts",
"C:/Qt/6.7.1/mingw_64/lib",
"C:/Qt/6.7.1/mingw_64/bin"
With the patch:
"C:/Projects/chapter6-plugins/build/Desktop_Qt_6_7_1_MinGW_64_bit-Debug/
Charts",
"C:/Qt/6.7.1/mingw_64/lib",
"C:/Qt/6.7.1/mingw_64/bin"
As you can see above, only skipping the .obj/.o files will bring a lot.
The change also doesn't come with the side effects of the Qt Creator
13.0.0/1 releases.
Task-number: QTCREATORBUG-29662
Change-Id: I264a0ef579177b7129471919b77cd22a46e7d511
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
@@ -209,12 +209,9 @@ static bool isChildOf(const FilePath &path, const FilePaths &prefixes)
|
||||
static CMakeBuildTarget toBuildTarget(const TargetDetails &t,
|
||||
const FilePath &sourceDirectory,
|
||||
const FilePath &buildDirectory,
|
||||
bool relativeLibs,
|
||||
const QSet<FilePath> &sharedLibraryArtifacts)
|
||||
bool relativeLibs)
|
||||
{
|
||||
const FilePath currentBuildDir = buildDirectory.resolvePath(t.buildDir);
|
||||
const QSet<FilePath> sharedLibraryArtifactsPaths
|
||||
= transform(sharedLibraryArtifacts, &FilePath::parentDir);
|
||||
|
||||
CMakeBuildTarget ct;
|
||||
ct.title = t.name;
|
||||
@@ -323,20 +320,20 @@ static CMakeBuildTarget toBuildTarget(const TargetDetails &t,
|
||||
// "/usr/local/lib" since these are usually in the standard search
|
||||
// paths. There probably are more, but the naming schemes are arbitrary
|
||||
// so we'd need to ask the linker ("ld --verbose | grep SEARCH_DIR").
|
||||
if (buildDir.osType() != OsTypeWindows
|
||||
&& !isChildOf(tmp,
|
||||
{"/lib", "/lib64", "/usr/lib", "/usr/lib64", "/usr/local/lib"}))
|
||||
if (buildDir.osType() == OsTypeWindows
|
||||
|| !isChildOf(tmp,
|
||||
{"/lib",
|
||||
"/lib64",
|
||||
"/usr/lib",
|
||||
"/usr/lib64",
|
||||
"/usr/local/lib"})) {
|
||||
librarySeachPaths.append(tmp);
|
||||
|
||||
if (buildDir.osType() == OsTypeWindows) {
|
||||
if (sharedLibraryArtifactsPaths.contains(tmp))
|
||||
librarySeachPaths.append(tmp);
|
||||
|
||||
// Libraries often have their import libs in ../lib and the
|
||||
// actual dll files in ../bin on windows. Qt is one example of that.
|
||||
if (tmp.fileName() == "lib") {
|
||||
if (tmp.fileName() == "lib" && buildDir.osType() == OsTypeWindows) {
|
||||
const FilePath path = tmp.parentDir().pathAppended("bin");
|
||||
if (path.isDir() && !isChildOf(path, {buildDir}))
|
||||
if (path.isDir())
|
||||
librarySeachPaths.append(path);
|
||||
}
|
||||
}
|
||||
@@ -355,19 +352,12 @@ static QList<CMakeBuildTarget> generateBuildTargets(const QFuture<void> &cancelF
|
||||
const FilePath &buildDirectory,
|
||||
bool relativeLibs)
|
||||
{
|
||||
QSet<FilePath> sharedLibraryArtifacts;
|
||||
for (const TargetDetails &t : input.targetDetails)
|
||||
if (t.type == "MODULE_LIBRARY" || t.type == "SHARED_LIBRARY")
|
||||
for (const FilePath &p : t.artifacts)
|
||||
sharedLibraryArtifacts.insert(buildDirectory.resolvePath(p));
|
||||
|
||||
QList<CMakeBuildTarget> result;
|
||||
result.reserve(input.targetDetails.size());
|
||||
for (const TargetDetails &t : input.targetDetails) {
|
||||
if (cancelFuture.isCanceled())
|
||||
return {};
|
||||
result.append(
|
||||
toBuildTarget(t, sourceDirectory, buildDirectory, relativeLibs, sharedLibraryArtifacts));
|
||||
result.append(toBuildTarget(t, sourceDirectory, buildDirectory, relativeLibs));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
Reference in New Issue
Block a user