aboutsummaryrefslogtreecommitdiffstats
path: root/share/qbs/modules/cpp/mac-gcc.qbs
blob: 509d2bd6b2e9f2bcd615e9ae29c9a94f8d477554 (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
import qbs 1.0
import '../utils.js' as ModUtils
import 'darwin-tools.js' as Tools
import "gcc.js" as Gcc

DarwinGCC {
    condition: qbs.hostOS === 'mac' && qbs.targetOS === 'mac' && qbs.toolchain === 'gcc'

    defaultInfoPlist: {
        var baseName = String(product.targetName).substring(product.targetName.lastIndexOf('/') + 1);
        var baseNameRfc1034 = Tools.rfc1034(baseName);
        var defaultVal;
        if (product.type.indexOf("applicationbundle") !== -1) {
            defaultVal = {
                CFBundleName: baseName,
                CFBundleIdentifier: "org.example." + baseNameRfc1034,
                CFBundleInfoDictionaryVersion: "6.0",
                CFBundleVersion: "1.0", // version of the app
                CFBundleShortVersionString: "1.0", // user visible version of the app
                CFBundleExecutable: baseName,
                CFBundleDisplayName: baseName,
                CFBundleIconFile: baseName + ".icns",
                CFBundlePackageType: "APPL",
                CFBundleSignature: "????", // legacy creator code in macOS Classic, can be ignored
                CFBundleDevelopmentRegion: "en" // default localization
            }
        } else if (product.type.indexOf("frameworkbundle") !== -1) {
            defaultVal = {
                CFBundleDisplayName: product.targetName,
                CFBundleName: product.targetName,
                CFBundleVersion: product.version || "1.0.0",
                CFBundlePackageType: "FMWK",
                CFBundleSignature: "????"
            };
        }
        return defaultVal
    }

    Rule {
        multiplex: true
        inputs: ["dynamiclibrary", "infoplist", "dsym"]

        Artifact {
            fileName: product.targetName + ".framework"
            fileTags: ["frameworkbundle"]
        }

        prepare: {
            var commands = [];
            var cmd = new Command("ln", ["-s", Gcc.majorVersion(product.version, "1"), "Current"]);
            cmd.workingDirectory = output.fileName + "/Versions";
            cmd.description = "creating framework " + product.targetName;
            cmd.highlight = "codegen";
            commands.push(cmd);

            cmd = new Command("ln", ["-s", "Versions/Current/Resources", "Resources"]);
            cmd.workingDirectory = output.fileName;
            commands.push(cmd);

            cmd = new Command("ln", ["-s", "Versions/Current/" + product.targetName, product.targetName]);
            cmd.workingDirectory = output.fileName;
            commands.push(cmd);
            return commands;
        }
    }
}