From c4ed78b1b0a193d0c6f49ad81d7e900fb3fb0a26 Mon Sep 17 00:00:00 2001 From: sima Date: Thu, 16 Nov 2023 14:29:35 -0800 Subject: [PATCH 1/2] added boost qcm --- configure | 64 +++++++++++++++++++++++++++++++++++++++++++++++++++ pushpin.qc | 3 +++ qcm/boost.qcm | 61 ++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 128 insertions(+) create mode 100644 qcm/boost.qcm diff --git a/configure b/configure index 4bfabb63..f84f18de 100755 --- a/configure +++ b/configure @@ -570,7 +570,68 @@ public: return false; } }; +#line 1 "boost.qcm" +/* +-----BEGIN QCMOD----- +name: Boost.Signals2 +section: libraries +description: Configuration for the Boost.Signals2 library, a part of the Boost C++ Libraries. +-----END QCMOD----- +*/ + +class qc_boost : public ConfObj +{ +public: + qc_boost(Conf *c) : ConfObj(c) {} + QString name() const { return "Boost.Signals2 >= 1.71"; } + QString shortname() const { return "boost"; } + bool checkBoostVersion() { + QProcess process; + process.start("bash", QStringList() << "-c" << "grep \\"BOOST_LIB_VERSION\\" \$(find /usr/local/Cellar/boost /usr/include /usr/local/include -name 'version.hpp' 2> /dev/null | grep 'boost/version.hpp') | grep -v \\"//\\" | cut -d '\\"' -f2 | sed 's/_/./g'"); + process.waitForFinished(); + QString output(process.readAllStandardOutput()); + output = output.trimmed(); + + QStringList versionParts = output.split("."); + if (versionParts.size() < 2) { + return false; // Version format error + } + + int majorVersion = versionParts[0].toInt(); + int minorVersion = versionParts[1].toInt(); + + return (majorVersion > 1 || (majorVersion == 1 && minorVersion >= 71)); + } + QString findBoostIncludePath() + { + QStringList possiblePaths = { "/usr/local/include", "/usr/include" }; + QString boostHeader = "boost/signals2.hpp"; // Boost signals header file + + foreach (const QString &path, possiblePaths) { + QDir dir(path); + if (dir.exists(boostHeader)) { + return path; // Return the path where Boost headers are found + } + } + return QString(); // Return empty if Boost headers are not found + } + bool exec() + { + if (!checkBoostVersion()) { + printf("checkBoostVersion err \\n"); + return false; + } + QString boostIncludePath = findBoostIncludePath(); + if (boostIncludePath.isEmpty()) { + printf("boostIncludePath err \\n"); + return false; + } + + conf->addIncludePath(boostIncludePath); + return true; + } +}; EOT cat >"$1/modules_new.cpp" <"$1/modules_new.cpp" <required = true; o->disabled = false; + o = new qc_boost(conf); + o->required = true; + o->disabled = false; EOT cat >"$1/conf4.h" < + + + diff --git a/qcm/boost.qcm b/qcm/boost.qcm new file mode 100644 index 00000000..d622cdaf --- /dev/null +++ b/qcm/boost.qcm @@ -0,0 +1,61 @@ +/* +-----BEGIN QCMOD----- +name: Boost.Signals2 +section: libraries +description: Configuration for the Boost.Signals2 library, a part of the Boost C++ Libraries. +-----END QCMOD----- +*/ + +class qc_boost : public ConfObj +{ +public: + qc_boost(Conf *c) : ConfObj(c) {} + QString name() const { return "Boost.Signals2 >= 1.71"; } + QString shortname() const { return "boost"; } + bool checkBoostVersion() { + QProcess process; + process.start("bash", QStringList() << "-c" << "grep \"BOOST_LIB_VERSION\" $(find /usr/local/Cellar/boost /usr/include /usr/local/include -name 'version.hpp' 2> /dev/null | grep 'boost/version.hpp') | grep -v \"//\" | cut -d '\"' -f2 | sed 's/_/./g'"); + process.waitForFinished(); + QString output(process.readAllStandardOutput()); + output = output.trimmed(); + + QStringList versionParts = output.split("."); + if (versionParts.size() < 2) { + return false; // Version format error + } + + int majorVersion = versionParts[0].toInt(); + int minorVersion = versionParts[1].toInt(); + + return (majorVersion > 1 || (majorVersion == 1 && minorVersion >= 71)); + } + QString findBoostIncludePath() + { + QStringList possiblePaths = { "/usr/local/include", "/usr/include" }; + QString boostHeader = "boost/signals2.hpp"; // Boost signals header file + + foreach (const QString &path, possiblePaths) { + QDir dir(path); + if (dir.exists(boostHeader)) { + return path; // Return the path where Boost headers are found + } + } + + return QString(); // Return empty if Boost headers are not found + } + bool exec() + { + if (!checkBoostVersion()) { + printf("checkBoostVersion err \n"); + return false; + } + QString boostIncludePath = findBoostIncludePath(); + if (boostIncludePath.isEmpty()) { + printf("boostIncludePath err \n"); + return false; + } + + conf->addIncludePath(boostIncludePath); + return true; + } +}; \ No newline at end of file From 1c3b17ed8d2fd4ba7708384538f890253c217edb Mon Sep 17 00:00:00 2001 From: sima Date: Thu, 16 Nov 2023 14:35:41 -0800 Subject: [PATCH 2/2] updated github actions to include boost --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 8458bd7e..cc7ece78 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -41,7 +41,7 @@ jobs: run: cargo install cargo-audit shell: bash - name: Install deps - run: sudo apt-get update && sudo apt-get install -y make g++ libssl-dev libzmq3-dev qtbase5-dev + run: sudo apt-get update && sudo apt-get install -y make g++ libssl-dev libzmq3-dev qtbase5-dev libboost-dev - name: fmt run: cargo fmt --check shell: bash