Skip to content

Commit b4de573

Browse files
committed
Zig 0.15.1
1 parent e6ff086 commit b4de573

File tree

262 files changed

+19730
-9884
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

262 files changed

+19730
-9884
lines changed

.github/workflows/test.yaml

Lines changed: 2 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -29,17 +29,9 @@ jobs:
2929
steps:
3030
- name: Checkout
3131
uses: actions/checkout@v4
32-
33-
- name: Read .zig-version
34-
id: zigversion
35-
uses: juliangruber/read-file-action@v1
36-
with:
37-
path: ./.zigversion
3832
- name: Install Zig
3933
uses: mlugg/setup-zig@v2
40-
with:
41-
version: ${{ steps.zigversion.outputs.content }}
42-
34+
4335
- name: Lint
4436
run: zig fmt --check . --exclude externals/
4537

@@ -76,17 +68,9 @@ jobs:
7668
# kcov --version
7769
7870
#- uses: Schleifner/github-coredump@v1
79-
80-
- name: Read .zig-version
81-
id: zigversion
82-
uses: juliangruber/read-file-action@v1
83-
with:
84-
path: ./.zigversion
71+
8572
- name: Install Zig
8673
uses: mlugg/setup-zig@v2
87-
with:
88-
version: ${{ steps.zigversion.outputs.content }}
89-
9074
- name: Build
9175
run: .ci/build.sh x86_64-linux Debug
9276

@@ -147,16 +131,8 @@ jobs:
147131
# brew update
148132
# brew install kcov
149133

150-
- name: Read .zig-version
151-
id: zigversion
152-
uses: juliangruber/read-file-action@v1
153-
with:
154-
path: ./.zigversion
155134
- name: Install Zig
156135
uses: mlugg/setup-zig@v2
157-
with:
158-
version: ${{ steps.zigversion.outputs.content }}
159-
160136
- name: Build
161137
run: .ci/build.sh x86_64-macos Debug
162138

@@ -200,15 +176,8 @@ jobs:
200176
- name: Checkout
201177
uses: actions/checkout@v4
202178

203-
- name: Read .zig-version
204-
id: zigversion
205-
uses: juliangruber/read-file-action@v1
206-
with:
207-
path: ./.zigversion
208179
- name: Install Zig
209180
uses: mlugg/setup-zig@v2
210-
with:
211-
version: ${{ steps.zigversion.outputs.content }}
212181

213182
- name: Build
214183
shell: bash

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,6 @@
3434
[submodule "externals/shared/repo/znfde"]
3535
path = externals/shared/repo/znfde
3636
url = https://github.com/cyberegoorg/znfde.git
37+
[submodule "externals/shared/repo/tracy"]
38+
path = externals/shared/repo/tracy
39+
url = https://github.com/wolfpld/tracy.git

.zigversion

Lines changed: 0 additions & 1 deletion
This file was deleted.

build.zig

Lines changed: 28 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ const builtin = @import("builtin");
33

44
pub const generate_ide = @import("src/tools/generate_ide.zig");
55

6-
const min_zig_version = std.SemanticVersion.parse("0.14.0") catch @panic("Where is .zigversion?");
6+
const min_zig_version = std.SemanticVersion.parse("0.15.1") catch @panic("Where is .zigversion?");
77
const cetech1_version = std.SemanticVersion.parse(@embedFile(".version")) catch @panic("Where is .version?");
88

