Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
/target
.DS_Store

.zig-cache
zig-out
14 changes: 14 additions & 0 deletions core-library/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Core Library

## Run tests

```
zig build test --summary all
```


## Build

```
zig build
```
44 changes: 44 additions & 0 deletions core-library/build.zig
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
const std = @import("std");

pub fn build(b: *std.Build) void {
const optimize = b.standardOptimizeOption(.{});
const target = b.standardTargetOptions(.{ .default_target = .{ .ofmt = .c } });

// Core Library
//
const libcore = b.addStaticLibrary(.{
.name = "core",
.root_source_file = b.path("src/root.zig"),
.target = target,
.optimize = optimize,
.link_libc = true,
});
libcore.addIncludePath(b.path("src/includes"));
libcore.addCSourceFile(.{
.file = b.path("src/includes/wrapper.c"),
.flags = &.{"-Wall"},
});
b.installArtifact(libcore);
b.installFile("src/includes/wrapper.c", "lib/wrapper.c");
b.installFile("src/includes/valgrind.h", "lib/valgrind.h");
b.installFile("src/includes/callgrind.h", "lib/callgrind.h");
b.installFile("src/includes/core.h", "lib/core.h");
// TODO: Copy zig.h

// Tests
//
const test_main = b.addTest(.{
.root_source_file = b.path("src/root.zig"),
.optimize = optimize,
.link_libc = true,
.test_runner = b.path("src/test_main.zig")
});
test_main.linkLibC();
test_main.addIncludePath(b.path("src/includes"));
test_main.addCSourceFile(.{
.file = b.path("src/includes/wrapper.c"),
.flags = &.{"-Wall"},
});
const run_test_main = b.addRunArtifact(test_main);
b.step("test", "test utility functions").dependOn(&run_test_main.step);
}
11 changes: 11 additions & 0 deletions core-library/build.zig.zon
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
.{
.name = "core",
.fingerprint = 0x6b8d854f40550aa0,
.version = "0.0.1",
.dependencies = .{},
.paths = .{
"build.zig",
"build.zig.zon",
"src",
},
}
Loading
Loading