various: add admin build; various layout improvements
Signed-off-by: NotAShelf <raf@notashelf.dev> Change-Id: Ieaa99fa0a32b42b1e97aada611d809b96a6a6964
This commit is contained in:
parent
d8b49054d5
commit
514a9560a2
9 changed files with 856 additions and 201 deletions
19
build.zig
19
build.zig
|
|
@ -3,13 +3,22 @@ const std = @import("std");
|
|||
pub fn build(b: *std.Build) void {
|
||||
const target = b.standardTargetOptions(.{});
|
||||
const optimize = b.standardOptimizeOption(.{});
|
||||
const admin_controls = b.option(bool, "admin-controls", "Enable in-game development admin controls") orelse false;
|
||||
|
||||
const c_flags = [_][]const u8{
|
||||
const base_c_flags = [_][]const u8{
|
||||
"-std=c99",
|
||||
"-Wall",
|
||||
"-Wextra",
|
||||
"-O2",
|
||||
};
|
||||
const admin_c_flags = [_][]const u8{
|
||||
"-std=c99",
|
||||
"-Wall",
|
||||
"-Wextra",
|
||||
"-O2",
|
||||
"-DROGGED_ADMIN_CONTROLS=1",
|
||||
};
|
||||
const c_flags = if (admin_controls) &admin_c_flags else &base_c_flags;
|
||||
|
||||
// RNG library
|
||||
const rng_lib = b.addLibrary(.{
|
||||
|
|
@ -22,7 +31,7 @@ pub fn build(b: *std.Build) void {
|
|||
});
|
||||
rng_lib.addCSourceFiles(.{
|
||||
.files = &[_][]const u8{"libs/rng/rng.c"},
|
||||
.flags = &c_flags,
|
||||
.flags = c_flags,
|
||||
});
|
||||
rng_lib.addIncludePath(b.path("libs/rng"));
|
||||
|
||||
|
|
@ -40,7 +49,7 @@ pub fn build(b: *std.Build) void {
|
|||
"libs/map/map.c",
|
||||
"libs/map/utils.c",
|
||||
},
|
||||
.flags = &c_flags,
|
||||
.flags = c_flags,
|
||||
});
|
||||
// map.h includes common.h and settings.h which live in src/
|
||||
map_lib.addIncludePath(b.path("src"));
|
||||
|
|
@ -63,7 +72,7 @@ pub fn build(b: *std.Build) void {
|
|||
"libs/tileset/tileset.c",
|
||||
"libs/tileset/tileset_paint.c",
|
||||
},
|
||||
.flags = &c_flags,
|
||||
.flags = c_flags,
|
||||
});
|
||||
// tileset.h includes settings.h which lives in src/
|
||||
tileset_obj.addIncludePath(b.path("src"));
|
||||
|
|
@ -111,7 +120,7 @@ pub fn build(b: *std.Build) void {
|
|||
|
||||
exe.addCSourceFiles(.{
|
||||
.files = &c_sources,
|
||||
.flags = &c_flags,
|
||||
.flags = c_flags,
|
||||
});
|
||||
|
||||
// src/ for own headers; libs/ so "rng/rng.h" and "map/map.h" resolve
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue