Skip to content

Commit

Permalink
Add build.zig to be able to use zig cc
Browse files Browse the repository at this point in the history
We'll use this for cross compilation
  • Loading branch information
akgvn committed Jun 16, 2022
1 parent 0f4c34c commit 03eee12
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,6 @@
bin/
build/
.idea/
zig-cache/
zig-out/
.DS_Store
19 changes: 19 additions & 0 deletions build.zig
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();
}

0 comments on commit 03eee12

Please sign in to comment.