Skip to content

Commit c4ed78b

Browse files
author
sima
committed
added boost qcm
1 parent c269870 commit c4ed78b

File tree

3 files changed

+128
-0
lines changed

3 files changed

+128
-0
lines changed

configure

+64
Original file line numberDiff line numberDiff line change
@@ -570,7 +570,68 @@ public:
570570
return false;
571571
}
572572
};
573+
#line 1 "boost.qcm"
574+
/*
575+
-----BEGIN QCMOD-----
576+
name: Boost.Signals2
577+
section: libraries
578+
description: Configuration for the Boost.Signals2 library, a part of the Boost C++ Libraries.
579+
-----END QCMOD-----
580+
*/
581+
582+
class qc_boost : public ConfObj
583+
{
584+
public:
585+
qc_boost(Conf *c) : ConfObj(c) {}
586+
QString name() const { return "Boost.Signals2 >= 1.71"; }
587+
QString shortname() const { return "boost"; }
588+
bool checkBoostVersion() {
589+
QProcess process;
590+
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'");
591+
process.waitForFinished();
592+
QString output(process.readAllStandardOutput());
593+
output = output.trimmed();
594+
595+
QStringList versionParts = output.split(".");
596+
if (versionParts.size() < 2) {
597+
return false; // Version format error
598+
}
599+
600+
int majorVersion = versionParts[0].toInt();
601+
int minorVersion = versionParts[1].toInt();
602+
603+
return (majorVersion > 1 || (majorVersion == 1 && minorVersion >= 71));
604+
}
605+
QString findBoostIncludePath()
606+
{
607+
QStringList possiblePaths = { "/usr/local/include", "/usr/include" };
608+
QString boostHeader = "boost/signals2.hpp"; // Boost signals header file
609+
610+
foreach (const QString &path, possiblePaths) {
611+
QDir dir(path);
612+
if (dir.exists(boostHeader)) {
613+
return path; // Return the path where Boost headers are found
614+
}
615+
}
573616
617+
return QString(); // Return empty if Boost headers are not found
618+
}
619+
bool exec()
620+
{
621+
if (!checkBoostVersion()) {
622+
printf("checkBoostVersion err \\n");
623+
return false;
624+
}
625+
QString boostIncludePath = findBoostIncludePath();
626+
if (boostIncludePath.isEmpty()) {
627+
printf("boostIncludePath err \\n");
628+
return false;
629+
}
630+
631+
conf->addIncludePath(boostIncludePath);
632+
return true;
633+
}
634+
};
574635
EOT
575636
cat >"$1/modules_new.cpp" <<EOT
576637
o = new qc_qt5(conf);
@@ -588,6 +649,9 @@ cat >"$1/modules_new.cpp" <<EOT
588649
o = new qc_cargo(conf);
589650
o->required = true;
590651
o->disabled = false;
652+
o = new qc_boost(conf);
653+
o->required = true;
654+
o->disabled = false;
591655
592656
EOT
593657
cat >"$1/conf4.h" <<EOT

pushpin.qc

+3
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,7 @@
1717
<dep type='cargo'>
1818
<required/>
1919
</dep>
20+
<dep type='boost'>
21+
<required/>
22+
</dep>
2023
</qconf>

qcm/boost.qcm

+61
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
/*
2+
-----BEGIN QCMOD-----
3+
name: Boost.Signals2
4+
section: libraries
5+
description: Configuration for the Boost.Signals2 library, a part of the Boost C++ Libraries.
6+
-----END QCMOD-----
7+
*/
8+
9+
class qc_boost : public ConfObj
10+
{
11+
public:
12+
qc_boost(Conf *c) : ConfObj(c) {}
13+
QString name() const { return "Boost.Signals2 >= 1.71"; }
14+
QString shortname() const { return "boost"; }
15+
bool checkBoostVersion() {
16+
QProcess process;
17+
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'");
18+
process.waitForFinished();
19+
QString output(process.readAllStandardOutput());
20+
output = output.trimmed();
21+
22+
QStringList versionParts = output.split(".");
23+
if (versionParts.size() < 2) {
24+
return false; // Version format error
25+
}
26+
27+
int majorVersion = versionParts[0].toInt();
28+
int minorVersion = versionParts[1].toInt();
29+
30+
return (majorVersion > 1 || (majorVersion == 1 && minorVersion >= 71));
31+
}
32+
QString findBoostIncludePath()
33+
{
34+
QStringList possiblePaths = { "/usr/local/include", "/usr/include" };
35+
QString boostHeader = "boost/signals2.hpp"; // Boost signals header file
36+
37+
foreach (const QString &path, possiblePaths) {
38+
QDir dir(path);
39+
if (dir.exists(boostHeader)) {
40+
return path; // Return the path where Boost headers are found
41+
}
42+
}
43+
44+
return QString(); // Return empty if Boost headers are not found
45+
}
46+
bool exec()
47+
{
48+
if (!checkBoostVersion()) {
49+
printf("checkBoostVersion err \n");
50+
return false;
51+
}
52+
QString boostIncludePath = findBoostIncludePath();
53+
if (boostIncludePath.isEmpty()) {
54+
printf("boostIncludePath err \n");
55+
return false;
56+
}
57+
58+
conf->addIncludePath(boostIncludePath);
59+
return true;
60+
}
61+
};

0 commit comments

Comments
 (0)