Skip to content

Commit

Permalink
added bare bone boost.qcm
Browse files Browse the repository at this point in the history
  • Loading branch information
sima committed Nov 17, 2023
1 parent 6e2e8b6 commit 52684c9
Show file tree
Hide file tree
Showing 3 changed files with 96 additions and 0 deletions.
48 changes: 48 additions & 0 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -570,7 +570,52 @@ 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();
printf("boost version %s \\n", qPrintable(output));
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()
{
return QString(); // Return empty if Boost headers are not found
}
bool exec()
{
if (!checkBoostVersion()) {
printf("checkBoostVersion err \\n");
return false;
}
return true;
}
};
EOT
cat >"$1/modules_new.cpp" <<EOT
o = new qc_qt5(conf);
Expand All @@ -588,6 +633,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>
45 changes: 45 additions & 0 deletions qcm/boost.qcm
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/*
-----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();
printf("boost version %s \n", qPrintable(output));

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()
{
return QString(); // Return empty if Boost headers are not found
}
bool exec()
{
if (!checkBoostVersion()) {
printf("checkBoostVersion err \n");
return false;
}
return true;
}
};

0 comments on commit 52684c9

Please sign in to comment.