@@ -16,7 +16,7 @@ pub fn build(b: &Builder) !void {
16
16
var docgen_exe = b .addExecutable ("docgen" , "doc/docgen.zig" );
17
17
18
18
const rel_zig_exe = try os .path .relative (b .allocator , b .build_root , b .zig_exe );
19
- var docgen_cmd = b .addCommand (null , b .env_map , [][]const u8 {
19
+ var docgen_cmd = b .addCommand (null , b .env_map , [][]const u8 {
20
20
docgen_exe .getOutputPath (),
21
21
rel_zig_exe ,
22
22
"doc/langref.html.in" ,
@@ -30,7 +30,10 @@ pub fn build(b: &Builder) !void {
30
30
const test_step = b .step ("test" , "Run all the tests" );
31
31
32
32
// find the stage0 build artifacts because we're going to re-use config.h and zig_cpp library
33
- const build_info = try b .exec ([][]const u8 {b .zig_exe , "BUILD_INFO" });
33
+ const build_info = try b .exec ([][]const u8 {
34
+ b .zig_exe ,
35
+ "BUILD_INFO" ,
36
+ });
34
37
var index : usize = 0 ;
35
38
const cmake_binary_dir = nextValue (& index , build_info );
36
39
const cxx_compiler = nextValue (& index , build_info );
@@ -67,7 +70,10 @@ pub fn build(b: &Builder) !void {
67
70
dependOnLib (exe , llvm );
68
71
69
72
if (exe .target .getOs () == builtin .Os .linux ) {
70
- const libstdcxx_path_padded = try b .exec ([][]const u8 {cxx_compiler , "-print-file-name=libstdc++.a" });
73
+ const libstdcxx_path_padded = try b .exec ([][]const u8 {
74
+ cxx_compiler ,
75
+ "-print-file-name=libstdc++.a" ,
76
+ });
71
77
const libstdcxx_path = ?? mem .split (libstdcxx_path_padded , "\r \n " ).next ();
72
78
if (mem .eql (u8 , libstdcxx_path , "libstdc++.a" )) {
73
79
warn (
@@ -111,17 +117,11 @@ pub fn build(b: &Builder) !void {
111
117
112
118
test_step .dependOn (docs_step );
113
119
114
- test_step .dependOn (tests .addPkgTests (b , test_filter ,
115
- "test/behavior.zig" , "behavior" , "Run the behavior tests" ,
116
- with_lldb ));
120
+ test_step .dependOn (tests .addPkgTests (b , test_filter , "test/behavior.zig" , "behavior" , "Run the behavior tests" , with_lldb ));
117
121
118
- test_step .dependOn (tests .addPkgTests (b , test_filter ,
119
- "std/index.zig" , "std" , "Run the standard library tests" ,
120
- with_lldb ));
122
+ test_step .dependOn (tests .addPkgTests (b , test_filter , "std/index.zig" , "std" , "Run the standard library tests" , with_lldb ));
121
123
122
- test_step .dependOn (tests .addPkgTests (b , test_filter ,
123
- "std/special/compiler_rt/index.zig" , "compiler-rt" , "Run the compiler_rt tests" ,
124
- with_lldb ));
124
+ test_step .dependOn (tests .addPkgTests (b , test_filter , "std/special/compiler_rt/index.zig" , "compiler-rt" , "Run the compiler_rt tests" , with_lldb ));
125
125
126
126
test_step .dependOn (tests .addCompareOutputTests (b , test_filter ));
127
127
test_step .dependOn (tests .addBuildExampleTests (b , test_filter ));
@@ -149,8 +149,7 @@ fn dependOnLib(lib_exe_obj: &std.build.LibExeObjStep, dep: &const LibraryDep) vo
149
149
150
150
fn addCppLib (b : & Builder , lib_exe_obj : & std.build.LibExeObjStep , cmake_binary_dir : []const u8 , lib_name : []const u8 ) void {
151
151
const lib_prefix = if (lib_exe_obj .target .isWindows ()) "" else "lib" ;
152
- lib_exe_obj .addObjectFile (os .path .join (b .allocator , cmake_binary_dir , "zig_cpp" ,
153
- b .fmt ("{}{}{}" , lib_prefix , lib_name , lib_exe_obj .target .libFileExt ())) catch unreachable );
152
+ lib_exe_obj .addObjectFile (os .path .join (b .allocator , cmake_binary_dir , "zig_cpp" , b .fmt ("{}{}{}" , lib_prefix , lib_name , lib_exe_obj .target .libFileExt ())) catch unreachable );
154
153
}
155
154
156
155
const LibraryDep = struct {
@@ -161,11 +160,21 @@ const LibraryDep = struct {
161
160
};
162
161
163
162
fn findLLVM (b : & Builder , llvm_config_exe : []const u8 ) ! LibraryDep {
164
- const libs_output = try b .exec ([][]const u8 {llvm_config_exe , "--libs" , "--system-libs" });
165
- const includes_output = try b .exec ([][]const u8 {llvm_config_exe , "--includedir" });
166
- const libdir_output = try b .exec ([][]const u8 {llvm_config_exe , "--libdir" });
163
+ const libs_output = try b .exec ([][]const u8 {
164
+ llvm_config_exe ,
165
+ "--libs" ,
166
+ "--system-libs" ,
167
+ });
168
+ const includes_output = try b .exec ([][]const u8 {
169
+ llvm_config_exe ,
170
+ "--includedir" ,
171
+ });
172
+ const libdir_output = try b .exec ([][]const u8 {
173
+ llvm_config_exe ,
174
+ "--libdir" ,
175
+ });
167
176
168
- var result = LibraryDep {
177
+ var result = LibraryDep {
169
178
.libs = ArrayList ([]const u8 ).init (b .allocator ),
170
179
.system_libs = ArrayList ([]const u8 ).init (b .allocator ),
171
180
.includes = ArrayList ([]const u8 ).init (b .allocator ),
@@ -227,17 +236,17 @@ pub fn installCHeaders(b: &Builder, c_header_files: []const u8) void {
227
236
}
228
237
229
238
fn nextValue (index : & usize , build_info : []const u8 ) []const u8 {
230
- const start = * index ;
231
- while (true ) : (* index += 1 ) {
232
- switch (build_info [* index ]) {
239
+ const start = index .* ;
240
+ while (true ) : (index .* += 1 ) {
241
+ switch (build_info [index .* ]) {
233
242
'\n ' = > {
234
- const result = build_info [start .. * index ];
235
- * index += 1 ;
243
+ const result = build_info [start .. index .* ];
244
+ index .* += 1 ;
236
245
return result ;
237
246
},
238
247
'\r ' = > {
239
- const result = build_info [start .. * index ];
240
- * index += 2 ;
248
+ const result = build_info [start .. index .* ];
249
+ index .* += 2 ;
241
250
return result ;
242
251
},
243
252
else = > continue ,
0 commit comments