diff options
author | Christian Kandeler <christian.kandeler@qt.io> | 2018-01-05 13:48:30 +0100 |
---|---|---|
committer | Christian Kandeler <christian.kandeler@qt.io> | 2018-01-08 09:24:22 +0000 |
commit | 34cd916f1dac85e060db4037e66f09a4aeff5b7a (patch) | |
tree | d3dbac703079db8b05d83aeb7a4d10104e249ae9 /share | |
parent | 0f4015bccaf42a9aea79b499cef73ba751d94ee4 (diff) |
setupRunEnvironment: Heuristic for Windows
On Windows, we typically link against an import library rather than the
actual dll. The dll location is not known to us, but the file is often
in a "bin" directory alongside a "lib" directory that contains the
import library. In such a case, add the "bin" directory to the PATH.
Change-Id: I21103a7ca6267d1d80c2911a19144e583c2eba95
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
Diffstat (limited to 'share')
-rw-r--r-- | share/qbs/modules/cpp/setuprunenv.js | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/share/qbs/modules/cpp/setuprunenv.js b/share/qbs/modules/cpp/setuprunenv.js index 168bb4abf..a4be7f988 100644 --- a/share/qbs/modules/cpp/setuprunenv.js +++ b/share/qbs/modules/cpp/setuprunenv.js @@ -29,6 +29,7 @@ ****************************************************************************/ var FileInfo = require("qbs.FileInfo"); +var File = require("qbs.File"); var ModUtils = require("qbs.ModUtils"); // TODO: append/prepend functionality should go to qbs.Environment function addNewElement(list, elem) @@ -44,6 +45,16 @@ function artifactDir(artifact) return FileInfo.path(ModUtils.artifactInstalledFilePath(artifact)); } +function addExternalLibPath(product, list, path) +{ + addNewElement(list, path); + if (product.qbs.hostOS.contains("windows") && FileInfo.fileName(path) === "lib") { + var binPath = FileInfo.joinPaths(FileInfo.path(path), "bin"); + if (File.exists(binPath)) + addNewElement(list, binPath); + } +} + function gatherPaths(product, libPaths, frameworkPaths) { // Heuristic: If any rpaths are set, assume environment paths should not be set up. @@ -54,7 +65,7 @@ function gatherPaths(product, libPaths, frameworkPaths) // Gather explicitly given library paths. if (product.cpp.libraryPaths) - product.cpp.libraryPaths.forEach(function(p) { addNewElement(libPaths, p); }); + product.cpp.libraryPaths.forEach(function(p) { addExternalLibPath(product, libPaths, p); }); if (product.cpp.frameworkPaths) product.cpp.frameworkPaths.forEach(function(p) { addNewElement(frameworkPaths, p); }); @@ -62,7 +73,7 @@ function gatherPaths(product, libPaths, frameworkPaths) if (product.cpp.dynamicLibraries) { product.cpp.dynamicLibraries.forEach(function(dll) { if (FileInfo.isAbsolutePath(dll)) - addNewElement(libPaths, FileInfo.path(dll)); + addExternalLibPath(product, libPaths, FileInfo.path(dll)); }); } |