switched all builds to bh.declareOptions
This commit is contained in:
parent
ffc84ce44c
commit
cc00fb076e
|
|
@ -0,0 +1,11 @@
|
|||
{
|
||||
"permissions": {
|
||||
"allow": [
|
||||
"Bash(cat:*)",
|
||||
"Bash(git log:*)",
|
||||
"Bash(zig build:*)"
|
||||
],
|
||||
"deny": [],
|
||||
"ask": []
|
||||
}
|
||||
}
|
||||
|
|
@ -48,6 +48,23 @@ pub fn MakeModlib(b: *std.Build, o: ModLibOptions) ModLib {
|
|||
};
|
||||
}
|
||||
|
||||
pub const Options = struct {
|
||||
target: std.Build.ResolvedTarget,
|
||||
optimize: std.builtin.OptimizeMode,
|
||||
static_build: bool,
|
||||
tracy: bool,
|
||||
};
|
||||
|
||||
// standard set of options that all backlog modules and dependenices shall use.
|
||||
pub fn declareOptions(b: *std.Build) Options {
|
||||
return .{
|
||||
.target = b.standardTargetOptions(.{}),
|
||||
.optimize = b.standardOptimizeOption(.{}),
|
||||
.static_build = b.option(bool, "static_build", "builds backlog dependencies for static linking") orelse false,
|
||||
.tracy = b.option(bool, "tracy", "builds with tracy support") orelse false,
|
||||
};
|
||||
}
|
||||
|
||||
pub fn build(b: *std.Build) void {
|
||||
const target = b.standardTargetOptions(.{});
|
||||
const optimize = b.standardOptimizeOption(.{});
|
||||
|
|
|
|||
|
|
@ -1,15 +1,13 @@
|
|||
const std = @import("std");
|
||||
const bh = @import("bh");
|
||||
|
||||
// very tiny, not intended to build anything just to run tests linked with libc
|
||||
pub fn build(b: *std.Build) void {
|
||||
const target = b.standardTargetOptions(.{});
|
||||
const optimize = b.standardOptimizeOption(.{});
|
||||
const static_build = b.option(bool, "static_build", "builds backlog dependencies for static linking") orelse false;
|
||||
_ = static_build;
|
||||
const opts = bh.declareOptions(b);
|
||||
|
||||
const mod = b.addModule("cimgui", .{
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
.target = opts.target,
|
||||
.optimize = opts.optimize,
|
||||
.link_libc = true,
|
||||
.root_source_file = b.path("src/cimgui.zig"),
|
||||
});
|
||||
|
|
@ -22,14 +20,14 @@ pub fn build(b: *std.Build) void {
|
|||
const cimgui = b.addLibrary(.{
|
||||
.name = "cimgui",
|
||||
.root_module = b.createModule(.{
|
||||
.optimize = optimize,
|
||||
.target = target,
|
||||
.optimize = opts.optimize,
|
||||
.target = opts.target,
|
||||
}),
|
||||
});
|
||||
|
||||
cimgui.linkLibC();
|
||||
|
||||
if (target.result.abi != .msvc)
|
||||
if (opts.target.result.abi != .msvc)
|
||||
cimgui.linkLibCpp();
|
||||
|
||||
cimgui.addIncludePath(b.path("cimgui"));
|
||||
|
|
@ -71,8 +69,8 @@ pub fn build(b: *std.Build) void {
|
|||
const test_step = b.step("test", "run unit tests for imgui");
|
||||
const tests = b.addTest(.{
|
||||
.root_module = b.createModule(.{
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
.target = opts.target,
|
||||
.optimize = opts.optimize,
|
||||
.root_source_file = b.path("tests/tests.zig"),
|
||||
}),
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,10 +1,8 @@
|
|||
const std = @import("std");
|
||||
const bh = @import("bh");
|
||||
|
||||
pub fn build(b: *std.Build) void {
|
||||
const target = b.standardTargetOptions(.{});
|
||||
const optimize = b.standardOptimizeOption(.{});
|
||||
const static_build = b.option(bool, "static_build", "builds backlog dependencies for static linking") orelse false;
|
||||
_ = static_build;
|
||||
const opts = bh.declareOptions(b);
|
||||
|
||||
// am i good to always have enet as static?
|
||||
// const enet = if (true) b.addStaticLibrary(.{
|
||||
|
|
@ -21,8 +19,8 @@ pub fn build(b: *std.Build) void {
|
|||
.name = "enet_c",
|
||||
.linkage = .static,
|
||||
.root_module = b.createModule(.{
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
.target = opts.target,
|
||||
.optimize = opts.optimize,
|
||||
}),
|
||||
});
|
||||
|
||||
|
|
@ -47,7 +45,7 @@ pub fn build(b: *std.Build) void {
|
|||
enet.addIncludePath(b.path("enet-1.3.18/include"));
|
||||
|
||||
// Platform-specific configuration
|
||||
switch (target.result.os.tag) {
|
||||
switch (opts.target.result.os.tag) {
|
||||
.windows => {
|
||||
enet.linkSystemLibrary("ws2_32");
|
||||
enet.linkSystemLibrary("winmm");
|
||||
|
|
@ -62,8 +60,8 @@ pub fn build(b: *std.Build) void {
|
|||
b.installArtifact(enet);
|
||||
|
||||
const mod = b.addModule("enet", .{
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
.target = opts.target,
|
||||
.optimize = opts.optimize,
|
||||
.root_source_file = b.path("src/enet.zig"),
|
||||
.link_libc = true,
|
||||
});
|
||||
|
|
@ -75,8 +73,8 @@ pub fn build(b: *std.Build) void {
|
|||
const tests = b.addTest(.{
|
||||
.root_module = b.createModule(.{
|
||||
.link_libc = true,
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
.target = opts.target,
|
||||
.optimize = opts.optimize,
|
||||
.root_source_file = b.path("src/tests.zig"),
|
||||
}),
|
||||
});
|
||||
|
|
@ -91,8 +89,8 @@ pub fn build(b: *std.Build) void {
|
|||
.name = "test-server",
|
||||
.root_module = b.createModule(.{
|
||||
.root_source_file = b.path("src/test_server.zig"),
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
.target = opts.target,
|
||||
.optimize = opts.optimize,
|
||||
}),
|
||||
});
|
||||
test_server.root_module.addImport("enet", mod);
|
||||
|
|
@ -103,8 +101,8 @@ pub fn build(b: *std.Build) void {
|
|||
.name = "test-client",
|
||||
.root_module = b.createModule(.{
|
||||
.root_source_file = b.path("src/test_client.zig"),
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
.target = opts.target,
|
||||
.optimize = opts.optimize,
|
||||
}),
|
||||
});
|
||||
test_client.root_module.addImport("enet", mod);
|
||||
|
|
|
|||
|
|
@ -1,23 +1,22 @@
|
|||
const std = @import("std");
|
||||
const bh = @import("bh");
|
||||
|
||||
pub fn build(b: *std.Build) void {
|
||||
const target = b.standardTargetOptions(.{});
|
||||
const optimize = b.standardOptimizeOption(.{});
|
||||
const static_build = b.option(bool, "static_build", "builds backlog dependencies for static linking") orelse false;
|
||||
const opts = bh.declareOptions(b);
|
||||
|
||||
const mod = b.addModule("lua", .{
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
.target = opts.target,
|
||||
.optimize = opts.optimize,
|
||||
.root_source_file = b.path("src/lua.zig"),
|
||||
.link_libc = true,
|
||||
});
|
||||
|
||||
const luac = b.addLibrary(.{
|
||||
.name = "luac",
|
||||
.linkage = if (static_build) .static else .dynamic,
|
||||
.linkage = if (opts.static_build) .static else .dynamic,
|
||||
.root_module = b.createModule(.{
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
.target = opts.target,
|
||||
.optimize = opts.optimize,
|
||||
.link_libc = true,
|
||||
}),
|
||||
});
|
||||
|
|
@ -64,9 +63,9 @@ pub fn build(b: *std.Build) void {
|
|||
|
||||
luac.addCSourceFile(.{ .file = b.path("src/limited_io.c") });
|
||||
|
||||
if (target.result.os.tag == .windows) {
|
||||
if (opts.target.result.os.tag == .windows) {
|
||||
luac.addCSourceFile(.{ .file = b.path("src/minidumpsetup.cpp") });
|
||||
if (target.result.abi != .msvc)
|
||||
if (opts.target.result.abi != .msvc)
|
||||
luac.linkLibCpp();
|
||||
luac.linkLibC();
|
||||
} else {
|
||||
|
|
@ -85,8 +84,8 @@ pub fn build(b: *std.Build) void {
|
|||
const tests = b.addExecutable(.{
|
||||
.name = "run-lua",
|
||||
.root_module = b.createModule(.{
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
.target = opts.target,
|
||||
.optimize = opts.optimize,
|
||||
.root_source_file = b.path("test/test-lua.zig"),
|
||||
.link_libc = true,
|
||||
}),
|
||||
|
|
|
|||
|
|
@ -1,16 +1,15 @@
|
|||
const std = @import("std");
|
||||
const bh = @import("bh");
|
||||
|
||||
pub fn build(b: *std.Build) void {
|
||||
const target = b.standardTargetOptions(.{});
|
||||
const optimize = b.standardOptimizeOption(.{});
|
||||
const static_build = b.option(bool, "static_build", "builds backlog dependencies for static linking") orelse false;
|
||||
const opts = bh.declareOptions(b);
|
||||
|
||||
const miniaudio_c = b.addLibrary(.{
|
||||
.name = "miniaudio_c",
|
||||
.linkage = if (static_build) .static else .dynamic,
|
||||
.linkage = if (opts.static_build) .static else .dynamic,
|
||||
.root_module = b.createModule(.{
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
.target = opts.target,
|
||||
.optimize = opts.optimize,
|
||||
.link_libc = true,
|
||||
}),
|
||||
});
|
||||
|
|
@ -19,7 +18,7 @@ pub fn build(b: *std.Build) void {
|
|||
miniaudio_c.addCSourceFile(.{ .file = b.path("src/miniaudio.cpp"), .flags = &.{"-fno-sanitize=all"}, .language = .c });
|
||||
miniaudio_c.addIncludePath(b.path("include"));
|
||||
|
||||
const mod = b.addModule("miniaudio", .{ .target = target, .optimize = optimize, .root_source_file = b.path("src/miniaudio.zig") });
|
||||
const mod = b.addModule("miniaudio", .{ .target = opts.target, .optimize = opts.optimize, .root_source_file = b.path("src/miniaudio.zig") });
|
||||
|
||||
mod.linkLibrary(miniaudio_c);
|
||||
mod.addIncludePath(b.path("./include"));
|
||||
|
|
@ -28,8 +27,8 @@ pub fn build(b: *std.Build) void {
|
|||
const test_step = b.step("test", "");
|
||||
const tests = b.addTest(.{
|
||||
.root_module = b.createModule(.{
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
.target = opts.target,
|
||||
.optimize = opts.optimize,
|
||||
.root_source_file = b.path("src/miniaudio-test.zig"),
|
||||
.link_libc = true,
|
||||
}),
|
||||
|
|
|
|||
|
|
@ -1,13 +1,12 @@
|
|||
const std = @import("std");
|
||||
const bh = @import("bh");
|
||||
|
||||
pub fn build(b: *std.Build) void {
|
||||
const target = b.standardTargetOptions(.{});
|
||||
const optimize = b.standardOptimizeOption(.{});
|
||||
const static_build = b.option(bool, "static_build", "builds backlog dependencies for static linking") orelse false;
|
||||
const opts = bh.declareOptions(b);
|
||||
|
||||
const mod = b.addModule("nfd", .{
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
.target = opts.target,
|
||||
.optimize = opts.optimize,
|
||||
.root_source_file = b.path("src/nfd.zig"),
|
||||
.link_libc = true,
|
||||
});
|
||||
|
|
@ -19,19 +18,19 @@ pub fn build(b: *std.Build) void {
|
|||
|
||||
mod.addIncludePath(b.path("include"));
|
||||
|
||||
if (target.result.os.tag == .macos) {
|
||||
if (opts.target.result.os.tag == .macos) {
|
||||
mod.addCSourceFile(.{
|
||||
.file = b.path("src/nfd_cocoa.m"),
|
||||
.flags = &.{},
|
||||
});
|
||||
mod.linkFramework("AppKit", .{});
|
||||
} else if (target.result.os.tag == .windows) {
|
||||
} else if (opts.target.result.os.tag == .windows) {
|
||||
mod.addCSourceFile(.{
|
||||
.file = b.path("src/nfd_win.cpp"),
|
||||
.flags = &.{},
|
||||
});
|
||||
mod.linkSystemLibrary("ole32", .{});
|
||||
} else if (target.result.os.tag == .linux) {
|
||||
} else if (opts.target.result.os.tag == .linux) {
|
||||
// mod.addCSourceFile(.{
|
||||
// .file = b.path("src/nfd_gtk.c"),
|
||||
// .flags = &.{},
|
||||
|
|
@ -47,7 +46,7 @@ pub fn build(b: *std.Build) void {
|
|||
// mod.linkSystemLibrary("gobject-2.0", .{});
|
||||
}
|
||||
|
||||
const p2dep = b.dependency("p2", .{ .target = target, .optimize = optimize, .static_build = static_build });
|
||||
const p2dep = b.dependency("p2", .{ .target = opts.target, .optimize = opts.optimize, .static_build = opts.static_build });
|
||||
|
||||
const p2mod = p2dep.module("p2");
|
||||
mod.addImport("p2", p2mod);
|
||||
|
|
@ -55,8 +54,8 @@ pub fn build(b: *std.Build) void {
|
|||
const test_step = b.step("test", "");
|
||||
const tests = b.addTest(.{
|
||||
.root_module = b.createModule(.{
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
.target = opts.target,
|
||||
.optimize = opts.optimize,
|
||||
.root_source_file = b.path("src/nfd.zig"),
|
||||
.link_libc = true,
|
||||
}),
|
||||
|
|
|
|||
|
|
@ -1,22 +1,20 @@
|
|||
const std = @import("std");
|
||||
const bh = @import("bh");
|
||||
|
||||
pub fn build(b: *std.Build) void {
|
||||
const target = b.standardTargetOptions(.{});
|
||||
const optimize = b.standardOptimizeOption(.{});
|
||||
const static_build = b.option(bool, "static_build", "builds backlog dependencies for static linking") orelse false;
|
||||
_ = static_build;
|
||||
const opts = bh.declareOptions(b);
|
||||
|
||||
const mod = b.addModule("objLoader", .{
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
.target = opts.target,
|
||||
.optimize = opts.optimize,
|
||||
.root_source_file = b.path("src/obj_loader.zig"),
|
||||
});
|
||||
|
||||
const test_step = b.step("test", "");
|
||||
const tests = b.addTest(.{
|
||||
.root_module = b.createModule(.{
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
.target = opts.target,
|
||||
.optimize = opts.optimize,
|
||||
.root_source_file = b.path("src/obj_loader.zig"),
|
||||
.link_libc = true,
|
||||
}),
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@
|
|||
// ozz_animation_offline_fbx -- fbx importing, requires linking wiht fbx sdk... maybe i dont want this... fuck adobe
|
||||
|
||||
const std = @import("std");
|
||||
const bh = @import("bh");
|
||||
|
||||
const Build = std.Build;
|
||||
const LazyPath = LazyPath;
|
||||
|
|
@ -142,16 +143,14 @@ pub const GltfToOzz = struct {
|
|||
};
|
||||
|
||||
pub fn build(b: *std.Build) void {
|
||||
const optimize = b.standardOptimizeOption(.{});
|
||||
const target = b.standardTargetOptions(.{});
|
||||
const static_build = b.option(bool, "static_build", "builds backlog dependencies for static linking") orelse false;
|
||||
const opts = bh.declareOptions(b);
|
||||
|
||||
const ozz_cpp = b.addLibrary(.{
|
||||
.linkage = if (static_build) .static else .dynamic,
|
||||
.linkage = if (opts.static_build) .static else .dynamic,
|
||||
.name = "ozz_cpp",
|
||||
.root_module = b.createModule(.{
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
.target = opts.target,
|
||||
.optimize = opts.optimize,
|
||||
}),
|
||||
});
|
||||
|
||||
|
|
@ -161,7 +160,7 @@ pub fn build(b: *std.Build) void {
|
|||
ozz_cpp.addIncludePath(b.path("ozz-animation/src"));
|
||||
ozz_cpp.linkLibC();
|
||||
|
||||
if (target.result.abi != .msvc)
|
||||
if (opts.target.result.abi != .msvc)
|
||||
ozz_cpp.linkLibCpp();
|
||||
|
||||
const src_dir = "ozz-animation/src/";
|
||||
|
|
@ -208,8 +207,8 @@ pub fn build(b: *std.Build) void {
|
|||
.name = "ozz-tests",
|
||||
.root_module = b.createModule(.{
|
||||
.root_source_file = b.path("tests/test.zig"),
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
.target = opts.target,
|
||||
.optimize = opts.optimize,
|
||||
}),
|
||||
});
|
||||
b.installArtifact(tests);
|
||||
|
|
|
|||
|
|
@ -1,22 +1,20 @@
|
|||
const std = @import("std");
|
||||
const bh = @import("bh");
|
||||
|
||||
pub fn build(b: *std.Build) void {
|
||||
const target = b.standardTargetOptions(.{});
|
||||
const optimize = b.standardOptimizeOption(.{});
|
||||
const static_build = b.option(bool, "static_build", "builds backlog dependencies for static linking") orelse true;
|
||||
_ = static_build;
|
||||
const opts = bh.declareOptions(b);
|
||||
|
||||
const mod = b.addModule("p2", .{
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
.target = opts.target,
|
||||
.optimize = opts.optimize,
|
||||
.root_source_file = b.path("src/p2.zig"),
|
||||
});
|
||||
|
||||
const test_step = b.step("test", "test p2");
|
||||
const tests = b.addTest(.{
|
||||
.root_module = b.createModule(.{
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
.target = opts.target,
|
||||
.optimize = opts.optimize,
|
||||
.root_source_file = b.path("src/p2.zig"),
|
||||
}),
|
||||
// .link_libc = true,
|
||||
|
|
|
|||
|
|
@ -1,16 +1,14 @@
|
|||
const std = @import("std");
|
||||
const bh = @import("bh");
|
||||
|
||||
pub fn build(b: *std.Build) void {
|
||||
const target = b.standardTargetOptions(.{});
|
||||
const optimize = b.standardOptimizeOption(.{});
|
||||
const opts = bh.declareOptions(b);
|
||||
|
||||
const static_build = b.option(bool, "static_build", "builds backlog dependencies for static linking") orelse false;
|
||||
|
||||
const p2dep = b.dependency("p2", .{ .target = target, .optimize = optimize, .static_build = static_build });
|
||||
const p2dep = b.dependency("p2", .{ .target = opts.target, .optimize = opts.optimize, .static_build = opts.static_build });
|
||||
|
||||
const mod = b.addModule("packer", .{
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
.target = opts.target,
|
||||
.optimize = opts.optimize,
|
||||
.root_source_file = b.path("src/packer.zig"),
|
||||
});
|
||||
|
||||
|
|
@ -19,8 +17,8 @@ pub fn build(b: *std.Build) void {
|
|||
|
||||
const test_exe = b.addTest(.{
|
||||
.root_module = b.createModule(.{
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
.target = opts.target,
|
||||
.optimize = opts.optimize,
|
||||
.root_source_file = b.path("tests/test.zig"),
|
||||
}),
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
const std = @import("std");
|
||||
const bh = @import("bh");
|
||||
|
||||
pub fn addShaderDefinition(
|
||||
b: *std.Build,
|
||||
|
|
@ -48,38 +49,35 @@ pub fn shaderDefintion(
|
|||
}
|
||||
|
||||
pub fn build(b: *std.Build) void {
|
||||
const target = b.standardTargetOptions(.{});
|
||||
const optimize = b.standardOptimizeOption(.{});
|
||||
const opts = bh.declareOptions(b);
|
||||
|
||||
const static_build = b.option(bool, "static_build", "builds backlog dependencies for static linking") orelse false;
|
||||
|
||||
const preferred_linkage: std.builtin.LinkMode = if (static_build) .static else .dynamic;
|
||||
const preferred_linkage: std.builtin.LinkMode = if (opts.static_build) .static else .dynamic;
|
||||
|
||||
const sdl_dep = b.dependency("sdl", .{
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
.target = opts.target,
|
||||
.optimize = opts.optimize,
|
||||
.preferred_linkage = preferred_linkage,
|
||||
});
|
||||
|
||||
const sdl3_lib = sdl_dep.artifact("SDL3");
|
||||
|
||||
const sdl3_fwd = b.addModule("SDL3", .{
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
.target = opts.target,
|
||||
.optimize = opts.optimize,
|
||||
.root_source_file = b.path("src/sdl3_lib_fwd.zig"),
|
||||
});
|
||||
|
||||
sdl3_fwd.linkLibrary(sdl3_lib);
|
||||
|
||||
const mod = b.addModule("sdl3", .{
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
.target = opts.target,
|
||||
.optimize = opts.optimize,
|
||||
.root_source_file = b.path("src/sdl3.zig"),
|
||||
});
|
||||
|
||||
const shaderTypes = b.dependency("shaderTypes", .{
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
.target = opts.target,
|
||||
.optimize = opts.optimize,
|
||||
});
|
||||
mod.addImport("shaderTypes", shaderTypes.module("shaderTypes"));
|
||||
|
||||
|
|
@ -90,8 +88,8 @@ pub fn build(b: *std.Build) void {
|
|||
const tests2 = b.addExecutable(.{
|
||||
.name = "hello-sdl",
|
||||
.root_module = b.createModule(.{
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
.target = opts.target,
|
||||
.optimize = opts.optimize,
|
||||
.root_source_file = b.path("src/samples/compiletest.zig"),
|
||||
.link_libc = true,
|
||||
}),
|
||||
|
|
@ -101,8 +99,8 @@ pub fn build(b: *std.Build) void {
|
|||
const tests = b.addExecutable(.{
|
||||
.name = "hello-triangle",
|
||||
.root_module = b.createModule(.{
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
.target = opts.target,
|
||||
.optimize = opts.optimize,
|
||||
.root_source_file = b.path("src/samples/hello-triangle.zig"),
|
||||
.link_libc = true,
|
||||
}),
|
||||
|
|
@ -112,8 +110,8 @@ pub fn build(b: *std.Build) void {
|
|||
const hello_window_exe = b.addExecutable(.{
|
||||
.name = "hello-window",
|
||||
.root_module = b.createModule(.{
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
.target = opts.target,
|
||||
.optimize = opts.optimize,
|
||||
.root_source_file = b.path("src/samples/hello-window.zig"),
|
||||
.link_libc = true,
|
||||
}),
|
||||
|
|
@ -124,7 +122,7 @@ pub fn build(b: *std.Build) void {
|
|||
|
||||
tests.root_module.addImport("sdl3", mod);
|
||||
|
||||
const vertexDefinitions = addShaderDefinition(b, ".", target, optimize, "hello-triangle.vert", b.path("content/hello-triangle.vert.json"));
|
||||
const vertexDefinitions = addShaderDefinition(b, ".", opts.target, opts.optimize, "hello-triangle.vert", b.path("content/hello-triangle.vert.json"));
|
||||
tests.root_module.addImport("hello-triangle.vert", vertexDefinitions);
|
||||
|
||||
const runArtifact = b.addRunArtifact(tests);
|
||||
|
|
|
|||
|
|
@ -1,15 +1,12 @@
|
|||
const std = @import("std");
|
||||
const bh = @import("bh");
|
||||
|
||||
pub fn build(b: *std.Build) void {
|
||||
const target = b.standardTargetOptions(.{});
|
||||
const optimize = b.standardOptimizeOption(.{});
|
||||
|
||||
const static_build = b.option(bool, "static_build", "builds backlog dependencies for static linking") orelse false;
|
||||
_ = static_build;
|
||||
const opts = bh.declareOptions(b);
|
||||
|
||||
const mod = b.addModule("shaderTypes", .{
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
.target = opts.target,
|
||||
.optimize = opts.optimize,
|
||||
.root_source_file = b.path("shaderTypes.zig"),
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,9 @@
|
|||
.{
|
||||
.name = .shaderTypes,
|
||||
.version = "0.0.0",
|
||||
.dependencies = .{},
|
||||
.dependencies = .{
|
||||
.bh = .{ .path = "../../bh" },
|
||||
},
|
||||
.paths = .{
|
||||
"",
|
||||
},
|
||||
|
|
|
|||
|
|
@ -1,15 +1,15 @@
|
|||
const std = @import("std");
|
||||
const bh = @import("bh");
|
||||
|
||||
pub fn build(b: *std.Build) void {
|
||||
const target = b.standardTargetOptions(.{});
|
||||
const optimize = b.standardOptimizeOption(.{});
|
||||
const opts = bh.declareOptions(b);
|
||||
|
||||
const exe = b.addExecutable(.{
|
||||
.name = "spvReflect2",
|
||||
.root_module = b.createModule(.{
|
||||
.root_source_file = b.path("spvReflect2.zig"),
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
.target = opts.target,
|
||||
.optimize = opts.optimize,
|
||||
}),
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,11 @@
|
|||
.{
|
||||
.name = .spvreflect,
|
||||
.version = "0.0.0",
|
||||
.dependencies = .{
|
||||
.bh = .{ .path = "../../bh" },
|
||||
},
|
||||
.paths = .{
|
||||
"",
|
||||
},
|
||||
.fingerprint = 0x77801c18119671a4,
|
||||
}
|
||||
|
|
@ -1,17 +1,15 @@
|
|||
const std = @import("std");
|
||||
const bh = @import("bh");
|
||||
|
||||
pub fn build(b: *std.Build) void {
|
||||
const target = b.standardTargetOptions(.{});
|
||||
const optimize = b.standardOptimizeOption(.{});
|
||||
|
||||
const static_build = b.option(bool, "static_build", "builds backlog dependencies for static linking") orelse false;
|
||||
const opts = bh.declareOptions(b);
|
||||
|
||||
const spng_c = b.addLibrary(.{
|
||||
.linkage = if (static_build) .static else .dynamic,
|
||||
.linkage = if (opts.static_build) .static else .dynamic,
|
||||
.name = "spng_c",
|
||||
.root_module = b.createModule(.{
|
||||
.optimize = optimize,
|
||||
.target = target,
|
||||
.optimize = opts.optimize,
|
||||
.target = opts.target,
|
||||
.link_libc = true,
|
||||
}),
|
||||
});
|
||||
|
|
@ -24,8 +22,8 @@ pub fn build(b: *std.Build) void {
|
|||
spng_c.root_module.addCMacro("SPNG_USE_MINIZ", "1");
|
||||
|
||||
const mod = b.addModule("spng", .{
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
.target = opts.target,
|
||||
.optimize = opts.optimize,
|
||||
.root_source_file = b.path("src/spng.zig"),
|
||||
});
|
||||
|
||||
|
|
@ -38,8 +36,8 @@ pub fn build(b: *std.Build) void {
|
|||
const test_step = b.step("test", "run unit tests for spng");
|
||||
const tests = b.addTest(.{
|
||||
.root_module = b.createModule(.{
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
.target = opts.target,
|
||||
.optimize = opts.optimize,
|
||||
.root_source_file = b.path("src/spng.zig"),
|
||||
.link_libc = true,
|
||||
}),
|
||||
|
|
|
|||
|
|
@ -1,22 +1,22 @@
|
|||
const std = @import("std");
|
||||
const bh = @import("bh");
|
||||
|
||||
pub fn build(b: *std.Build) void {
|
||||
const target = b.standardTargetOptions(.{});
|
||||
const optimize = b.standardOptimizeOption(.{});
|
||||
const opts = bh.declareOptions(b);
|
||||
|
||||
const theorafile = b.addModule(
|
||||
"theorafile",
|
||||
.{
|
||||
.optimize = optimize,
|
||||
.target = target,
|
||||
.optimize = opts.optimize,
|
||||
.target = opts.target,
|
||||
.root_source_file = b.path("theorafile.zig"),
|
||||
.link_libc = true,
|
||||
},
|
||||
);
|
||||
|
||||
const sdl_dep = b.dependency("sdl", .{
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
.target = opts.target,
|
||||
.optimize = opts.optimize,
|
||||
});
|
||||
|
||||
const sdl_lib = sdl_dep.artifact("SDL3");
|
||||
|
|
@ -99,8 +99,8 @@ pub fn build(b: *std.Build) void {
|
|||
const tests = b.addExecutable(.{
|
||||
.name = "test",
|
||||
.root_module = b.createModule(.{
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
.target = opts.target,
|
||||
.optimize = opts.optimize,
|
||||
.link_libc = true,
|
||||
.root_source_file = b.path("sdl3test/sdl3test.zig"),
|
||||
}),
|
||||
|
|
|
|||
|
|
@ -1,13 +1,11 @@
|
|||
const std = @import("std");
|
||||
const bh = @import("bh");
|
||||
|
||||
const tracy_path = "tracy-0.10/public";
|
||||
const tracy_path_include = tracy_path ++ "/tracy";
|
||||
|
||||
pub fn build(b: *std.Build) void {
|
||||
const target = b.standardTargetOptions(.{});
|
||||
const optimize = b.standardOptimizeOption(.{});
|
||||
const static_build = b.option(bool, "static_build", "builds backlog dependencies for static linking") orelse false;
|
||||
_ = static_build;
|
||||
const opts = bh.declareOptions(b);
|
||||
|
||||
//const tracy_enabled = b.option(bool, "tracy", "Enables tracy integration") orelse false;
|
||||
|
||||
|
|
@ -18,8 +16,8 @@ pub fn build(b: *std.Build) void {
|
|||
// std.debug.print("tracy enabled {s}\n", .{if (tracy_enabled) "true" else "false"});
|
||||
|
||||
const mod = b.addModule("tracy", .{
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
.target = opts.target,
|
||||
.optimize = opts.optimize,
|
||||
.root_source_file = b.path("tracy.zig"),
|
||||
.link_libc = tracy_enabled,
|
||||
.link_libcpp = tracy_enabled,
|
||||
|
|
@ -39,7 +37,7 @@ pub fn build(b: *std.Build) void {
|
|||
},
|
||||
});
|
||||
|
||||
if (target.result.os.tag == .windows) {
|
||||
if (opts.target.result.os.tag == .windows) {
|
||||
mod.linkSystemLibrary("Advapi32", .{});
|
||||
mod.linkSystemLibrary("User32", .{});
|
||||
mod.linkSystemLibrary("Ws2_32", .{});
|
||||
|
|
@ -47,16 +45,16 @@ pub fn build(b: *std.Build) void {
|
|||
}
|
||||
}
|
||||
|
||||
const opts = b.addOptions();
|
||||
opts.addOption(bool, "tracy_enabled", tracy_enabled);
|
||||
mod.addOptions("build_options", opts);
|
||||
const build_opts = b.addOptions();
|
||||
build_opts.addOption(bool, "tracy_enabled", tracy_enabled);
|
||||
mod.addOptions("build_options", build_opts);
|
||||
|
||||
// ========== tests =============
|
||||
const test_step = b.step("test", "run unit tests for tracy");
|
||||
const tests = b.addTest(.{
|
||||
.root_module = b.createModule(.{
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
.target = opts.target,
|
||||
.optimize = opts.optimize,
|
||||
.root_source_file = b.path("tracy_test.zig"),
|
||||
}),
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,15 +1,12 @@
|
|||
const std = @import("std");
|
||||
const bh = @import("bh");
|
||||
|
||||
pub fn build(b: *std.Build) void {
|
||||
const target = b.standardTargetOptions(.{});
|
||||
const optimize = b.standardOptimizeOption(.{});
|
||||
|
||||
const static_build = b.option(bool, "static_build", "builds backlog dependencies for static linking") orelse false;
|
||||
_ = static_build;
|
||||
const opts = bh.declareOptions(b);
|
||||
|
||||
const mod = b.addModule("watcher", .{
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
.target = opts.target,
|
||||
.optimize = opts.optimize,
|
||||
.root_source_file = b.path("src/watcher.zig"),
|
||||
.link_libc = true,
|
||||
.link_libcpp = true,
|
||||
|
|
@ -17,7 +14,7 @@ pub fn build(b: *std.Build) void {
|
|||
|
||||
mod.addCSourceFile(.{ .file = b.path("src/watcher.cpp") });
|
||||
|
||||
if (target.result.os.tag == .macos) {
|
||||
if (opts.target.result.os.tag == .macos) {
|
||||
mod.linkFramework("CoreFoundation", .{});
|
||||
mod.linkFramework("CoreServices", .{});
|
||||
}
|
||||
|
|
@ -26,8 +23,8 @@ pub fn build(b: *std.Build) void {
|
|||
|
||||
const test_exe = b.addTest(.{
|
||||
.root_module = b.createModule(.{
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
.target = opts.target,
|
||||
.optimize = opts.optimize,
|
||||
.root_source_file = b.path("tests/test.zig"),
|
||||
}),
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,16 +1,13 @@
|
|||
const std = @import("std");
|
||||
const bh = @import("bh");
|
||||
|
||||
pub fn build(b: *std.Build) void {
|
||||
const target = b.standardTargetOptions(.{});
|
||||
const optimize = b.standardOptimizeOption(.{});
|
||||
|
||||
const static_build = b.option(bool, "static_build", "builds backlog dependencies for static linking") orelse false;
|
||||
_ = static_build;
|
||||
const opts = bh.declareOptions(b);
|
||||
|
||||
const mod = b.addModule("zgltf", .{
|
||||
.root_source_file = b.path("src/zgltf.zig"),
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
.target = opts.target,
|
||||
.optimize = opts.optimize,
|
||||
});
|
||||
|
||||
const tests = b.addTest(.{
|
||||
|
|
|
|||
|
|
@ -1,22 +1,20 @@
|
|||
const std = @import("std");
|
||||
const bh = @import("bh");
|
||||
|
||||
pub fn build(b: *std.Build) void {
|
||||
const target = b.standardTargetOptions(.{});
|
||||
const optimize = b.standardOptimizeOption(.{});
|
||||
const static_build = b.option(bool, "static_build", "builds backlog dependencies for static linking") orelse false;
|
||||
_ = static_build;
|
||||
const opts = bh.declareOptions(b);
|
||||
|
||||
const mod = b.addModule("zmath", .{
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
.target = opts.target,
|
||||
.optimize = opts.optimize,
|
||||
.root_source_file = b.path("zmath.zig"),
|
||||
});
|
||||
|
||||
const test_step = b.step("test", "runs tests for zmath");
|
||||
const tests = b.addTest(.{
|
||||
.root_module = b.createModule(.{
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
.target = opts.target,
|
||||
.optimize = opts.optimize,
|
||||
.root_source_file = b.path("zmath.zig"),
|
||||
.link_libc = true,
|
||||
}),
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
const std = @import("std");
|
||||
const bh = @import("bh");
|
||||
|
||||
fn addMacros(module: *std.Build.Module, options: anytype) void {
|
||||
if (options.enable_cross_platform_determinism)
|
||||
|
|
@ -12,8 +13,7 @@ fn addMacros(module: *std.Build.Module, options: anytype) void {
|
|||
}
|
||||
|
||||
pub fn build(b: *std.Build) void {
|
||||
const optimize = b.standardOptimizeOption(.{});
|
||||
const target = b.standardTargetOptions(.{});
|
||||
const opts = bh.declareOptions(b);
|
||||
|
||||
const options = .{
|
||||
.use_double_precision = b.option(
|
||||
|
|
@ -25,7 +25,7 @@ pub fn build(b: *std.Build) void {
|
|||
bool,
|
||||
"enable_asserts",
|
||||
"Enable assertions",
|
||||
) orelse (optimize == .Debug),
|
||||
) orelse (opts.optimize == .Debug),
|
||||
.enable_cross_platform_determinism = b.option(
|
||||
bool,
|
||||
"enable_cross_platform_determinism",
|
||||
|
|
@ -48,8 +48,6 @@ pub fn build(b: *std.Build) void {
|
|||
) orelse true,
|
||||
};
|
||||
|
||||
const static_build = b.option(bool, "static_build", "builds backlog dependencies for static linking") orelse true;
|
||||
|
||||
const user_extensions = b.option(
|
||||
[]const std.Build.LazyPath,
|
||||
"user_extensions",
|
||||
|
|
@ -73,14 +71,14 @@ pub fn build(b: *std.Build) void {
|
|||
|
||||
const joltc = b.addLibrary(.{
|
||||
.name = "joltc",
|
||||
.linkage = if (!static_build) .dynamic else .static,
|
||||
.linkage = if (!opts.static_build) .dynamic else .static,
|
||||
.root_module = b.createModule(.{
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
.target = opts.target,
|
||||
.optimize = opts.optimize,
|
||||
}),
|
||||
});
|
||||
|
||||
if (!static_build and target.result.os.tag == .windows)
|
||||
if (!opts.static_build and opts.target.result.os.tag == .windows)
|
||||
joltc.root_module.addCMacro("JPC_API", "extern __declspec(dllexport)");
|
||||
|
||||
b.installArtifact(joltc);
|
||||
|
|
@ -88,7 +86,7 @@ pub fn build(b: *std.Build) void {
|
|||
joltc.addIncludePath(b.path("libs"));
|
||||
joltc.addIncludePath(b.path("libs/JoltC"));
|
||||
joltc.linkLibC();
|
||||
if (target.result.abi != .msvc) {
|
||||
if (opts.target.result.abi != .msvc) {
|
||||
joltc.linkLibCpp();
|
||||
} else {
|
||||
joltc.linkSystemLibrary("advapi32");
|
||||
|
|
@ -257,14 +255,14 @@ pub fn build(b: *std.Build) void {
|
|||
.name = "zphysics-tests",
|
||||
.root_module = b.createModule(.{
|
||||
.root_source_file = b.path("src/zphysics.zig"),
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
.target = opts.target,
|
||||
.optimize = opts.optimize,
|
||||
}),
|
||||
});
|
||||
b.installArtifact(tests);
|
||||
|
||||
// TODO: Problems with LTO on Windows.
|
||||
if (target.result.os.tag == .windows) {
|
||||
if (opts.target.result.os.tag == .windows) {
|
||||
tests.want_lto = false;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue