Created
June 14, 2021 19:14
-
-
Save ikskuh/4ef9cde440cc2c688c07b0e9e004d831 to your computer and use it in GitHub Desktop.
sdkRoot()
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const std = @import("std"); | |
const Pkg = std.build.Pkg; | |
const Step = std.build.Step; | |
const FileSource = std.build.FileSource; | |
const GeneratedFile = std.build.GeneratedFile; | |
pub const Sdk = @This(); | |
builder: *std.build.Builder, | |
pub fn init(b: *std.build.Builder) Sdk { | |
return Sdk{ | |
.builder = b, | |
}; | |
} | |
pub fn getAppPackage(sdk: Sdk, name: []const u8) Pkg { | |
return sdk.builder.dupePkg(Pkg{ | |
.name = sdk.builder.dupe(name), | |
.path = FileSource{ .path = sdkRoot() ++ "/src/dunstblick-app/dunstblick.zig" }, | |
.dependencies = &[_]std.build.Pkg{ | |
pkgs.network, | |
pkgs.dunstblick_protocol, | |
}, | |
}); | |
} | |
const pkgs = struct { | |
const network = std.build.Pkg{ | |
.name = "network", | |
.path = FileSource{ .path = sdkRoot() ++ "/deps/zig-network/network.zig" }, | |
}; | |
const dunstblick_protocol = std.build.Pkg{ | |
.name = "dunstblick-protocol", | |
.path = FileSource{ .path = sdkRoot() ++ "/src/dunstblick-protocol/protocol.zig" }, | |
}; | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const std = @import("std"); | |
const Sdk = @import("deps/core/Sdk.zig"); | |
pub fn build(b: *std.build.Builder) void { | |
const target = b.standardTargetOptions(.{}); | |
const mode = b.standardReleaseOptions(); | |
const sdk = Sdk.init(b); | |
const resources = sdk.addBundleResources(); | |
resources.addLayout("main", "src/layouts/main.ui"); | |
resources.addLayout("socket", "src/layouts/socket.ui"); | |
const exe = b.addExecutable("power.xq", "src/main.zig"); | |
exe.setTarget(target); | |
exe.setBuildMode(mode); | |
exe.addPackage(pkgs.zfetch); | |
exe.addPackage(sdk.getAppPackage("dunstblick")); | |
exe.addPackage(resources.getPackage("resources")); | |
exe.install(); | |
const run_cmd = exe.run(); | |
run_cmd.step.dependOn(b.getInstallStep()); | |
if (b.args) |args| { | |
run_cmd.addArgs(args); | |
} | |
const run_step = b.step("run", "Run the app"); | |
run_step.dependOn(&run_cmd.step); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment