Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/linuxdeploy
17 changes: 16 additions & 1 deletion src/qml.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
// system headers
#include <filesystem>

#ifdef __FreeBSD__
#include <sys/sysctl.h>
#endif

// library includes
#include <nlohmann/json.hpp>
#include <linuxdeploy/core/appdir.h>
Expand All @@ -22,7 +26,18 @@ using namespace nlohmann;
namespace fs = std::filesystem;

fs::path findQmlImportScanner() {
return which("qmlimportscanner");
auto path = which("qmlimportscanner");
if (path.empty()) {
// at least on FreeBSD the qmlimportscanner binary is installed under
// QT_INSTALL_LIBEXECS for Qt 6 and QT_INSTALL_BINS for Qt5,
// so is not locatable via $PATH
auto qmakeVars = queryQmake(findQmake());
path = which(qmakeVars["QT_INSTALL_LIBEXECS"] + "/qmlimportscanner");
if (path.empty())
path = which(qmakeVars["QT_INSTALL_BINS"] + "/qmlimportscanner");
}

return path;
}

std::string runQmlImportScanner(const std::vector<std::filesystem::path> &sourcesPaths, const std::vector<fs::path> &qmlImportPaths) {
Expand Down
3 changes: 1 addition & 2 deletions tests/test_deploy_qml.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,9 @@ namespace linuxdeploy {

TEST_F(TestDeployQml, find_qmlimporter_path) {
auto result = findQmlImportScanner();
std::filesystem::path expected = "/usr/bin/qmlimportscanner";

ASSERT_FALSE(result.empty());
ASSERT_EQ(result.string(), expected.string());
ASSERT_EQ(result.filename().string(), "qmlimportscanner");
}

TEST_F(TestDeployQml, runQmlImportScanner) {
Expand Down