Compare commits
No commits in common. "f032509b125b48e00b3f2d7b37bab4979c723c05" and "de7b29c458e578afa12ed26c6e036e0a66da0f2a" have entirely different histories.
f032509b12
...
de7b29c458
13
build.zig
13
build.zig
@ -3,13 +3,15 @@ const sokol = @import("sokol");
|
|||||||
|
|
||||||
const title = "sok";
|
const title = "sok";
|
||||||
|
|
||||||
|
const buildForWeb = false;
|
||||||
|
|
||||||
pub fn build(b: *std.Build) void {
|
pub fn build(b: *std.Build) void {
|
||||||
const target = b.standardTargetOptions(.{});
|
const target = b.standardTargetOptions(.{});
|
||||||
const optimize = b.standardOptimizeOption(.{});
|
const optimize = b.standardOptimizeOption(.{});
|
||||||
|
|
||||||
const dep_sokol = b.dependency("sokol", .{ .target = target, .optimize = optimize });
|
const dep_sokol = b.dependency("sokol", .{ .target = target, .optimize = optimize });
|
||||||
|
|
||||||
if (!target.result.isWasm()) {
|
if (!buildForWeb) {
|
||||||
// Native exe
|
// Native exe
|
||||||
|
|
||||||
const exe = b.addExecutable(.{
|
const exe = b.addExecutable(.{
|
||||||
@ -94,3 +96,12 @@ pub fn build(b: *std.Build) void {
|
|||||||
const test_step = b.step("test", "Run unit tests");
|
const test_step = b.step("test", "Run unit tests");
|
||||||
test_step.dependOn(&run_exe_unit_tests.step);
|
test_step.dependOn(&run_exe_unit_tests.step);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// for web builds, the Zig code needs to be built into a library and linked with the Emscripten linker
|
||||||
|
fn buildWeb(b: *std.Build, target: std.Build.ResolvedTarget, optimize: std.Build.OptimizeMode, dep_sokol: *std.Build.Dependency) !void {
|
||||||
|
_ = b; // autofix
|
||||||
|
_ = target; // autofix
|
||||||
|
_ = optimize; // autofix
|
||||||
|
_ = dep_sokol; // autofix
|
||||||
|
|
||||||
|
}
|
||||||
|
@ -10,8 +10,6 @@ The goal of this project is not fixed, and is just to try out some sokol feature
|
|||||||
|
|
||||||
To build, you need to have zig master (you can use [zvm](https://www.zvm.app/) to help you with this). Then just `zig build run` and that should be it!
|
To build, you need to have zig master (you can use [zvm](https://www.zvm.app/) to help you with this). Then just `zig build run` and that should be it!
|
||||||
|
|
||||||
To build for wasm, use `zig build -Dtarget=wasm32-emscripten run`
|
|
||||||
|
|
||||||
Note that if you change shaders, you have to recompile them manually - run compile_shaders.bat.
|
Note that if you change shaders, you have to recompile them manually - run compile_shaders.bat.
|
||||||
|
|
||||||
### Live error checking
|
### Live error checking
|
||||||
|
Loading…
Reference in New Issue
Block a user