Skip to content

Commit af6a1df

Browse files
arrowdTheAssassin
authored andcommitted
Fix findQmlImportScanner() on FreeBSD
We don't install the qmlimportscanner executable into public location, so add a bit of extra logic to locate it.
1 parent e156c8a commit af6a1df

1 file changed

Lines changed: 16 additions & 1 deletion

File tree

src/qml.cpp

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
// system headers
22
#include <filesystem>
33

4+
#ifdef __FreeBSD__
5+
#include <sys/sysctl.h>
6+
#endif
7+
48
// library includes
59
#include <nlohmann/json.hpp>
610
#include <linuxdeploy/core/appdir.h>
@@ -22,7 +26,18 @@ using namespace nlohmann;
2226
namespace fs = std::filesystem;
2327

2428
fs::path findQmlImportScanner() {
25-
return which("qmlimportscanner");
29+
auto path = which("qmlimportscanner");
30+
if (path.empty()) {
31+
// at least on FreeBSD the qmlimportscanner binary is installed under
32+
// QT_INSTALL_LIBEXECS for Qt 6 and QT_INSTALL_BINS for Qt5,
33+
// so is not locatable via $PATH
34+
auto qmakeVars = queryQmake(findQmake());
35+
path = which(qmakeVars["QT_INSTALL_LIBEXECS"] + "/qmlimportscanner");
36+
if (path.empty())
37+
path = which(qmakeVars["QT_INSTALL_BINS"] + "/qmlimportscanner");
38+
}
39+
40+
return path;
2641
}
2742

2843
std::string runQmlImportScanner(const std::vector<std::filesystem::path> &sourcesPaths, const std::vector<fs::path> &qmlImportPaths) {

0 commit comments

Comments
 (0)