Skip to content

Commit

Permalink
Remove old submodules, work on Zig example
Browse files Browse the repository at this point in the history
  • Loading branch information
mgord9518 committed Jun 18, 2024
1 parent b0619fb commit 24e9242
Show file tree
Hide file tree
Showing 8 changed files with 77 additions and 21 deletions.
9 changes: 0 additions & 9 deletions .gitmodules

This file was deleted.

1 change: 0 additions & 1 deletion zig/bubblewrap
Submodule bubblewrap deleted from 366105
36 changes: 32 additions & 4 deletions zig/build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@ pub fn build(b: *std.Build) void {

lib.addIncludePath(b.path("../include"));

const known_folders_module = b.addModule("known-folders", .{
.root_source_file = b.path("known-folders/known-folders.zig"),
});
// const known_folders_module = b.addModule("known-folders", .{
// .root_source_file = b.path("known-folders/known-folders.zig"),
// });

const squashfuse_dep = b.dependency("squashfuse", .{
.target = target,
Expand All @@ -75,17 +75,45 @@ pub fn build(b: *std.Build) void {
.optimize = optimize,
});

const known_folders_dep = b.dependency("known_folders", .{
.target = target,
.optimize = optimize,
});

lib.root_module.addImport(
"squashfuse",
squashfuse_dep.module("squashfuse"),
);

lib.root_module.addImport(
"known-folders",
known_folders_dep.module("known-folders"),
);

_ = b.addModule("aisap", .{
.root_source_file = b.path("lib.zig"),
.imports = &.{
.{
.name = "squashfuse",
.module = squashfuse_dep.module("squashfuse"),
},
.{
.name = "known-folders",
.module = known_folders_dep.module("known-folders"),
},
.{
.name = "fuse",
.module = fuse_dep.module("fuse"),
},
},
});

lib.root_module.addImport(
"fuse",
fuse_dep.module("fuse"),
);

lib.root_module.addImport("known-folders", known_folders_module);
// lib.root_module.addImport("known-folders", known_folders_module);

// const pie = b.option(bool, "pie", "build as a PIE (position independent executable)") orelse true;
// lib.pie = pie;
Expand Down
6 changes: 5 additions & 1 deletion zig/build.zig.zon
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.{
.name = "aisap",
.version = "0.9.10-alpha",
.version = "0.9.11-alpha",
.paths = [][]const u8 {""},
.dependencies = .{
.squashfuse = .{
Expand All @@ -11,5 +11,9 @@
.url = "https://github.com/mgord9518/libfuse-zig/archive/refs/tags/continuous.tar.gz",
.hash = "12205592f7dc4b4c7256abd657a50bd9784459a0e9b8bfe8b0d1bbcc153a6d0f650a",
},
.known_folders = .{
.url = "https://github.com/ziglibs/known-folders/archive/0ad514dcfb7525e32ae349b9acc0a53976f3a9fa.tar.gz",
.hash = "12209cde192558f8b3dc098ac2330fc2a14fdd211c5433afd33085af75caa9183147",
},
},
}
32 changes: 28 additions & 4 deletions zig/examples/build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ pub fn build(b: *std.Build) void {

const exe = b.addExecutable(.{
.name = "example",
.root_source_file = .{ .path = "src/main.zig" },
.root_source_file = b.path("src/main.zig"),
.target = target,
.optimize = optimize,
});
Expand All @@ -23,10 +23,34 @@ pub fn build(b: *std.Build) void {
//const aisap_module = aisap.module(b);
//exe.addModule("aisap", aisap_module);

exe.root_module.addAnonymousImport("aisap", .{
.root_source_file = .{ .path = "../lib.zig" },
const aisap_dep = b.dependency("aisap", .{
.target = target,
.optimize = optimize,

// // These options will be renamed in the future
// .@"enable-fuse" = true,
// .@"enable-zlib" = true,
// //.@"use-zig-zlib" = true,
// .@"use-libdeflate" = true,
// .@"enable-xz" = true,
// .@"enable-lzma" = true,
// .@"enable-lzo" = false,
// .@"enable-lz4" = true,
// .@"enable-zstd" = true,
});

// exe.root_module.addAnonymousImport("aisap", .{
// .root_source_file = .{ .path = "../lib.zig" },
// });
exe.root_module.addImport("aisap", aisap_dep.module("aisap"));

exe.linkLibrary(aisap_dep.artifact("zstd"));
exe.linkLibrary(aisap_dep.artifact("lz4"));
exe.linkLibrary(aisap_dep.artifact("deflate"));
exe.linkLibrary(aisap_dep.artifact("fuse"));

exe.linkLibC();

//aisap.link(exe, .{});

b.installArtifact(exe);
Expand All @@ -42,7 +66,7 @@ pub fn build(b: *std.Build) void {

// TODO: add tests
const exe_tests = b.addTest(.{
.root_source_file = .{ .path = "src/main.zig" },
.root_source_file = b.path("src/main.zig"),
.target = target,
.optimize = optimize,
});
Expand Down
12 changes: 12 additions & 0 deletions zig/examples/build.zig.zon
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
.{
.name = "aisap",
.version = "0.9.10-alpha",
.paths = [][]const u8 {""},
.dependencies = .{
.aisap = .{
//.url = "https://github.com/mgord9518/aisap/archive/refs/tags/continuous.tar.gz",
//.hash = "12204d3ea2c1cffc4e98b21a2809d58476ababeebe711dc84edfe15fe507f2c227db",
.path = "../"
},
},
}
1 change: 0 additions & 1 deletion zig/known-folders
Submodule known-folders deleted from 0ad514
1 change: 0 additions & 1 deletion zig/squashfuse-zig
Submodule squashfuse-zig deleted from 2c44b9

0 comments on commit 24e9242

Please sign in to comment.