From 9f6c4bf7b14ff2ba457953c71a3834aad48dfc58 Mon Sep 17 00:00:00 2001 From: Ali Chraghi Date: Tue, 20 Sep 2022 08:57:24 +0430 Subject: [PATCH] build: fix compilation errors this should make linux CI green --- build.zig | 18 ++++++++++++------ libs/gpu-dawn/sdk.zig | 6 +++--- src/platform/libmach.zig | 2 ++ 3 files changed, 17 insertions(+), 9 deletions(-) diff --git a/build.zig b/build.zig index 22db5222..774b3de8 100644 --- a/build.zig +++ b/build.zig @@ -39,7 +39,8 @@ pub fn build(b: *std.build.Builder) void { const all_tests_step = b.step("test", "Run library tests"); const glfw_test_step = b.step("test-glfw", "Run GLFW library tests"); const gpu_test_step = b.step("test-gpu", "Run GPU library tests"); - const ecs_test_step = b.step("test-ecs", "Run ECS library tests"); + // TODO(self-hosted) uncomment this + // const ecs_test_step = b.step("test-ecs", "Run ECS library tests"); const freetype_test_step = b.step("test-freetype", "Run Freetype library tests"); const basisu_test_step = b.step("test-basisu", "Run Basis-Universal library tests"); const sysaudio_test_step = b.step("test-sysaudio", "Run sysaudio library tests"); @@ -48,16 +49,20 @@ pub fn build(b: *std.build.Builder) void { glfw_test_step.dependOn(&glfw.testStep(b, mode, target).step); gpu_test_step.dependOn(&gpu.testStep(b, mode, target, options.gpuOptions()).step); freetype_test_step.dependOn(&freetype.testStep(b, mode, target).step); - ecs_test_step.dependOn(&ecs.testStep(b, mode, target).step); - basisu_test_step.dependOn(&basisu.testStep(b, mode, target).step); + // TODO(self-hosted) uncomment this + // ecs_test_step.dependOn(&ecs.testStep(b, mode, target).step); + if (target.isNativeOs()) + basisu_test_step.dependOn(&basisu.testStep(b, mode, target).step); sysaudio_test_step.dependOn(&sysaudio.testStep(b, mode, target).step); mach_test_step.dependOn(&testStep(b, mode, target).step); all_tests_step.dependOn(glfw_test_step); all_tests_step.dependOn(gpu_test_step); - all_tests_step.dependOn(ecs_test_step); + // TODO(self-hosted) uncomment this + // all_tests_step.dependOn(ecs_test_step); + if (target.isNativeOs()) + all_tests_step.dependOn(basisu_test_step); all_tests_step.dependOn(freetype_test_step); - all_tests_step.dependOn(basisu_test_step); all_tests_step.dependOn(sysaudio_test_step); all_tests_step.dependOn(mach_test_step); @@ -85,7 +90,8 @@ pub fn build(b: *std.build.Builder) void { .{ .name = "advanced-gen-texture-light", .packages = &[_]Pkg{Packages.zmath} }, .{ .name = "fractal-cube", .packages = &[_]Pkg{Packages.zmath} }, .{ .name = "textured-cube", .packages = &[_]Pkg{ Packages.zmath, Packages.zigimg }, .has_assets = true }, - .{ .name = "ecs-app", .packages = &[_]Pkg{} }, + // TODO(self-hosted) uncomment this + // .{ .name = "ecs-app", .packages = &[_]Pkg{} }, .{ .name = "image-blur", .packages = &[_]Pkg{Packages.zigimg}, .has_assets = true }, .{ .name = "cubemap", .packages = &[_]Pkg{ Packages.zmath, Packages.zigimg }, .has_assets = true }, .{ .name = "map-async", .packages = &[_]Pkg{} }, diff --git a/libs/gpu-dawn/sdk.zig b/libs/gpu-dawn/sdk.zig index b7540581..52ffee9e 100644 --- a/libs/gpu-dawn/sdk.zig +++ b/libs/gpu-dawn/sdk.zig @@ -169,12 +169,12 @@ pub fn Sdk(comptime deps: anytype) type { } } - fn getGitHubBaseURLOwned(allocator: std.mem.Allocator) []const u8 { + fn getGitHubBaseURLOwned(allocator: std.mem.Allocator) ![]const u8 { if (std.process.getEnvVarOwned(allocator, "MACH_GITHUB_BASE_URL")) |base_url| { std.log.info("mach: respecting MACH_GITHUB_BASE_URL: {s}\n", .{base_url}); return base_url; } else |_| { - return "https://github.com"; + return allocator.dupe(u8, "https://github.com"); } } @@ -330,7 +330,7 @@ pub fn Sdk(comptime deps: anytype) type { // Compose the download URL, e.g.: // https://github.com/hexops/mach-gpu-dawn/releases/download/release-6b59025/libdawn_x86_64-macos-none_debug.a.gz - const github_base_url = getGitHubBaseURLOwned(allocator); + const github_base_url = try getGitHubBaseURLOwned(allocator); defer allocator.free(github_base_url); const lib_prefix = if (is_windows) "dawn_" else "libdawn_"; const lib_ext = if (is_windows) ".lib" else ".a"; diff --git a/src/platform/libmach.zig b/src/platform/libmach.zig index 28c9b269..b4cf25ca 100644 --- a/src/platform/libmach.zig +++ b/src/platform/libmach.zig @@ -7,6 +7,8 @@ const native = @import("native.zig"); pub const App = @This(); +_unused: i32, + pub const GPUInterface = gpu.dawn.Interface; // Dummy init, deinit, and update functions