Skip to content

Commit

Permalink
use only zig package manager
Browse files Browse the repository at this point in the history
  • Loading branch information
mitchellh committed Aug 3, 2023
1 parent f3b2783 commit 442f4be
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 25 deletions.
29 changes: 4 additions & 25 deletions build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -2,33 +2,12 @@ const std = @import("std");
const LibExeObjStep = std.build.LibExeObjStep;
const ScdocStep = @import("src/build/ScdocStep.zig");

/// DEPRECATED: This is the old std.build.Pkg for older versions of Zig.
/// I won't keep this around too long but there is no harm in exposing it
/// for now since our code works with older versions just fine (for now).
pub const pkg = std.build.Pkg{
.name = "xev",
.source = .{ .path = thisDir() ++ "/src/main.zig" },
};

/// Returns the module for libxev. The recommended approach is to depend
/// on libxev in your build.zig.zon file, then use
/// `b.dependency("libxev").module("xev")`. But if you're not using
/// a build.zig.zon yet this will work.
pub fn module(b: *std.Build) *std.Build.Module {
return b.createModule(.{
.source_file = .{ .path = (comptime thisDir()) ++ "/src/main.zig" },
});
}

pub fn build(b: *std.Build) !void {
// Modules available to downstream dependencies
_ = b.addModule("xev", .{
.source_file = .{ .path = (comptime thisDir()) ++ "/src/main.zig" },
});

const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});

_ = b.addModule("xev", .{ .source_file = .{ .path = "src/main.zig" } });

const man_pages = b.option(
bool,
"man-pages",
Expand Down Expand Up @@ -245,7 +224,7 @@ fn benchTargets(
.target = target,
.optimize = .ReleaseFast, // benchmarks are always release fast
});
c_exe.addModule("xev", module(b));
c_exe.addModule("xev", b.modules.get("xev").?);
if (install) {
const install_step = b.addInstallArtifact(c_exe, .{
.dest_dir = .{ .override = .{ .custom = "bench" } },
Expand Down Expand Up @@ -303,7 +282,7 @@ fn exampleTargets(
.target = target,
.optimize = optimize,
});
c_exe.addModule("xev", module(b));
c_exe.addModule("xev", b.modules.get("xev").?);
if (install) {
const install_step = b.addInstallArtifact(c_exe, .{
.dest_dir = .{ .override = .{ .custom = "example" } },
Expand Down
4 changes: 4 additions & 0 deletions build.zig.zon
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.{
.name = "libxev",
.version = "0.0.0",
}

0 comments on commit 442f4be

Please sign in to comment.