|
| 1 | +const std = @import("std"); |
| 2 | +const Phantom = @import("phantom"); |
| 3 | + |
| 4 | +pub fn build(b: *std.Build) void { |
| 5 | + const target = b.standardTargetOptions(.{}); |
| 6 | + const optimize = b.standardOptimizeOption(.{}); |
| 7 | + const backend = b.option(Phantom.BackendType, "backend", "The backend to use for the example") orelse .headless; |
| 8 | + |
| 9 | + const phantom_i18n = b.dependency("phantom.i18n", .{ |
| 10 | + .target = target, |
| 11 | + .optimize = optimize, |
| 12 | + }); |
| 13 | + |
| 14 | + const phantom = b.dependency("phantom", .{ |
| 15 | + .target = target, |
| 16 | + .optimize = optimize, |
| 17 | + }); |
| 18 | + |
| 19 | + _ = b.addModule("phantom.i18n", .{ |
| 20 | + .source_file = .{ |
| 21 | + .path = phantom_i18n.builder.pathFromRoot(phantom_i18n.module("phantom.i18n").source_file.path), |
| 22 | + }, |
| 23 | + }); |
| 24 | + |
| 25 | + _ = b.addModule("phantom", .{ |
| 26 | + .source_file = .{ |
| 27 | + .path = phantom.builder.pathFromRoot(phantom.module("phantom").source_file.path), |
| 28 | + }, |
| 29 | + }); |
| 30 | + |
| 31 | + const options = b.addOptions(); |
| 32 | + options.addOption(Phantom.BackendType, "backend", backend); |
| 33 | + |
| 34 | + const exe = b.addExecutable(.{ |
| 35 | + .name = "example", |
| 36 | + .root_source_file = .{ |
| 37 | + .path = b.pathFromRoot("src/example.zig"), |
| 38 | + }, |
| 39 | + .target = target, |
| 40 | + .optimize = optimize, |
| 41 | + }); |
| 42 | + |
| 43 | + exe.addModule("phantom", phantom.module("phantom")); |
| 44 | + exe.addModule("phantom.i18n", phantom_i18n.module("phantom.i18n")); |
| 45 | + exe.addOptions("options", options); |
| 46 | + b.installArtifact(exe); |
| 47 | +} |
0 commit comments