99
pub fn useSystemSDK(b: *std.Build, target: std.Build.ResolvedTarget, e: *std.Build.Step.Compile) void {
@@ -129,9 +129,12 @@ pub fn createKernelExe(
129129
const exe = b.addExecutable(.{
130130
.name = bin_name,
131131
.version = versionn,
132-
.root_source_file = runner_main,
133-
.target = target,
134-
.optimize = optimize,
132+
.root_module = b.createModule(.{
133+
.root_source_file = runner_main,
134+
.target = target,
135+
.optimize = optimize,
136+
}),
137+
.use_llvm = true,
135138
});
136139
exe.linkLibC();
137140
exe.root_module.addImport("kernel", cetech1_kernel);
@@ -246,6 +249,7 @@ pub fn build(b: *std.Build) !void {
246249
.with_node_editor = true,
247250
.with_te = true,
248251
.with_freetype = options.with_freetype,
252+
// .disable_obsolete = false
249253
},
250254
);
251255

@@ -289,20 +293,26 @@ pub fn build(b: *std.Build) !void {
289293

290294
const generate_static_tool = b.addExecutable(.{
291295
.name = "generate_static",
292-
.root_source_file = b.path("src/tools/generate_static.zig"),
293-
.target = b.graph.host,
296+
.root_module = b.createModule(.{
297+
.root_source_file = b.path("src/tools/generate_static.zig"),
298+
.target = b.graph.host,
299+
}),
294300
});
295301

296302
const generate_externals_tool = b.addExecutable(.{
297303
.name = "generate_externals",
298-
.root_source_file = b.path("src/tools/generate_externals.zig"),
299-
.target = b.graph.host,
304+
.root_module = b.createModule(.{
305+
.root_source_file = b.path("src/tools/generate_externals.zig"),
306+
.target = b.graph.host,
307+
}),
300308
});
301309

302310
const generate_ide_tool = b.addExecutable(.{
303311
.name = "generate_ide",
304-
.root_source_file = b.path("src/tools/generate_ide.zig"),
305-
.target = b.graph.host,
312+
.root_module = b.createModule(.{
313+
.root_source_file = b.path("src/tools/generate_ide.zig"),
314+
.target = b.graph.host,
315+
}),
306316
});
307317
b.installArtifact(generate_ide_tool);
308318

@@ -452,7 +462,6 @@ pub fn build(b: *std.Build) !void {
452462
.name = "gamecontrollerdb",
453463
.module = b.createModule(.{ .root_source_file = b.path("externals/shared/lib/SDL_GameControllerDB/gamecontrollerdb.txt") }),
454464
},
455-
.{ .name = "authors", .module = b.createModule(.{ .root_source_file = b.path("externals/shared/lib/SDL_GameControllerDB/gamecontrollerdb.txt") }) },
456465
.{
457466
.name = "fa-solid-900",
458467
.module = b.createModule(.{ .root_source_file = b.path("externals/shared/fonts/fa-solid-900.ttf") }),
@@ -466,12 +475,15 @@ pub fn build(b: *std.Build) !void {
466475
//
467476
// CETech1 kernel lib
468477
//
469-
const kernel_lib = b.addStaticLibrary(.{
478+
const kernel_lib = b.addLibrary(.{
479+
.linkage = .static,
470480
.name = "cetech1_kernel",
471481
.version = cetech1_version,
472-
.root_source_file = b.path("src/private.zig"),
473-
.target = target,
474-
.optimize = optimize,
482+
.root_module = b.createModule(.{
483+
.root_source_file = b.path("src/private.zig"),
484+
.target = target,
485+
.optimize = optimize,
486+
}),
475487
});
476488
useSystemSDK(b, target, kernel_lib);
477489
b.installArtifact(kernel_lib);
@@ -513,15 +525,13 @@ pub fn build(b: *std.Build) !void {
513525
//
514526
const tests = b.addTest(.{
515527
.name = "cetech1_test",
516-
.version = cetech1_version,
517528
.root_module = b.createModule(.{
518529
.root_source_file = b.path("src/tests.zig"),
519530
.target = target,
520531
.optimize = optimize,
521532
.imports = &imports,
522533
}),
523-
.target = target,
524-
.optimize = optimize,
534+
.use_llvm = true,
525535
});
526536
useSystemSDK(b, target, tests);
527537
b.installArtifact(tests);

build.zig.zon

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
.{
22
.name = .cetech1_kernel,
33
.version = "0.1.0",
4-
.minimum_zig_version = "0.14.1",
4+
.minimum_zig_version = "0.15.1",
55
.fingerprint = 0x999557f3ebfaa97a,
66
.paths = .{
77
"docs",

docs/topics/getting-started.md

Lines changed: 40 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,14 @@
2323

2424
## Get ZIG
2525

26-
Get ZIG `0.14.0`.
26+
Get ZIG `0.15.1`.
2727

2828
<tabs>
2929
<tab title="ZVM">
3030
Get <a href="https://www.zvm.app">ZVM</a>
3131
<code-block lang="bash">
3232
# zvm vmu zig mach - only for mach versions
33-
zvm i 0.14.0
33+
zvm i 0.15.1
3434
</code-block>
3535
</tab>
3636
</tabs>
@@ -84,18 +84,22 @@ Get ZIG `0.14.0`.
8484
> Bool arguments does not need value 1 for true value. ex.: `--fullscreen` is equal `--fullscreen 1`
8585
> {style="note"}
8686
87-
| Args | Value | Default | Description |
88-
|--------------------------|--------------------------------|---------|---------------------------------------------|
89-
| `--load-dynamic` | `1` or `0` | `1` | Load dynamic modules? |
90-
| `--max-kernel-tick` | `n` | `null` | Quit after kernel make n ticks. |
91-
| `--max-kernel-tick-rate` | `n` | `60` | Kernel frame rate. |
92-
| `--headless` | `1` or `0` | `0` | Without creating real window. |
93-
| `--asset-root` | `str` | `null` | Path to asset root. (project path) |
94-
| `--fullscreen` | `1` or `0` | `0` | Force full-screen mode, nice for SteamDeck. |
95-
| `--test-ui` | `1` or `0` | `0` | Run UI tests and quit. |
96-
| `--test-ui-filter` | `str` | `all` | Run only ui tests that pass this filter. |
97-
| `--test-ui-speed` | `fast`, `normal`, `cinematic` | `fast` | UI test speed. |
98-
| `--test-ui-junit` | `str` | `null` | UI test JUnit result filename. |
87+
| Args | Value | Default | Description |
88+
|--------------------------|--------------------------------|-----------|---------------------------------------------|
89+
| `--load-dynamic` | `1` or `0` | `1` | Load dynamic modules? |
90+
| `--max-kernel-tick` | `n` | `null` | Quit after kernel make n ticks. |
91+
| `--max-kernel-tick-rate` | `n` | `60` | Kernel frame rate. |
92+
| `--headless` | `1` or `0` | `0` | Without creating real window. |
93+
| `--asset-root` | `str` | `null` | Path to asset root. (project path) |
94+
| `--renderer-debug` | `1` or `0` | `0` | Render backed debug. (shaders) |
95+
| `--renderer-profile` | `1` or `0` | `0` | Render backed profile. (shaders) |
96+
| `--vsync` | `1` or `0` | `0` | Vsync. |
97+
| `--fullscreen` | `1` or `0` | `0` | Force full-screen mode, nice for SteamDeck. |
98+
| `--worker-count` | number | cpu count | Max threads for task system. |
99+
| `--test-ui` | `1` or `0` | `0` | Run UI tests and quit. |
100+
| `--test-ui-filter` | `str` | `all` | Run only ui tests that pass this filter. |
101+
| `--test-ui-speed` | `fast`, `normal`, `cinematic` | `fast` | UI test speed. |
102+
| `--test-ui-junit` | `str` | `null` | UI test JUnit result filename. |
99103

100104
## ZLS
101105

@@ -154,23 +158,41 @@ Need [zigbrains](https://plugins.jetbrains.com/plugin/22456-zigbrains)
154158

155159
## Tracy profiler
156160

157-
CETech1 has builtin support for tracy profiler.
161+
CETech1 has builtin support for tracy profiler and provide Tracy as submodule, but you must build it first.
158162

159163
> For more details go to [tracy](https://github.com/wolfpld/tracy) repository.
160164
165+
<tabs>
166+
<tab title="MacOS/Linux">
167+
<code-block lang="bash">
168+
git submodule update --init externals/shared/repo/tracy
169+
cd externals/shared/repo/tracy
170+
cmake -B profiler/build -S profiler -DCMAKE_BUILD_TYPE=Release
171+
make -C profiler/build
172+
</code-block>
173+
</tab>
174+
<tab title="Windows">
175+
<code-block lang="bash">
176+
git submodule update --init externals/shared/repo/tracy
177+
cd externals/shared/repo/tracy
178+
cmake -B profiler/build -S profiler -DCMAKE_BUILD_TYPE=Release
179+
make -C profiler/build
180+
</code-block>
181+
</tab>
182+
</tabs>
183+
161184
<tabs>
162185
<tab title="MacOS">
163186
<code-block lang="bash">
164-
brew install tracy
165-
tracy -a localhost
187+
profiler/build/tracy-profiler -a localhost
166188
zig-out/bin/cetech1 # on separate terminal
167189
# Have fun
168190
</code-block>
169191
</tab>
170192
<tab title="Linux">
171193
<code-block lang="bash">
172194
# install tracy by your way
173-
tracy -a localhost
195+
profiler/build/tracy-profiler -a localhost
174196
zig-out/bin/cetech1 # on separate terminal
175197
# Have fun
176198
</code-block>

examples/editor_foo_tab/src/private.zig

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,21 +69,21 @@ var foo_tab = editor.TabTypeI.implement(editor.TabTypeIArgs{
6969

7070
// Destroy tab instantce
7171
pub fn destroy(tab_inst: *editor.TabI) !void {
72-
const tab_o: *FooTab = @alignCast(@ptrCast(tab_inst.inst));
72+
const tab_o: *FooTab = @ptrCast(@alignCast(tab_inst.inst));
7373
_allocator.destroy(tab_o);
7474
}
7575

7676
// Draw tab content
7777
pub fn ui(inst: *editor.TabO, kernel_tick: u64, dt: f32) !void {
7878
_ = kernel_tick; // autofix
7979
_ = dt; // autofix
80-
const tab_o: *FooTab = @alignCast(@ptrCast(inst));
80+
const tab_o: *FooTab = @ptrCast(@alignCast(inst));
8181
_ = tab_o;
8282
}
8383

8484
// Draw tab menu
8585
pub fn menu(inst: *editor.TabO) !void {
86-
const tab_o: *FooTab = @alignCast(@ptrCast(inst));
86+
const tab_o: *FooTab = @ptrCast(@alignCast(inst));
8787
_ = tab_o;
8888
if (_coreui.beginMenu(_allocator, "foo", true, null)) {
8989
defer _coreui.endMenu();
@@ -120,6 +120,6 @@ pub fn load_module_zig(apidb: *const cetech1.apidb.ApiDbAPI, allocator: Allocato
120120
}
121121

122122
// This is only one fce that cetech1 need to load/unload/reload module.
123-
pub export fn ct_load_module_editor_foo_tab(apidb: *const cetech1.apidb.ApiDbAPI, allocator: *const std.mem.Allocator, load: bool, reload: bool) callconv(.C) bool {
123+
pub export fn ct_load_module_editor_foo_tab(apidb: *const cetech1.apidb.ApiDbAPI, allocator: *const std.mem.Allocator, load: bool, reload: bool) callconv(.c) bool {
124124
return cetech1.modules.loadModuleZigHelper(load_module_zig, module_name, apidb, allocator, load, reload);
125125
}

examples/editor_foo_viewport_tab/src/private.zig

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ var foo_tab = editor.TabTypeI.implement(editor.TabTypeIArgs{
243243

244244
// Destroy tab instantce
245245
pub fn destroy(tab_inst: *editor.TabI) !void {
246-
const tab_o: *FooViewportTab = @alignCast(@ptrCast(tab_inst.inst));
246+
const tab_o: *FooViewportTab = @ptrCast(@alignCast(tab_inst.inst));
247247
_render_viewport.destroyViewport(tab_o.viewport);
248248
tab_o.render_pipeline.deinit();
249249
_ecs.destroyWorld(tab_o.world);
@@ -254,16 +254,14 @@ var foo_tab = editor.TabTypeI.implement(editor.TabTypeIArgs{
254254
pub fn ui(inst: *editor.TabO, kernel_tick: u64, dt: f32) !void {
255255
_ = kernel_tick;
256256

257-
const tab_o: *FooViewportTab = @alignCast(@ptrCast(inst));
257+
const tab_o: *FooViewportTab = @ptrCast(@alignCast(inst));
258258
const size = _coreui.getContentRegionAvail();
259259
tab_o.viewport.setSize(size);
260260

261261
if (tab_o.viewport.getTexture()) |texture| {
262262
_coreui.image(
263263
texture,
264264
.{
265-
.flags = 0,
266-
.mip = 0,
267265
.w = size[0],
268266
.h = size[1],
269267
},
@@ -312,7 +310,7 @@ var foo_tab = editor.TabTypeI.implement(editor.TabTypeIArgs{
312310

313311
// Draw tab menu
314312
pub fn menu(inst: *editor.TabO) !void {
315-
const tab_o: *FooViewportTab = @alignCast(@ptrCast(inst));
313+
const tab_o: *FooViewportTab = @ptrCast(@alignCast(inst));
316314

317315
const allocator = try _tempalloc.create();
318316
defer _tempalloc.destroy(allocator);
@@ -462,6 +460,6 @@ pub fn load_module_zig(apidb: *const cetech1.apidb.ApiDbAPI, allocator: Allocato
462460
}
463461

464462
// This is only one fce that cetech1 need to load/unload/reload module.
465-
pub export fn ct_load_module_editor_foo_viewport_tab(apidb: *const cetech1.apidb.ApiDbAPI, allocator: *const std.mem.Allocator, load: bool, reload: bool) callconv(.C) bool {
463+
pub export fn ct_load_module_editor_foo_viewport_tab(apidb: *const cetech1.apidb.ApiDbAPI, allocator: *const std.mem.Allocator, load: bool, reload: bool) callconv(.c) bool {
466464
return cetech1.modules.loadModuleZigHelper(load_module_zig, module_name, apidb, allocator, load, reload);
467465
}

examples/foo/src/private.zig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ const KernelTask = struct {
108108
// _db.destroyObject(obj1);
109109
// }
110110

111-
//std.time.sleep(1 * std.time.ns_per_ms);
111+
//std.Thread.sleep(1 * std.time.ns_per_ms);
112112
}
113113
};
114114

@@ -251,6 +251,6 @@ pub fn load_module_zig(apidb: *const cetech1.apidb.ApiDbAPI, allocator: Allocato
251251
}
252252

253253
// This is only one fce that cetech1 need to load/unload/reload module.
254-
pub export fn ct_load_module_foo(apidb: *const cetech1.apidb.ApiDbAPI, allocator: *const std.mem.Allocator, load: bool, reload: bool) callconv(.C) bool {
254+
pub export fn ct_load_module_foo(apidb: *const cetech1.apidb.ApiDbAPI, allocator: *const std.mem.Allocator, load: bool, reload: bool) callconv(.c) bool {
255255
return cetech1.modules.loadModuleZigHelper(load_module_zig, module_name, apidb, allocator, load, reload);
256256
}

0 commit comments

Comments
 (0)