Dream of my own C compiler

This commit is contained in:
2026-01-19 14:01:40 +01:00
parent b0deb958d2
commit 0b23707041
17 changed files with 1231 additions and 1 deletions

44
packages/cjit/build.zig Normal file
View File

@@ -0,0 +1,44 @@
const std = @import("std");
pub fn build(b: *std.Build) void {
const target = b.standardTargetOptions(.{
.whitelist = &.{
.{
.cpu_arch = .x86_64,
.os_tag = .windows,
.abi = .gnu,
},
.{
.cpu_arch = .x86_64,
.os_tag = .linux,
.abi = .gnu,
},
},
});
const optimize = b.standardOptimizeOption(.{});
const module = b.addModule("cjit", .{
.target = target,
.optimize = optimize,
.root_source_file = b.path("src/root.zig"),
});
const module_internal_test = b.addTest(.{ .root_module = module });
const run_internal_test = b.addRunArtifact(module_internal_test);
const module_external_test = b.addTest(.{
.root_module = b.createModule(.{
.target = b.resolveTargetQuery(.{}),
.optimize = .Debug,
.root_source_file = b.path("test/root.zig"),
.imports = &.{
.{ .name = "cjit", .module = module },
},
}),
});
const run_external_test = b.addRunArtifact(module_external_test);
const step_test = b.step("test", "Run tests");
step_test.dependOn(&run_internal_test.step);
step_test.dependOn(&run_external_test.step);
}