@@ -16,11 +16,22 @@ pub fn build(b: *std.Build) void {
16
16
// set a preferred release mode, allowing the user to decide how to optimize.
17
17
const optimize = b .standardOptimizeOption (.{});
18
18
19
- const exe = b .addExecutable (.{
20
- .name = "walle" ,
19
+ // indexer
20
+ const indexer = b .addExecutable (.{
21
+ .name = "indexer" ,
21
22
// In this case the main source file is merely a path, however, in more
22
23
// complicated build scripts, this could be a generated file.
23
- .root_source_file = b .path ("src/main.zig" ),
24
+ .root_source_file = b .path ("src/indexer.zig" ),
25
+ .target = target ,
26
+ .optimize = optimize ,
27
+ });
28
+
29
+ // walle bitcoin explorer
30
+ const wbx = b .addExecutable (.{
31
+ .name = "wbx" ,
32
+ // In this case the main source file is merely a path, however, in more
33
+ // complicated build scripts, this could be a generated file.
34
+ .root_source_file = b .path ("src/wbx.zig" ),
24
35
.target = target ,
25
36
.optimize = optimize ,
26
37
});
@@ -35,10 +46,6 @@ pub fn build(b: *std.Build) void {
35
46
.root_source_file = b .path ("src/crypto/crypto.zig" ),
36
47
});
37
48
38
- exe .root_module .addImport ("base58" , base58 );
39
- exe .root_module .addImport ("clap" , clap );
40
- exe .root_module .addImport ("crypto" , crypto );
41
-
42
49
const sqlite = b .addModule ("sqlite" , .{
43
50
.root_source_file = b .path ("lib/zig-sqlite/sqlite.zig" ),
44
51
});
@@ -49,57 +56,51 @@ pub fn build(b: *std.Build) void {
49
56
.flags = &[_ ][]const u8 {"-std=c99" },
50
57
});
51
58
sqlite .addIncludePath (b .path ("lib/zig-sqlite/c" ));
52
- exe .linkLibC ();
53
- exe .linkSystemLibrary ("sqlite3" );
54
- exe .root_module .addImport ("sqlite" , sqlite );
59
+
60
+ indexer .root_module .addImport ("base58" , base58 );
61
+ indexer .root_module .addImport ("clap" , clap );
62
+ indexer .root_module .addImport ("crypto" , crypto );
63
+ indexer .linkLibC ();
64
+ indexer .linkSystemLibrary ("sqlite3" );
65
+ indexer .root_module .addImport ("sqlite" , sqlite );
66
+
67
+ wbx .root_module .addImport ("base58" , base58 );
68
+ wbx .root_module .addImport ("crypto" , crypto );
55
69
56
70
// This declares intent for the executable to be installed into the
57
71
// standard location when the user invokes the "install" step (the default
58
72
// step when running `zig build`).
59
- b .installArtifact (exe );
60
-
61
- // Check step, used for zls
62
- const exe_check = b .addExecutable (.{
63
- .name = "walle" ,
64
- // In this case the main source file is merely a path, however, in more
65
- // complicated build scripts, this could be a generated file.
66
- .root_source_file = b .path ("src/main.zig" ),
67
- .target = target ,
68
- .optimize = optimize ,
69
- });
70
-
71
- exe_check .root_module .addImport ("base58" , base58 );
72
- exe_check .root_module .addImport ("clap" , clap );
73
- exe_check .root_module .addImport ("crypto" , crypto );
74
- exe_check .linkLibC ();
75
- exe_check .linkSystemLibrary ("sqlite3" );
76
- exe_check .root_module .addImport ("sqlite" , sqlite );
77
-
78
- const check = b .step ("check" , "Check if main compiles" );
79
- check .dependOn (& exe_check .step );
73
+ b .installArtifact (indexer );
74
+ b .installArtifact (wbx );
80
75
81
76
// This *creates* a Run step in the build graph, to be executed when another
82
77
// step is evaluated that depends on it. The next line below will establish
83
78
// such a dependency.
84
- const run_cmd = b .addRunArtifact (exe );
79
+ const run_cmd_indexer = b .addRunArtifact (indexer );
80
+ const run_cmd_wbx = b .addRunArtifact (wbx );
85
81
86
82
// By making the run step depend on the install step, it will be run from the
87
83
// installation directory rather than directly from within the cache directory.
88
84
// This is not necessary, however, if the application depends on other installed
89
85
// files, this ensures they will be present and in the expected location.
90
- run_cmd .step .dependOn (b .getInstallStep ());
86
+ run_cmd_indexer .step .dependOn (b .getInstallStep ());
87
+ run_cmd_wbx .step .dependOn (b .getInstallStep ());
91
88
92
89
// This allows the user to pass arguments to the application in the build
93
90
// command itself, like this: `zig build run -- arg1 arg2 etc`
94
91
if (b .args ) | args | {
95
- run_cmd .addArgs (args );
92
+ run_cmd_indexer .addArgs (args );
93
+ run_cmd_wbx .addArgs (args );
96
94
}
97
95
98
96
// This creates a build step. It will be visible in the `zig build --help` menu,
99
97
// and can be selected like this: `zig build run`
100
98
// This will evaluate the `run` step rather than the default, which is "install".
101
- const run_step = b .step ("run" , "Run the app" );
102
- run_step .dependOn (& run_cmd .step );
99
+ const run_step_indexer = b .step ("run_indexer" , "Run the indexer" );
100
+ run_step_indexer .dependOn (& run_cmd_indexer .step );
101
+
102
+ const run_step_wbx = b .step ("run_wbx" , "Run the walle bitcoin explorer" );
103
+ run_step_wbx .dependOn (& run_cmd_wbx .step );
103
104
104
105
// Similar to creating the run step earlier, this exposes a `test` step to
105
106
// the `zig build --help` menu, providing a way for the user to request
0 commit comments