Skip to content

Commit

Permalink
core!: move libxev and zig-aio event loops to USAGE.md
Browse files Browse the repository at this point in the history
Create USAGE.md to serve as a friendly guide for usage.

Move the libxev and zig-aio event loops to serve as an example of how to
implement a custom event loop in USAGE.md. Remove dependency on these
libraries and all associated examples and source code.

The motivation for this change is to provide a simpler library. The
power to create a custom event loop will always be kept, however the
support burden of maintaining three event loops is not where I want to
focus my energy. The code is small enough that it's easy enough to be
copy/pasted into a project or provided as a third-party library.
  • Loading branch information
rockorager committed Oct 30, 2024
1 parent e29aca6 commit aaf1bb4
Show file tree
Hide file tree
Showing 8 changed files with 513 additions and 807 deletions.
513 changes: 513 additions & 0 deletions USAGE.md

Large diffs are not rendered by default.

18 changes: 0 additions & 18 deletions build.zig
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
const std = @import("std");

pub fn build(b: *std.Build) void {
const include_libxev = b.option(bool, "libxev", "Enable support for libxev library (default: true)") orelse true;
const include_images = b.option(bool, "images", "Enable support for images (default: true)") orelse true;
const include_aio = b.option(bool, "aio", "Enable support for zig-aio library (default: false)") orelse false;

const options = b.addOptions();
options.addOption(bool, "libxev", include_libxev);
options.addOption(bool, "images", include_images);
options.addOption(bool, "aio", include_aio);

const options_mod = options.createModule();

Expand All @@ -25,14 +21,6 @@ pub fn build(b: *std.Build) void {
.optimize = optimize,
.target = target,
}) else null;
const xev_dep = if (include_libxev) b.lazyDependency("libxev", .{
.optimize = optimize,
.target = target,
}) else null;
const aio_dep = if (include_aio) b.lazyDependency("aio", .{
.optimize = optimize,
.target = target,
}) else null;

// Module
const vaxis_mod = b.addModule("vaxis", .{
Expand All @@ -44,9 +32,6 @@ pub fn build(b: *std.Build) void {
vaxis_mod.addImport("grapheme", zg_dep.module("grapheme"));
vaxis_mod.addImport("DisplayWidth", zg_dep.module("DisplayWidth"));
if (zigimg_dep) |dep| vaxis_mod.addImport("zigimg", dep.module("zigimg"));
if (xev_dep) |dep| vaxis_mod.addImport("xev", dep.module("xev"));
if (aio_dep) |dep| vaxis_mod.addImport("aio", dep.module("aio"));
if (aio_dep) |dep| vaxis_mod.addImport("coro", dep.module("coro"));
vaxis_mod.addImport("build_options", options_mod);

// Examples
Expand Down Expand Up @@ -75,9 +60,6 @@ pub fn build(b: *std.Build) void {
.optimize = optimize,
});
example.root_module.addImport("vaxis", vaxis_mod);
if (xev_dep) |dep| example.root_module.addImport("xev", dep.module("xev"));
if (aio_dep) |dep| example.root_module.addImport("aio", dep.module("aio"));
if (aio_dep) |dep| example.root_module.addImport("coro", dep.module("coro"));

const example_run = b.addRunArtifact(example);
example_step.dependOn(&example_run.step);
Expand Down
10 changes: 0 additions & 10 deletions build.zig.zon
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,6 @@
.url = "git+https://codeberg.org/dude_the_builder/zg#7ddce488e074c3f052949ba513a340446cea86e9",
.hash = "12205e2e7108385a1ec280b6365166e902a690d6a0e8fcc015fdea62d63cf79be8ec",
},
.libxev = .{
.url = "git+https://github.com/mitchellh/libxev#f6a672a78436d8efee1aa847a43a900ad773618b",
.hash = "12207b7a5b538ffb7fb18f954ae17d2f8490b6e3778a9e30564ad82c58ee8da52361",
.lazy = true,
},
.aio = .{
.url = "git+https://github.com/Cloudef/zig-aio#b5a407344379508466c5dcbe4c74438a6166e2ca",
.hash = "1220a55aedabdd10578d0c514719ea39ae1bc6d7ed990f508dc100db7f0ccf391437",
.lazy = true,
},
},
.paths = .{
"LICENSE",
Expand Down
172 changes: 0 additions & 172 deletions examples/aio.zig

This file was deleted.

127 changes: 0 additions & 127 deletions examples/xev.zig

This file was deleted.

Loading

0 comments on commit aaf1bb4

Please sign in to comment.