From ee4ebf70a537283bd4b5ef0e8638a72c92d474e2 Mon Sep 17 00:00:00 2001 From: nothke Date: Sun, 9 Jun 2024 01:02:26 +0200 Subject: [PATCH] Added sokol --- build.zig | 11 +++-------- build.zig.zon | 25 +++++-------------------- 2 files changed, 8 insertions(+), 28 deletions(-) diff --git a/build.zig b/build.zig index 8c1782c..76972ca 100644 --- a/build.zig +++ b/build.zig @@ -4,17 +4,10 @@ const std = @import("std"); // declaratively construct a build graph that will be executed by an external // runner. pub fn build(b: *std.Build) void { - // Standard target options allows the person running `zig build` to choose - // what target to build for. Here we do not override the defaults, which - // means any target is allowed, and the default is native. Other options - // for restricting supported target set are available. const target = b.standardTargetOptions(.{}); - - // Standard optimization options allow the person running `zig build` to select - // between Debug, ReleaseSafe, ReleaseFast, and ReleaseSmall. Here we do not - // set a preferred release mode, allowing the user to decide how to optimize. const optimize = b.standardOptimizeOption(.{}); + const dep_sokol = b.dependency("sokol", .{ .target = target, .optimize = optimize }); const exe = b.addExecutable(.{ .name = "sok", @@ -23,6 +16,8 @@ pub fn build(b: *std.Build) void { .optimize = optimize, }); + exe.root_module.addImport("sokol", dep_sokol.module("sokol")); + // This declares intent for the executable to be installed into the // standard location when the user invokes the "install" step (the default // step when running `zig build`). diff --git a/build.zig.zon b/build.zig.zon index 6daab2f..069b37b 100644 --- a/build.zig.zon +++ b/build.zig.zon @@ -1,28 +1,13 @@ .{ - // This is the default name used by packages depending on this one. For - // example, when a user runs `zig fetch --save `, this field is used - // as the key in the `dependencies` table. Although the user can choose a - // different name, most users will stick with this provided value. - // - // It is redundant to include "zig" in this name because it is already - // within the Zig package namespace. .name = "sok", - - // This is a [Semantic Version](https://semver.org/). - // In a future version of Zig it will be used for package deduplication. .version = "0.0.0", + .minimum_zig_version = "0.13.0", - // This field is optional. - // This is currently advisory only; Zig does not yet do anything - // with this value. - //.minimum_zig_version = "0.11.0", - - // This field is optional. - // Each dependency must either provide a `url` and `hash`, or a `path`. - // `zig build --fetch` can be used to fetch all dependencies of a package, recursively. - // Once all dependencies are fetched, `zig build` no longer requires - // internet connectivity. .dependencies = .{ + .sokol = .{ + .url = "git+https://github.com/floooh/sokol-zig.git#d3e21f76498213d6d58179065756f5f2ed9b90cf", + .hash = "122052a192829b377c637ce242ee8c9121e03d8cd10c889758dc6fb176368de7d67b", + }, // See `zig fetch --save ` for a command-line interface for adding dependencies. //.example = .{ // // When updating this field to a new URL, be sure to delete the corresponding