Commit 4efeeaac88
test/link/static_lib_as_system_lib/a.c
@@ -1,4 +0,0 @@
-#include "a.h"
-int32_t add(int32_t a, int32_t b) {
- return a + b;
-}
test/link/static_lib_as_system_lib/a.h
@@ -1,2 +0,0 @@
-#include <stdint.h>
-int32_t add(int32_t a, int32_t b);
test/link/static_lib_as_system_lib/build.zig
@@ -1,34 +0,0 @@
-const std = @import("std");
-
-pub fn build(b: *std.Build) void {
- const test_step = b.step("test", "Test it");
- b.default_step = test_step;
-
- add(b, test_step, .Debug);
- add(b, test_step, .ReleaseFast);
- add(b, test_step, .ReleaseSmall);
- add(b, test_step, .ReleaseSafe);
-}
-
-fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.OptimizeMode) void {
- const lib_a = b.addStaticLibrary(.{
- .name = "a",
- .optimize = optimize,
- .target = .{},
- });
- lib_a.addCSourceFile("a.c", &[_][]const u8{});
- lib_a.addIncludePath(".");
- lib_a.install();
-
- const test_exe = b.addTest(.{
- .root_source_file = .{ .path = "main.zig" },
- .optimize = optimize,
- .target = .{},
- });
- test_exe.linkSystemLibrary("a"); // force linking liba.a as -la
- test_exe.addSystemIncludePath(".");
- const search_path = std.fs.path.join(b.allocator, &[_][]const u8{ b.install_path, "lib" }) catch @panic("OOM");
- test_exe.addLibraryPath(search_path);
-
- test_step.dependOn(&test_exe.step);
-}
test/link/static_lib_as_system_lib/main.zig
@@ -1,8 +0,0 @@
-const std = @import("std");
-const expect = std.testing.expect;
-const c = @cImport(@cInclude("a.h"));
-
-test "import C add" {
- const result = c.add(2, 1);
- try expect(result == 3);
-}
test/link.zig
@@ -20,10 +20,6 @@ pub const cases = [_]Case{
.build_root = "test/link/interdependent_static_c_libs",
.import = @import("link/interdependent_static_c_libs/build.zig"),
},
- //.{
- // .build_root = "test/link/static_lib_as_system_lib",
- // .import = @import("link/static_lib_as_system_lib/build.zig"),
- //},
};
//pub fn addCases(cases: *Standalone) void {