constify unmutated variables in build files
This commit is contained in:
parent
d9e2505b59
commit
aae3ea8577
3 changed files with 11 additions and 11 deletions
|
|
@ -12,7 +12,7 @@ pub fn build(b: *Builder) void {
|
||||||
glfw.link(b, lib, .{});
|
glfw.link(b, lib, .{});
|
||||||
lib.install();
|
lib.install();
|
||||||
|
|
||||||
var main_tests = b.addTest("src/main.zig");
|
const main_tests = b.addTest("src/main.zig");
|
||||||
main_tests.setBuildMode(mode);
|
main_tests.setBuildMode(mode);
|
||||||
main_tests.setTarget(target);
|
main_tests.setTarget(target);
|
||||||
main_tests.addPackagePath("glfw", "glfw/src/main.zig");
|
main_tests.addPackagePath("glfw", "glfw/src/main.zig");
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ pub fn build(b: *Builder) void {
|
||||||
const mode = b.standardReleaseOptions();
|
const mode = b.standardReleaseOptions();
|
||||||
const target = b.standardTargetOptions(.{});
|
const target = b.standardTargetOptions(.{});
|
||||||
|
|
||||||
var main_tests = b.addTest("src/main.zig");
|
const main_tests = b.addTest("src/main.zig");
|
||||||
main_tests.setBuildMode(mode);
|
main_tests.setBuildMode(mode);
|
||||||
main_tests.setTarget(target);
|
main_tests.setTarget(target);
|
||||||
link(b, main_tests, .{});
|
link(b, main_tests, .{});
|
||||||
|
|
@ -48,7 +48,7 @@ pub fn link(b: *Builder, step: *std.build.LibExeObjStep, options: Options) void
|
||||||
}
|
}
|
||||||
|
|
||||||
fn buildLibrary(b: *Builder, step: *std.build.LibExeObjStep, options: Options) *std.build.LibExeObjStep {
|
fn buildLibrary(b: *Builder, step: *std.build.LibExeObjStep, options: Options) *std.build.LibExeObjStep {
|
||||||
var main_abs = std.fs.path.join(b.allocator, &.{ thisDir(), "src/main.zig" }) catch unreachable;
|
const main_abs = std.fs.path.join(b.allocator, &.{ thisDir(), "src/main.zig" }) catch unreachable;
|
||||||
const lib = b.addStaticLibrary("glfw", main_abs);
|
const lib = b.addStaticLibrary("glfw", main_abs);
|
||||||
lib.setBuildMode(step.build_mode);
|
lib.setBuildMode(step.build_mode);
|
||||||
lib.setTarget(step.target);
|
lib.setTarget(step.target);
|
||||||
|
|
@ -78,7 +78,7 @@ fn buildLibrary(b: *Builder, step: *std.build.LibExeObjStep, options: Options) *
|
||||||
"upstream/glfw/src/context.c",
|
"upstream/glfw/src/context.c",
|
||||||
"upstream/glfw/src/window.c",
|
"upstream/glfw/src/window.c",
|
||||||
}) |path| {
|
}) |path| {
|
||||||
var abs_path = std.fs.path.join(b.allocator, &.{ thisDir(), path }) catch unreachable;
|
const abs_path = std.fs.path.join(b.allocator, &.{ thisDir(), path }) catch unreachable;
|
||||||
sources.append(abs_path) catch unreachable;
|
sources.append(abs_path) catch unreachable;
|
||||||
}
|
}
|
||||||
lib.addCSourceFiles(sources.items, &.{"-D_GLFW_WIN32"});
|
lib.addCSourceFiles(sources.items, &.{"-D_GLFW_WIN32"});
|
||||||
|
|
@ -105,7 +105,7 @@ fn buildLibrary(b: *Builder, step: *std.build.LibExeObjStep, options: Options) *
|
||||||
"upstream/glfw/src/context.c",
|
"upstream/glfw/src/context.c",
|
||||||
"upstream/glfw/src/window.c",
|
"upstream/glfw/src/window.c",
|
||||||
}) |path| {
|
}) |path| {
|
||||||
var abs_path = std.fs.path.join(b.allocator, &.{ thisDir(), path }) catch unreachable;
|
const abs_path = std.fs.path.join(b.allocator, &.{ thisDir(), path }) catch unreachable;
|
||||||
sources.append(abs_path) catch unreachable;
|
sources.append(abs_path) catch unreachable;
|
||||||
}
|
}
|
||||||
lib.addCSourceFiles(sources.items, &.{"-D_GLFW_COCOA"});
|
lib.addCSourceFiles(sources.items, &.{"-D_GLFW_COCOA"});
|
||||||
|
|
@ -141,7 +141,7 @@ fn buildLibrary(b: *Builder, step: *std.build.LibExeObjStep, options: Options) *
|
||||||
"upstream/glfw/src/context.c",
|
"upstream/glfw/src/context.c",
|
||||||
"upstream/glfw/src/window.c",
|
"upstream/glfw/src/window.c",
|
||||||
}) |path| {
|
}) |path| {
|
||||||
var abs_path = std.fs.path.join(b.allocator, &.{ thisDir(), path }) catch unreachable;
|
const abs_path = std.fs.path.join(b.allocator, &.{ thisDir(), path }) catch unreachable;
|
||||||
general_sources.append(abs_path) catch unreachable;
|
general_sources.append(abs_path) catch unreachable;
|
||||||
}
|
}
|
||||||
lib.addCSourceFiles(general_sources.items, &.{flag});
|
lib.addCSourceFiles(general_sources.items, &.{flag});
|
||||||
|
|
@ -156,7 +156,7 @@ fn buildLibrary(b: *Builder, step: *std.build.LibExeObjStep, options: Options) *
|
||||||
"upstream/glfw/src/xkb_unicode.c",
|
"upstream/glfw/src/xkb_unicode.c",
|
||||||
"upstream/glfw/src/glx_context.c",
|
"upstream/glfw/src/glx_context.c",
|
||||||
}) |path| {
|
}) |path| {
|
||||||
var abs_path = std.fs.path.join(b.allocator, &.{ thisDir(), path }) catch unreachable;
|
const abs_path = std.fs.path.join(b.allocator, &.{ thisDir(), path }) catch unreachable;
|
||||||
x11_sources.append(abs_path) catch unreachable;
|
x11_sources.append(abs_path) catch unreachable;
|
||||||
}
|
}
|
||||||
lib.addCSourceFiles(x11_sources.items, &.{flag});
|
lib.addCSourceFiles(x11_sources.items, &.{flag});
|
||||||
|
|
@ -168,7 +168,7 @@ fn buildLibrary(b: *Builder, step: *std.build.LibExeObjStep, options: Options) *
|
||||||
"upstream/glfw/src/wl_window.c",
|
"upstream/glfw/src/wl_window.c",
|
||||||
"upstream/glfw/src/wl_init.c",
|
"upstream/glfw/src/wl_init.c",
|
||||||
}) |path| {
|
}) |path| {
|
||||||
var abs_path = std.fs.path.join(b.allocator, &.{ thisDir(), path }) catch unreachable;
|
const abs_path = std.fs.path.join(b.allocator, &.{ thisDir(), path }) catch unreachable;
|
||||||
wayland_sources.append(abs_path) catch unreachable;
|
wayland_sources.append(abs_path) catch unreachable;
|
||||||
}
|
}
|
||||||
lib.addCSourceFiles(wayland_sources.items, &.{flag});
|
lib.addCSourceFiles(wayland_sources.items, &.{flag});
|
||||||
|
|
@ -186,11 +186,11 @@ fn thisDir() []const u8 {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn linkGLFWDependencies(b: *Builder, step: *std.build.LibExeObjStep, options: Options) void {
|
fn linkGLFWDependencies(b: *Builder, step: *std.build.LibExeObjStep, options: Options) void {
|
||||||
var include_dir = std.fs.path.join(b.allocator, &.{ thisDir(), "upstream/glfw/include" }) catch unreachable;
|
const include_dir = std.fs.path.join(b.allocator, &.{ thisDir(), "upstream/glfw/include" }) catch unreachable;
|
||||||
defer b.allocator.free(include_dir);
|
defer b.allocator.free(include_dir);
|
||||||
step.addIncludeDir(include_dir);
|
step.addIncludeDir(include_dir);
|
||||||
|
|
||||||
var vulkan_include_dir = std.fs.path.join(b.allocator, &.{ thisDir(), "upstream/vulkan_headers/include" }) catch unreachable;
|
const vulkan_include_dir = std.fs.path.join(b.allocator, &.{ thisDir(), "upstream/vulkan_headers/include" }) catch unreachable;
|
||||||
defer b.allocator.free(vulkan_include_dir);
|
defer b.allocator.free(vulkan_include_dir);
|
||||||
step.addIncludeDir(vulkan_include_dir);
|
step.addIncludeDir(vulkan_include_dir);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ pub fn build(b: *Builder) void {
|
||||||
lib.install();
|
lib.install();
|
||||||
dawn.link(b, lib, .{});
|
dawn.link(b, lib, .{});
|
||||||
|
|
||||||
var main_tests = b.addTest("src/main.zig");
|
const main_tests = b.addTest("src/main.zig");
|
||||||
main_tests.setBuildMode(mode);
|
main_tests.setBuildMode(mode);
|
||||||
|
|
||||||
const test_step = b.step("test", "Run library tests");
|
const test_step = b.step("test", "Run library tests");
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue