Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added boost qcm #47787

Closed
wants to merge 2 commits into from
Closed
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 .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
64 changes: 64 additions & 0 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -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" <<EOT
o = new qc_qt5(conf);
Expand All @@ -588,6 +649,9 @@ cat >"$1/modules_new.cpp" <<EOT
o = new qc_cargo(conf);
o->required = true;
o->disabled = false;
o = new qc_boost(conf);
o->required = true;
o->disabled = false;

EOT
cat >"$1/conf4.h" <<EOT
Expand Down
3 changes: 3 additions & 0 deletions pushpin.qc
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,7 @@
<dep type='cargo'>
<required/>
</dep>
<dep type='boost'>
<required/>
</dep>
</qconf>
61 changes: 61 additions & 0 deletions qcm/boost.qcm
Original file line number Diff line number Diff line change
@@ -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;
}
};
Loading