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
|
import qbs
import qbs.File
import qbs.FileInfo
import qbs.Probes
import "../protobufbase.qbs" as ProtobufBase
import "../protobuf.js" as HelperFunctions
ProtobufBase {
property string includePath: includeProbe.path
property string libraryPath: libraryProbe.path
property string frameworkPath: frameworkProbe.path
Depends { name: "cpp" }
cpp.includePaths: [outputDir].concat(!frameworkPath && includePath ? [includePath] : [])
cpp.libraryPaths: !frameworkPath && libraryPath ? [libraryPath] : []
cpp.dynamicLibraries: !frameworkPath && libraryPath ? ["ProtocolBuffers"] : []
cpp.frameworkPaths: frameworkPath ? [frameworkPath] : []
cpp.frameworks: ["Foundation"].concat(frameworkPath ? ["Protobuf"] : [])
cpp.defines: frameworkPath ? ["GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS"] : []
Rule {
inputs: ["protobuf.input"]
outputFileTags: ["hpp", "protobuf.hpp", "objc"]
outputArtifacts: {
var outputDir = HelperFunctions.getOutputDir(input.protobuf.objc, input);
return [
HelperFunctions.objcArtifact(outputDir, input, ["hpp", "protobuf.hpp"],
".pbobjc.h"),
HelperFunctions.objcArtifact(outputDir, input, ["objc"], ".pbobjc.m")
];
}
prepare: HelperFunctions.doPrepare(input.protobuf.objc, product, input, outputs, "objc")
}
Probes.IncludeProbe {
id: includeProbe
names: "GPBMessage.h"
}
Probes.LibraryProbe {
id: libraryProbe
names: "ProtocolBuffers"
}
Probes.FrameworkProbe {
id: frameworkProbe
names: ["Protobuf"]
}
validate: {
HelperFunctions.validateCompiler(compilerName, compilerPath);
if (!HelperFunctions.checkPath(frameworkPath)) {
if (!HelperFunctions.checkPath(includePath)) {
throw "Can't find objective-c protobuf include files. Please set the includePath "
+ "or frameworkPath property.";
}
if (!HelperFunctions.checkPath(libraryPath)) {
throw "Can't find objective-c protobuf library. Please set the libraryPath or "
+ "frameworkPath property.";
}
}
}
}
|