aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/blackbox/testdata/linkerscripts/linkerscripts.qbs
blob: 6d068b6a23949634376ecf08c1c762d14f6649ca (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
import qbs.TextFile

DynamicLibrary {
    type: base.concat("custom")
    Depends { name: "cpp" }
    files: ["testlib.c"]
    Group {
        name: "linker scripts"
        files: [
            "linkerscript1",
            "linkerscript2",
        ]
        fileTags: ["linkerscript"]
    }

    cpp.libraryPaths: [
        product.sourceDirectory, // location of linkerscripts that are included
    ]

    Rule {
        multiplex: true
        outputFileTags: "custom"
        prepare: {
            var cmd = new JavaScriptCommand();
            cmd.silent = true;
            cmd.sourceCode = function() {
                console.warn("---" + product.cpp.nmPath + "---");
            }
            return [cmd];
        }
    }

    Rule {
        multiplex: true
        requiresInputs: false
        Artifact  {
            filePath: product.buildDirectory + "/linkerscript_with_includes"
            fileTags: ["linkerscript"]
        }
        prepare: {
            var cmd = new JavaScriptCommand();
            cmd.sourcePath = product.sourceDirectory;
            cmd.buildPath = product.buildDirectory;
            cmd.sourceCode = function() {
                var file = new TextFile(buildPath + "/linkerscript_with_includes",
                                        TextFile.WriteOnly);
                file.write("SEARCH_DIR(\"" + sourcePath + "/scripts\")\n" +
                           "INCLUDE linkerscript_to_include\n" +
                           "INCLUDE linkerscript_in_directory\n");
                file.close();
            }
            cmd.highlight = "codegen";
            cmd.description = "generating linkerscript with SEARCH_DIR and INCLUDE";
            return [cmd];
        }
    }

    Probe {
        id: checker
        property bool isGcc: qbs.toolchain.contains("gcc")
        property bool isLinux: qbs.targetOS.contains("linux")
        configure: { console.info("is Linux gcc: " + (isGcc && isLinux)) }
    }

    qbs.installPrefix: ""
    install: true
    installDir: ""
}