blob: 7eafc355cad005c76f2de436e08d9fd9d4df2c63 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
import qbs 1.0
import qbs.Process
import qbs.FileInfo
Probe {
// Inputs
property string executable: 'pkg-config'
property string name
property string minVersion
property string exactVersion
property string maxVersion
// Output
property stringList cflags
property stringList libs
configure: {
if (!name)
throw '"name" must be specified';
var p = new Process();
try {
var args = [ name ];
if (minVersion !== undefined)
args.push(name + ' >= ' + minVersion);
if (exactVersion !== undefined)
args.push(name + ' = ' + exactVersion);
if (maxVersion !== undefined)
args.push(name + ' <= ' + maxVersion);
if (p.exec(executable, args.concat([ '--cflags' ])) === 0) {
cflags = p.readStdOut().trim();
if (cflags === "")
cflags = undefined;
else
cflags = cflags.split(/\s/);
if (p.exec(executable, args.concat([ '--libs' ])) === 0) {
libs = p.readStdOut().trim();
if (libs === "")
libs = undefined;
else
libs = libs.split(/\s/);
found = true;
print("PkgConfigProbe: found library " + name);
return;
}
}
found = false;
cflags = undefined;
libs = undefined;
} finally {
p.close();
}
}
}
|