aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/blackbox/testdata/setup-run-environment/setup-run-environment.qbs
blob: 02f5ec7b1fdaec4eac09b33aed7bce858950cf7f (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
import qbs.FileInfo
import qbs.Host

Project {
    DynamicLibrary { // Product dependency, installed
        name: "lib1"
        Depends { name: "cpp" }

        files: ["lib1.cpp"]

        install: !qbs.targetOS.contains("darwin")
        installImportLib: true
        installDir: "lib1"
        importLibInstallDir: installDir

        Group {
        condition: qbs.targetOS.contains("darwin")
            fileTagsFilter: ["bundle.content"]
            qbs.install: true
            qbs.installSourceBase: destinationDirectory
        }
    }

    DynamicLibrary { // Product dependency, non-installed
        name: "lib2"
        Depends { name: "cpp" }
        Depends { name: "lib5" }

    Properties {
            condition: qbs.targetOS.contains("darwin")
            bundle.isBundle: false
        }

        files: ["lib2.cpp"]
    }

    DynamicLibrary { // Non-dependency, referred to by full path
        name: "lib3"
        Depends { name: "cpp" }

        files: ["lib3.cpp"]

        Properties {
            condition: qbs.targetOS.contains("darwin")
            bundle.isBundle: false
        }

        install: true
        installImportLib: true
        installDir: "lib3"
        importLibInstallDir: installDir
    }

    DynamicLibrary { // Non-dependency, referred to by name
        name: "lib4"
        Depends { name: "cpp" }

        files: ["lib4.cpp"]

        Properties {
            condition: qbs.targetOS.contains("darwin")
            bundle.isBundle: false
        }

        // Testing shows that clang (8.0) does not find dynamic libraries via
        // the -L<dir> and -l<libname> mechanism unless the name is "lib<libname>.a".
        Properties {
            condition: Host.os().contains("windows") && qbs.toolchain.contains("clang")
            cpp.dynamicLibraryPrefix: "lib"
            cpp.dynamicLibraryImportSuffix: ".a"
        }
        cpp.dynamicLibraryPrefix: original
        cpp.dynamicLibraryImportSuffix: original

        install: true
        installImportLib: true
        installDir: "lib4"
        importLibInstallDir: installDir
    }

    DynamicLibrary { // Recursive product dependency
        name: "lib5"
        Depends { name: "cpp" }

        Properties {
            condition: qbs.targetOS.contains("darwin")
            bundle.isBundle: false
        }

        files: ["lib5.cpp"]
    }

    CppApplication {
        condition: {
            var result = qbs.targetPlatform === Host.platform();
            if (!result)
                console.info("targetPlatform differs from hostPlatform");
            return result;
        }
        name: "app"
        consoleApplication: true
        files: "main.cpp"

        Depends { name: "lib1" }
        Depends { name: "lib2" }
        Depends { name: "lib3"; cpp.link: false }
        Depends { name: "lib4"; cpp.link: false }

        property string fullInstallPrefix: FileInfo.joinPaths(qbs.installRoot, qbs.installPrefix)
        property string lib3FilePath: FileInfo.joinPaths(fullInstallPrefix, "lib3",
                cpp.dynamicLibraryPrefix + "lib3" + (qbs.targetOS.contains("windows")
                                                     ? cpp.dynamicLibraryImportSuffix
                                                     : cpp.dynamicLibrarySuffix))
        cpp.dynamicLibraries: [lib3FilePath, "lib4"]
        cpp.libraryPaths: FileInfo.joinPaths(fullInstallPrefix, "lib4")
    }

    Probe {
        id: osPrinter
        property bool isWindows: qbs.targetOS.contains("windows")
        configure: {
            console.info("is windows");
            found = true;
        }
    }
}