aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/blackbox/testdata/exports-pkgconfig/exports-pkgconfig.qbs
blob: 94632053a906e551e39147d8f030be2b0155f975 (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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
import qbs.FileInfo
import qbs.Host

Project {
    Product {
        name: "dummy"
        Export { Depends { name: "TheFirstLib" } }
    }

    Product {
        name: "SomeHelper"
        Depends { name: "Exporter.pkgconfig" }
        Exporter.pkgconfig.versionEntry: "1.0"
    }
    StaticLibrary {
        Depends { name: "cpp" }
        name: "BoringStaticLib"
        files: ["boringstaticlib.cpp"]
        Export {
            Depends { name: "cpp" }
            cpp.defines: ["HAVE_INDUSTRIAL_STRENGTH_HAIR_DRYER"]
        }
    }
    DynamicLibrary {
        name: "TheFirstLib"
        version: "1.0"

        Depends { name: "SomeHelper" }
        Depends { name: "Exporter.pkgconfig" }
        Exporter.pkgconfig.excludedDependencies: ["Qt.core", "helper3"]
        Exporter.pkgconfig.requiresEntry: "Qt5Core"
        Exporter.pkgconfig.urlEntry: "http://www.example.com/thefirstlib"

        Depends { name: "cpp" }
        cpp.defines: ["FIRSTLIB"]

        qbs.installPrefix: "/opt/the firstlib"

        Export {
            prefixMapping: [{prefix: "/somedir", replacement: "/otherdir"}]
            Depends { name: "BoringStaticLib" }
            Depends { name: "cpp" }
            Depends { name: "Qt.core"; required: false }
            Depends { name: "helper1" }
            Depends { name: "helper3" }
            property bool someCondition: Host.os().contains("windows") // hostOS for easier testing
            property bool someOtherCondition: someCondition
            Properties {
                condition: !someOtherCondition
                cpp.driverFlags: ["-pthread"]
            }
            cpp.defines: exportingProduct.name
            cpp.includePaths: [FileInfo.joinPaths(exportingProduct.qbs.installPrefix, "include")]
            Qt.core.mocName: "muck"
        }

        Group {
            fileTagsFilter: ["dynamiclibrary", "dynamiclibrary_import"]
            qbs.install: true
            qbs.installDir: "lib"
        }

        Group {
            name: "api_headers"
            files: ["firstlib.h"]
            qbs.install: true
            qbs.installDir: "include"
        }

        files: ["firstlib.cpp"]
    }
    DynamicLibrary {
        name: "TheSecondLib"
        version: "2.0"

        Depends { name: "Exporter.pkgconfig" }
        Exporter.pkgconfig.descriptionEntry: "The second lib"
        Exporter.pkgconfig.transformFunction: (function(product, moduleName, propertyName, value) {
            if (moduleName === "cpp" && propertyName === "includePaths")
                return value.filter(function(p) { return p !== product.sourceDirectory; });
            return value;
        })
        Exporter.pkgconfig.customVariables: ({config1: "a b", config2: "c"})

        Depends { name: "cpp" }
        cpp.defines: ["SECONDLIB"]

        qbs.installPrefix: ""

        Depends { name: "TheFirstLib" }

        Export {
            Depends { name: "TheFirstLib" }
            Depends { name: "dummy" }
            Depends { name: "cpp" }
            cpp.includePaths: [
                "/opt/thesecondlib/include",
                exportingProduct.sourceDirectory,
                importingProduct.buildDirectory
            ]
            property string hurz: importingProduct.name
            cpp.defines: hurz.toUpperCase()

            Rule {
                property int n: 5
                Artifact {
                    filePath: "dummy"
                    fileTags: ["d1", "d2"]
                    cpp.warningsAreErrors: true
                }
            }
        }

        Group {
            fileTagsFilter: ["dynamiclibrary", "dynamiclibrary_import"]
            qbs.install: true
            qbs.installDir: "/opt/thesecondlib/lib"
        }

        Group {
            name: "api_headers"
            files: ["secondlib.h"]
            qbs.install: true
            qbs.installDir: "/opt/thesecondlib/include"
        }

        files: ["secondlib.cpp"]
    }
}