aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/pkgconfig/pkgconfig.qbs
blob: 25bcb3fdf6d63c127811f4d04a7df2ebcd95f1f5 (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
54
55
56
57
58
59
60
61
import qbs.FileInfo
import qbs.Utilities

QbsStaticLibrary {
    Depends { name: "cpp" }
    Depends { name: "qbsbuildconfig" }

    property stringList pcPaths: {
        var result = [];
        result.push(FileInfo.joinPaths(qbs.installPrefix, qbsbuildconfig.libDirName, "pkgconfig"));
        result.push(FileInfo.joinPaths(qbs.installPrefix, "share", "pkgconfig"));
        if (qbs.hostOS.contains("unix")) {
            result.push("/usr/lib/pkgconfig/")
            result.push("/usr/share/pkgconfig/")
        }
        return result
    }
    readonly property stringList pcPathsString: pcPaths.join(qbs.pathListSeparator)

    property bool withQtSupport: true

    readonly property stringList publicDefines: {
        var result = [];
        if (withQtSupport)
            result.push("QBS_PC_WITH_QT_SUPPORT=1")
        else
            result.push("QBS_PC_WITH_QT_SUPPORT=0")
        return result;
    }

    name: "qbspkgconfig"

    files: [
        "pcpackage.cpp",
        "pcpackage.h",
        "pcparser.cpp",
        "pcparser.h",
        "pkgconfig.cpp",
        "pkgconfig.h",
    ]

    cpp.defines: {
        var result = [
            "PKG_CONFIG_PC_PATH=\"" + pcPathsString + "\"",
            "PKG_CONFIG_SYSTEM_LIBRARY_PATH=\"/usr/" + qbsbuildconfig.libDirName + "\"",
        ]
        if ((qbs.targetOS.contains("darwin")
                && Utilities.versionCompare(cpp.minimumMacosVersion, "10.15") < 0)
                || qbs.toolchain.contains("mingw"))
            result.push("HAS_STD_FILESYSTEM=0")
        else
            result.push("HAS_STD_FILESYSTEM=1")
        result = result.concat(publicDefines);
        return result
    }

    Export {
        Depends { name: "cpp" }
        cpp.defines: exportingProduct.publicDefines
    }
}