-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild_mqtt.zig
30 lines (24 loc) · 952 Bytes
/
build_mqtt.zig
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
const std = @import("std");
const microzig = @import("microzig");
const include_path = [_][]const u8{
"csrc/connectivity/paho.mqtt.embedded-c/MQTTPacket/src/",
};
const paho_src_path = "csrc/connectivity/paho.mqtt.embedded-c/MQTTPacket/src/";
const source_path = [_][]const u8{
paho_src_path ++ "MQTTFormat.c",
paho_src_path ++ "MQTTPacket.c",
paho_src_path ++ "MQTTSerializePublish.c",
paho_src_path ++ "MQTTDeserializePublish.c",
paho_src_path ++ "MQTTConnectClient.c",
paho_src_path ++ "MQTTSubscribeClient.c",
paho_src_path ++ "MQTTUnsubscribeClient.c",
};
const c_flags = [_][]const u8{ "-DMQTT_CLIENT=1", "-O2", "-fdata-sections", "-ffunction-sections" };
pub fn aggregate(exe: *microzig.Firmware) void {
for (include_path) |path| {
exe.addIncludePath(.{ .path = path });
}
for (source_path) |path| {
exe.addCSourceFile(.{ .file = .{ .path = path }, .flags = &c_flags });
}
}