mirror of
https://github.com/bdnugget/zig-template.git
synced 2026-11-07 09:07:34 +00:00
update to zig master
This commit is contained in:
1 parent
2a94b8a073
commit
6434cd7771
3 files changed
+25
-21
No files matched your search
@@ -10,13 +10,16 @@ pub fn build(b: *std.build.Builder) !void {
|
||||
// for restricting supported target set are available.
|
||||
const target = b.standardTargetOptions(.{});
|
||||
|
||||
// Standard release options allow the person running `zig build` to select
|
||||
// Standard optimize options allow the person running `zig build` to select
|
||||
// between Debug, ReleaseSafe, ReleaseFast, and ReleaseSmall.
|
||||
const mode = b.standardReleaseOptions();
|
||||
const optimize = b.standardOptimizeOption(.{});
|
||||
|
||||
const exe = b.addExecutable("capy-template", "src/main.zig");
|
||||
exe.setTarget(target);
|
||||
exe.setBuildMode(mode);
|
||||
const exe = b.addExecutable(.{
|
||||
.name = "capy-template",
|
||||
.root_source_file = .{ .path = "src/main.zig" },
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
});
|
||||
try deps.imports.capy.install(exe, .{});
|
||||
exe.install();
|
||||
|
||||
@@ -31,12 +34,13 @@ pub fn build(b: *std.build.Builder) !void {
|
||||
|
||||
// Building for WebAssembly
|
||||
// WebAssembly doesn't have a concept of executables, so the way it works is that we make a shared library and capy exports a '_start' function automatically
|
||||
const wasm = b.addSharedLibrary("capy-template", "src/main.zig", .unversioned);
|
||||
|
||||
@setEvalBranchQuota(5000);
|
||||
// Set the target to WebAssembly
|
||||
wasm.setTarget(comptime std.zig.CrossTarget.parse(.{ .arch_os_abi = "wasm32-freestanding" }) catch unreachable);
|
||||
wasm.setBuildMode(mode);
|
||||
const wasm = b.addSharedLibrary(.{
|
||||
.name = "capy-template",
|
||||
.root_source_file = .{ .path = "src/main.zig" },
|
||||
.target = comptime std.zig.CrossTarget.parse(.{ .arch_os_abi = "wasm32-freestanding" }) catch unreachable,
|
||||
.optimize = optimize,
|
||||
});
|
||||
try deps.imports.capy.install(wasm, .{});
|
||||
|
||||
if (@import("builtin").zig_backend != .stage2_llvm) {
|
||||
@@ -50,9 +54,11 @@ pub fn build(b: *std.build.Builder) !void {
|
||||
serve_step.dependOn(&step.step);
|
||||
}
|
||||
|
||||
const exe_tests = b.addTest("src/main.zig");
|
||||
exe_tests.setTarget(target);
|
||||
exe_tests.setBuildMode(mode);
|
||||
const exe_tests = b.addTest(.{
|
||||
.root_source_file = .{ .path = "src/main.zig" },
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
});
|
||||
|
||||
const test_step = b.step("test", "Run unit tests");
|
||||
test_step.dependOn(&exe_tests.step);
|
||||
|
||||
+4
-6
@@ -6,15 +6,13 @@ pub usingnamespace capy.cross_platform;
|
||||
|
||||
pub fn main() !void {
|
||||
try capy.backend.init();
|
||||
|
||||
|
||||
var window = try capy.Window.init();
|
||||
try window.set(
|
||||
capy.Label(.{ .text = "Hello, World" })
|
||||
);
|
||||
|
||||
try window.set(capy.Label(.{ .text = "Hello, World", .alignment = .Center }));
|
||||
|
||||
window.setTitle("Hello");
|
||||
window.resize(250, 100);
|
||||
window.show();
|
||||
|
||||
|
||||
capy.runEventLoop();
|
||||
}
|
||||
+2
-2
@@ -1,3 +1,3 @@
|
||||
2
|
||||
git https://github.com/zenith391/capy commit-2e31fde7e328599352eb01f8894acd53389d0ec0
|
||||
git https://github.com/Luukdegram/apple_pie commit-54444805f41cc958d55940bc8931cd3cf1979d8c
|
||||
git https://github.com/Luukdegram/apple_pie commit-5eaaabdced4f9b8d6cee947b465e7ea16ea61f42
|
||||
git https://github.com/capy-ui/capy commit-e1f8ee5ad77e4c9d71eaf8d877535e33346ccdc4
|
||||
Reference in new issue
Block a user