Updated the source for master
This commit is contained in:
parent
2fe3d6cb3f
commit
e7e0927a83
7 changed files with 30 additions and 23 deletions
39
build.zig
39
build.zig
|
|
@ -6,12 +6,16 @@ pub fn build(b: *std.Build) void {
|
||||||
const target = b.standardTargetOptions(.{});
|
const target = b.standardTargetOptions(.{});
|
||||||
const optimize = b.standardOptimizeOption(.{});
|
const optimize = b.standardOptimizeOption(.{});
|
||||||
|
|
||||||
const glfw = b.addStaticLibrary(.{
|
const glfw_module = b.createModule(.{
|
||||||
.name = "glfw",
|
|
||||||
.target = target,
|
.target = target,
|
||||||
.optimize = optimize,
|
.optimize = optimize,
|
||||||
|
.link_libc = true,
|
||||||
});
|
});
|
||||||
glfw.addCSourceFiles(.{ .files = &[_][]const u8{
|
const glfw = b.addLibrary(.{
|
||||||
|
.name = "glfw",
|
||||||
|
.root_module = glfw_module,
|
||||||
|
});
|
||||||
|
glfw_module.addCSourceFiles(.{ .files = &[_][]const u8{
|
||||||
"ext/glfw/src/cocoa_init.m",
|
"ext/glfw/src/cocoa_init.m",
|
||||||
"ext/glfw/src/cocoa_joystick.m",
|
"ext/glfw/src/cocoa_joystick.m",
|
||||||
"ext/glfw/src/cocoa_monitor.m",
|
"ext/glfw/src/cocoa_monitor.m",
|
||||||
|
|
@ -53,29 +57,28 @@ pub fn build(b: *std.Build) void {
|
||||||
"ext/glfw/src/x11_window.c",
|
"ext/glfw/src/x11_window.c",
|
||||||
"ext/glfw/src/xkb_unicode.c",
|
"ext/glfw/src/xkb_unicode.c",
|
||||||
}, .flags = &[_][]const u8{ "-D_GLFW_X11", "-Wall", "-Wextra" } });
|
}, .flags = &[_][]const u8{ "-D_GLFW_X11", "-Wall", "-Wextra" } });
|
||||||
glfw.linkLibC();
|
|
||||||
|
|
||||||
const sideros = b.addModule("sideros", .{
|
const sideros = b.createModule(.{
|
||||||
.root_source_file = b.path("src/sideros.zig"),
|
.root_source_file = b.path("src/sideros.zig"),
|
||||||
.target = target,
|
.target = target,
|
||||||
.optimize = optimize,
|
.optimize = optimize,
|
||||||
});
|
});
|
||||||
|
|
||||||
const mods = b.addModule("mods", .{
|
const mods = b.createModule(.{
|
||||||
.root_source_file = b.path("src/mods/mods.zig"),
|
.root_source_file = b.path("src/mods/mods.zig"),
|
||||||
.target = target,
|
.target = target,
|
||||||
.optimize = optimize,
|
.optimize = optimize,
|
||||||
});
|
});
|
||||||
mods.addImport("sideros", sideros);
|
mods.addImport("sideros", sideros);
|
||||||
|
|
||||||
const ecs = b.addModule("ecs", .{
|
const ecs = b.createModule(.{
|
||||||
.root_source_file = b.path("src/ecs/ecs.zig"),
|
.root_source_file = b.path("src/ecs/ecs.zig"),
|
||||||
.target = target,
|
.target = target,
|
||||||
.optimize = optimize,
|
.optimize = optimize,
|
||||||
});
|
});
|
||||||
ecs.addImport("sideros", sideros);
|
ecs.addImport("sideros", sideros);
|
||||||
|
|
||||||
const renderer = b.addModule("renderer", .{
|
const renderer = b.createModule(.{
|
||||||
.root_source_file = b.path("src/renderer/Renderer.zig"),
|
.root_source_file = b.path("src/renderer/Renderer.zig"),
|
||||||
.target = target,
|
.target = target,
|
||||||
.optimize = optimize,
|
.optimize = optimize,
|
||||||
|
|
@ -88,10 +91,12 @@ pub fn build(b: *std.Build) void {
|
||||||
compileAllShaders(b, renderer);
|
compileAllShaders(b, renderer);
|
||||||
|
|
||||||
const exe = b.addExecutable(.{
|
const exe = b.addExecutable(.{
|
||||||
.root_source_file = b.path("src/main.zig"),
|
|
||||||
.target = target,
|
|
||||||
.optimize = optimize,
|
|
||||||
.name = "sideros",
|
.name = "sideros",
|
||||||
|
.root_module = b.createModule(.{
|
||||||
|
.root_source_file = b.path("src/main.zig"),
|
||||||
|
.target = target,
|
||||||
|
.optimize = optimize,
|
||||||
|
}),
|
||||||
});
|
});
|
||||||
exe.root_module.addImport("mods", mods);
|
exe.root_module.addImport("mods", mods);
|
||||||
exe.root_module.addImport("sideros", sideros);
|
exe.root_module.addImport("sideros", sideros);
|
||||||
|
|
@ -114,7 +119,7 @@ pub fn build(b: *std.Build) void {
|
||||||
docs_step.dependOn(&install_docs.step);
|
docs_step.dependOn(&install_docs.step);
|
||||||
|
|
||||||
// NOTE: This is a hack to generate documentation
|
// NOTE: This is a hack to generate documentation
|
||||||
const mods_lib = b.addStaticLibrary(.{
|
const mods_lib = b.addLibrary(.{
|
||||||
.root_module = mods,
|
.root_module = mods,
|
||||||
.name = "mods",
|
.name = "mods",
|
||||||
});
|
});
|
||||||
|
|
@ -126,7 +131,7 @@ pub fn build(b: *std.Build) void {
|
||||||
});
|
});
|
||||||
docs_step.dependOn(&mods_docs.step);
|
docs_step.dependOn(&mods_docs.step);
|
||||||
|
|
||||||
const ecs_lib = b.addStaticLibrary(.{
|
const ecs_lib = b.addLibrary(.{
|
||||||
.root_module = ecs,
|
.root_module = ecs,
|
||||||
.name = "ecs",
|
.name = "ecs",
|
||||||
});
|
});
|
||||||
|
|
@ -148,9 +153,11 @@ pub fn build(b: *std.Build) void {
|
||||||
run_step.dependOn(&run_cmd.step);
|
run_step.dependOn(&run_cmd.step);
|
||||||
|
|
||||||
const exe_unit_tests = b.addTest(.{
|
const exe_unit_tests = b.addTest(.{
|
||||||
.root_source_file = b.path("src/main.zig"),
|
.root_module = b.createModule(.{
|
||||||
.target = target,
|
.root_source_file = b.path("src/main.zig"),
|
||||||
.optimize = optimize,
|
.target = target,
|
||||||
|
.optimize = optimize,
|
||||||
|
}),
|
||||||
});
|
});
|
||||||
|
|
||||||
const run_exe_unit_tests = b.addRunArtifact(exe_unit_tests);
|
const run_exe_unit_tests = b.addRunArtifact(exe_unit_tests);
|
||||||
|
|
|
||||||
|
|
@ -490,8 +490,8 @@ fn parseCode(self: *Parser) !Func {
|
||||||
}
|
}
|
||||||
|
|
||||||
const ir = try IR.parse(self);
|
const ir = try IR.parse(self);
|
||||||
const stdout = std.io.getStdOut().writer();
|
// const stdout = std.fs.File.stdout().writer();
|
||||||
try ir.print(stdout);
|
// try ir.print(stdout);
|
||||||
|
|
||||||
const func = Func{
|
const func = Func{
|
||||||
.locals = try self.allocator.alloc(vm.Valtype, local_count),
|
.locals = try self.allocator.alloc(vm.Valtype, local_count),
|
||||||
|
|
|
||||||
|
|
@ -120,7 +120,7 @@ pub const Runtime = struct {
|
||||||
// Like this
|
// Like this
|
||||||
.@"unreachable" => {
|
.@"unreachable" => {
|
||||||
std.log.err("Reached unreachable statement at IR counter {any}\n", .{frame.program_counter});
|
std.log.err("Reached unreachable statement at IR counter {any}\n", .{frame.program_counter});
|
||||||
frame.code.print(std.io.getStdOut().writer()) catch {};
|
//frame.code.print(std.io.getStdOut().writer()) catch {};
|
||||||
},
|
},
|
||||||
.nop => {},
|
.nop => {},
|
||||||
.br => {
|
.br => {
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
const c = @import("c.zig");
|
const c = @import("c.zig").c;
|
||||||
const std = @import("std");
|
const std = @import("std");
|
||||||
const vk = @import("vulkan.zig");
|
const vk = @import("vulkan.zig");
|
||||||
const gltf = @import("gltf.zig");
|
const gltf = @import("gltf.zig");
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
const c = @import("c.zig");
|
const c = @import("c.zig").c;
|
||||||
const ecs = @import("ecs");
|
const ecs = @import("ecs");
|
||||||
const std = @import("std");
|
const std = @import("std");
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
pub usingnamespace @cImport({
|
pub const c = @cImport({
|
||||||
@cDefine("GLFW_INCLUDE_NONE", {});
|
@cDefine("GLFW_INCLUDE_NONE", {});
|
||||||
@cInclude("vulkan/vulkan.h");
|
@cInclude("vulkan/vulkan.h");
|
||||||
@cInclude("GLFW/glfw3.h");
|
@cInclude("GLFW/glfw3.h");
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
const std = @import("std");
|
const std = @import("std");
|
||||||
const c = @import("c.zig");
|
const c = @import("c.zig").c;
|
||||||
const Window = @import("Window.zig");
|
const Window = @import("Window.zig");
|
||||||
const Mesh = @import("Mesh.zig");
|
const Mesh = @import("Mesh.zig");
|
||||||
const sideros = @import("sideros");
|
const sideros = @import("sideros");
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue