Giter Club home page Giter Club logo

Comments (2)

ikskuh avatar ikskuh commented on August 28, 2024 1

Can you PR that patch? all my libraries track master with more or less delay

from ini.

McSinyx avatar McSinyx commented on August 28, 2024

Please see ziglang/zig#14498

I'm not sure what Zig version(s) this library is supposed to target,
but for future reference, the following patch should would for current master:

diff --git a/build.zig b/build.zig
index a168b42d1111..2352797f092e 100644
--- a/build.zig
+++ b/build.zig
@@ -1,36 +1,51 @@
 const std = @import("std");
 
 pub fn build(b: *std.build.Builder) void {
-    const mode = b.standardReleaseOptions();
+    const optimize = b.standardOptimizeOption(.{});
 
-    const lib = b.addStaticLibrary("ini", "src/lib.zig");
+    const lib = b.addStaticLibrary(.{
+        .name = "ini",
+        .root_source_file = .{ .path = "src/lib.zig" },
+        .target = b.standardTargetOptions(.{}),
+        .optimize = optimize,
+    });
     lib.bundle_compiler_rt = true;
     lib.addIncludePath("src");
     lib.linkLibC();
-    lib.setBuildMode(mode);
     lib.install();
 
-    const example_c = b.addExecutable("example-c", null);
+    const example_c = b.addExecutable(.{
+        .name = "example-c",
+        .optimize = optimize,
+    });
     example_c.addCSourceFile("example/example.c", &[_][]const u8{ "-Wall", "-Wextra", "-pedantic" });
     example_c.addIncludePath("src");
     example_c.linkLibrary(lib);
     example_c.linkLibC();
-    example_c.setBuildMode(mode);
     example_c.install();
 
-    const example_zig = b.addExecutable("example-zig", "example/example.zig");
-    example_zig.addPackagePath("ini", "src/ini.zig");
-    example_zig.setBuildMode(mode);
+    const example_zig = b.addExecutable(.{
+        .name = "example-zig",
+        .root_source_file = .{ .path = "example/example.zig" },
+        .optimize = optimize,
+    });
+    example_zig.addAnonymousModule("ini", .{
+        .source_file = .{ .path = "src/ini.zig" },
+    });
     example_zig.install();
 
-    var main_tests = b.addTest("src/test.zig");
-    main_tests.setBuildMode(mode);
+    var main_tests = b.addTest(.{
+        .root_source_file = .{ .path = "src/test.zig" },
+        .optimize = optimize,
+    });
 
-    var binding_tests = b.addTest("src/lib-test.zig");
+    var binding_tests = b.addTest(.{
+        .root_source_file = .{ .path = "src/lib-test.zig" },
+        .optimize = optimize,
+    });
     binding_tests.addIncludePath("src");
     binding_tests.linkLibrary(lib);
     binding_tests.linkLibC();
-    binding_tests.setBuildMode(mode);
 
     const test_step = b.step("test", "Run library tests");
     test_step.dependOn(&main_tests.step);

from ini.

Related Issues (2)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.