Skip to content

Commit

Permalink
build: change install() arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
zenith391 committed Dec 3, 2022
1 parent 1e2a1ef commit 6781758
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 11 deletions.
8 changes: 4 additions & 4 deletions build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ pub fn build(b: *std.build.Builder) !void {
b.addExecutable(name, programPath);
exe.setTarget(target);
exe.setBuildMode(mode);
try install(exe, ".");
try install(exe, .{});

const install_step = b.addInstallArtifact(exe);
const working = blk: {
Expand Down Expand Up @@ -144,7 +144,7 @@ pub fn build(b: *std.build.Builder) !void {
lib.setTarget(target);
lib.setBuildMode(mode);
lib.linkLibC();
try install(lib, ".");
try install(lib, .{});
// lib.emit_h = true;
lib.install();

Expand All @@ -158,7 +158,7 @@ pub fn build(b: *std.build.Builder) !void {
tests.setTarget(target);
tests.setBuildMode(mode);
// tests.emit_docs = .emit;
try install(tests, ".");
try install(tests, .{});

const test_step = b.step("test", "Run unit tests and also generate the documentation");
test_step.dependOn(&tests.step);
Expand All @@ -167,7 +167,7 @@ pub fn build(b: *std.build.Builder) !void {
coverage_tests.setTarget(target);
coverage_tests.setBuildMode(mode);
coverage_tests.exec_cmd_args = &.{ "kcov", "--clean", "--include-pattern=src/", "kcov-output", null };
try install(coverage_tests, ".");
try install(coverage_tests, .{});

const cov_step = b.step("coverage", "Perform code coverage of unit tests. This requires 'kcov' to be installed.");
cov_step.dependOn(&coverage_tests.step);
Expand Down
20 changes: 13 additions & 7 deletions build_capy.zig
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,16 @@ const zig_libressl = struct {};
// else
// @import("vendor/zelda/zig-libressl/build.zig");

pub fn install(step: *std.build.LibExeObjStep, comptime prefix: []const u8) !void {
pub const CapyBuildOptions = struct {

};

pub fn install(step: *std.build.LibExeObjStep, options: CapyBuildOptions) !void {
_ = options;
const prefix = comptime std.fs.path.dirname(@src().file).? ++ std.fs.path.sep_str;
step.subsystem = .Native;

switch (step.target.getOsTag()) {
.linux, .freebsd => {
step.linkLibC();
step.linkSystemLibrary("gtk+-3.0");
},
.windows => {
switch (step.build_mode) {
.Debug => step.subsystem = .Console,
Expand Down Expand Up @@ -48,6 +50,10 @@ pub fn install(step: *std.build.LibExeObjStep, comptime prefix: []const u8) !voi
step.linkFramework("AppKit");
step.linkSystemLibraryName("objc");
},
.linux, .freebsd => {
step.linkLibC();
step.linkSystemLibrary("gtk+-3.0");
},
.freestanding => {
if (step.target.toTarget().isWasm()) {
// Things like the image reader require more stack than given by default
Expand All @@ -69,7 +75,7 @@ pub fn install(step: *std.build.LibExeObjStep, comptime prefix: []const u8) !voi

const zigimg = std.build.Pkg{
.name = "zigimg",
.source = std.build.FileSource.relative(prefix ++ "/vendor/zigimg/zigimg.zig"),
.source = std.build.FileSource { .path = prefix ++ "/vendor/zigimg/zigimg.zig" },
};

// const zelda = build_zelda.pkgs.zelda;
Expand All @@ -87,7 +93,7 @@ pub fn install(step: *std.build.LibExeObjStep, comptime prefix: []const u8) !voi

const capy = std.build.Pkg{
.name = "capy",
.source = std.build.FileSource.relative(prefix ++ "/src/main.zig"),
.source = std.build.FileSource { .path = prefix ++ "/src/main.zig" },
//.dependencies = &[_]std.build.Pkg{ zigimg, zelda },
.dependencies = &[_]std.build.Pkg{ zigimg },
};
Expand Down

0 comments on commit 6781758

Please sign in to comment.