aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/blackbox/testdata-qt/qtscxml/qtscxml.qbs
blob: 208305c1fbc967dbf31ffcb9173c5f8ac8b51b01 (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
import qbs.Environment
import qbs.FileInfo
import qbs.Utilities

Project {
    QtApplication {
        name: "app"
        Depends { name: "Qt.scxml"; required: false }

        Properties {
            condition: Qt.scxml.present && Utilities.versionCompare(Qt.core.version, "5.13.0") != 0
            cpp.defines: ["HAS_QTSCXML"]
        }

        Qt.scxml.className: "QbsStateMachine"
        Qt.scxml.namespace: "QbsTest"
        Qt.scxml.generateStateMethods: true

        files: ["main.cpp"]
        Group {
            files: ["dummystatemachine.scxml"]
            fileTags: ["qt.scxml.compilable"]
        }
    }

    Product {
        name: "runner"
        type: ["runner"]
        Depends { name: "app" }
        Rule {
            inputsFromDependencies: ["application"]
            outputFileTags: ["runner"]
            prepare: {
                var cmd = new Command(input.filePath);
                cmd.description = "running " + input.filePath;

                var envVars = {};
                if (product.qbs.hostOS.contains("windows")) {
                    envVars["PATH"] = FileInfo.toWindowsSeparators(input["Qt.core"].binPath);
                } else if (product.qbs.hostOS.contains("macos")) {
                    envVars["DYLD_LIBRARY_PATH"] = input["Qt.core"].libPath;
                    envVars["DYLD_FRAMEWORK_PATH"] = input["Qt.core"].libPath;
                } else {
                    envVars["LD_LIBRARY_PATH"] = input["Qt.core"].libPath;
                }
                for (var varName in envVars) {
                    var oldValue = Environment.getEnv(varName) || "";
                    var newValue = envVars[varName] + product.qbs.pathListSeparator + oldValue;
                    cmd.environment.push(varName + '=' + newValue);
                }

                return [cmd];
            }
        }
    }
}