-
Notifications
You must be signed in to change notification settings - Fork 273
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add build.zig to be able to use zig cc
We'll use this for cross compilation
- Loading branch information
Showing
2 changed files
with
22 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,6 @@ | |
bin/ | ||
build/ | ||
.idea/ | ||
zig-cache/ | ||
zig-out/ | ||
.DS_Store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
const std = @import("std"); | ||
|
||
pub fn build(b: *std.build.Builder) void { | ||
// Standard release options allow the person running `zig build` to select | ||
// between Debug, ReleaseSafe, ReleaseFast, and ReleaseSmall. | ||
const mode = b.standardReleaseOptions(); | ||
|
||
const lib = b.addStaticLibrary("MQTT-C", null); | ||
|
||
lib.addIncludeDir("include"); | ||
|
||
lib.addCSourceFile("src/mqtt.c", &[_][]const u8 {}); | ||
lib.addCSourceFile("src/mqtt_pal.c", &[_][]const u8 {}); | ||
|
||
lib.linkLibC(); | ||
|
||
lib.setBuildMode(mode); | ||
lib.install(); | ||
} |