-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
akiroz
committed
May 8, 2022
1 parent
dcea99b
commit 599fead
Showing
7 changed files
with
160 additions
and
134 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
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 |
---|---|---|
@@ -1,17 +1,32 @@ | ||
const builtin = @import("builtin"); | ||
const Builder = @import("std").build.Builder; | ||
const std = @import("std"); | ||
const LibExeObjStep = std.build.LibExeObjStep; | ||
|
||
pub fn build(b: *Builder) void { | ||
const server = b.addExecutable("zika-server", "src/server.zig"); | ||
const client = b.addExecutable("zika-client", "src/client.zig"); | ||
server.addIncludeDir("/usr/local/include"); | ||
client.addIncludeDir("/usr/local/include"); | ||
server.linkSystemLibrary("mosquitto"); | ||
client.linkSystemLibrary("mosquitto"); | ||
if (builtin.target.isDarwin()) { | ||
server.linkSystemLibrary("pcap"); | ||
client.linkSystemLibrary("pcap"); | ||
fn commonOpts(exe: *LibExeObjStep) *LibExeObjStep { | ||
exe.setBuildMode(exe.builder.standardReleaseOptions()); | ||
if (builtin.target.isDarwin()) { // macOS | ||
if (builtin.cpu.arch == .aarch64) { // Apple | ||
exe.addIncludeDir("/opt/homebrew/include"); | ||
exe.addLibPath("/opt/homebrew/lib"); | ||
} else { // Intel | ||
exe.addIncludeDir("/usr/local/include"); | ||
} | ||
exe.linkSystemLibrary("pcap"); | ||
} else { // Linux | ||
exe.addIncludeDir("/usr/include"); | ||
exe.addLibPath("/usr/lib"); | ||
exe.linkLibC(); | ||
// Support down to Ubuntu 18 Bionic | ||
exe.setTarget(.{ .glibc_version = .{ .major = 2, .minor = 27, .patch = 0 } }); | ||
} | ||
//server.install(); | ||
client.install(); | ||
exe.linkSystemLibrary("mosquitto"); | ||
return exe; | ||
} | ||
|
||
pub fn build(b: *std.build.Builder) void { | ||
const server = commonOpts(b.addExecutable("zika-server", "src/server.zig")); | ||
server.install(); | ||
|
||
const client = commonOpts(b.addExecutable("zika-client", "src/client.zig")); | ||
client.install(); | ||
} |
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
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
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
Oops, something went wrong.