zig: scaffold build system with build.zig.zon and build.zig
Swadhin Biswas committed 7 months ago
2028438
1 parent 301f4dd
commit 2028438
3 files changed
+64 -0
Showing 3 changed files+64-0
▼ZIG/LICENSE
+21-0
| @@ -0,0 +1,21 @@ | ||
1 | +MIT License | |
2 | + | |
3 | +Copyright (c) 2025 Swadhin Biswas | |
4 | + | |
5 | +Permission is hereby granted, free of charge, to any person obtaining a copy | |
6 | +of this software and associated documentation files (the "Software"), to deal | |
7 | +in the Software without restriction, including without limitation the rights | |
8 | +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
9 | +copies of the Software, and to permit persons to whom the Software is | |
10 | +furnished to do so, subject to the following conditions: | |
11 | + | |
12 | +The above copyright notice and this permission notice shall be included in all | |
13 | +copies or substantial portions of the Software. | |
14 | + | |
15 | +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |
16 | +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |
17 | +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | |
18 | +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | |
19 | +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | |
20 | +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | |
21 | +SOFTWARE. | |
0 | 22 | |
▼ZIG/build.zig
+29-0
| @@ -0,0 +1,29 @@ | ||
1 | +const std = @import("std"); | |
2 | + | |
3 | +pub fn build(b: *std.Build) void { | |
4 | + const target = b.standardTargetOptions(.{}); | |
5 | + const optimize = b.standardOptimizeOption(.{}); | |
6 | + | |
7 | + // Module (for use as a dependency by consumers) | |
8 | + const mod = b.addModule("contexa", .{ | |
9 | + .root_source_file = b.path("src/main.zig"), | |
10 | + .target = target, | |
11 | + .optimize = optimize, | |
12 | + }); | |
13 | + | |
14 | + // Static library artifact | |
15 | + const lib = b.addLibrary(.{ | |
16 | + .name = "contexa", | |
17 | + .root_module = mod, | |
18 | + }); | |
19 | + b.installArtifact(lib); | |
20 | + | |
21 | + // Unit tests | |
22 | + const unit_tests = b.addTest(.{ | |
23 | + .root_module = mod, | |
24 | + }); | |
25 | + | |
26 | + const run_unit_tests = b.addRunArtifact(unit_tests); | |
27 | + const test_step = b.step("test", "Run unit tests"); | |
28 | + test_step.dependOn(&run_unit_tests.step); | |
29 | +} | |
0 | 30 | |
▼ZIG/build.zig.zon
+14-0
| @@ -0,0 +1,14 @@ | ||
1 | +.{ | |
2 | + .name = .contexa, | |
3 | + .version = "0.1.1", | |
4 | + .fingerprint = 0x8f806195fce1319f, | |
5 | + .minimum_zig_version = "0.14.0", | |
6 | + .dependencies = .{}, | |
7 | + .paths = .{ | |
8 | + "build.zig", | |
9 | + "build.zig.zon", | |
10 | + "src", | |
11 | + "LICENSE", | |
12 | + "README.md", | |
13 | + }, | |
14 | +} | |
0 | 15 | |