| author | |
| committer | |
| log | df8c325012ce8b9a93606edb0ffcc58739071891 |
| tree | 6d2262e7f90af8e295e1216a68a102ad7a3a48de |
| parent | 1a84c23d69c7e26ba1916c1f9f0e6002ff40d116 |
| parent | 25a70256138c06a3b00412b4ad7122dab9decf9e |
| signature | Signed by PGP key 4AEE18F83AFDEB23 |
CI: windows: depend on Zig instead of CMake and MSVC15 files changed, 1240 insertions(+), 196 deletions(-)
build.zig+141-57| ... | @@ -19,7 +19,7 @@ pub fn build(b: *Builder) !void { | ... | @@ -19,7 +19,7 @@ pub fn build(b: *Builder) !void { |
| 19 | const single_threaded = b.option(bool, "single-threaded", "Build artifacts that run in single threaded mode"); | 19 | const single_threaded = b.option(bool, "single-threaded", "Build artifacts that run in single threaded mode"); |
| 20 | const use_zig_libcxx = b.option(bool, "use-zig-libcxx", "If libc++ is needed, use zig's bundled version, don't try to integrate with the system") orelse false; | 20 | const use_zig_libcxx = b.option(bool, "use-zig-libcxx", "If libc++ is needed, use zig's bundled version, don't try to integrate with the system") orelse false; |
| 21 | 21 | ||
| 22 | var docgen_exe = b.addExecutable("docgen", "doc/docgen.zig"); | 22 | const docgen_exe = b.addExecutable("docgen", "doc/docgen.zig"); |
| 23 | docgen_exe.single_threaded = single_threaded; | 23 | docgen_exe.single_threaded = single_threaded; |
| 24 | 24 | ||
| 25 | const rel_zig_exe = try fs.path.relative(b.allocator, b.build_root, b.zig_exe); | 25 | const rel_zig_exe = try fs.path.relative(b.allocator, b.build_root, b.zig_exe); |
| ... | @@ -27,7 +27,7 @@ pub fn build(b: *Builder) !void { | ... | @@ -27,7 +27,7 @@ pub fn build(b: *Builder) !void { |
| 27 | b.allocator, | 27 | b.allocator, |
| 28 | &[_][]const u8{ b.cache_root, "langref.html" }, | 28 | &[_][]const u8{ b.cache_root, "langref.html" }, |
| 29 | ) catch unreachable; | 29 | ) catch unreachable; |
| 30 | var docgen_cmd = docgen_exe.run(); | 30 | const docgen_cmd = docgen_exe.run(); |
| 31 | docgen_cmd.addArgs(&[_][]const u8{ | 31 | docgen_cmd.addArgs(&[_][]const u8{ |
| 32 | rel_zig_exe, | 32 | rel_zig_exe, |
| 33 | "doc" ++ fs.path.sep_str ++ "langref.html.in", | 33 | "doc" ++ fs.path.sep_str ++ "langref.html.in", |
| ... | @@ -60,6 +60,7 @@ pub fn build(b: *Builder) !void { | ... | @@ -60,6 +60,7 @@ pub fn build(b: *Builder) !void { |
| 60 | const skip_install_lib_files = b.option(bool, "skip-install-lib-files", "Do not copy lib/ files to installation prefix") orelse false; | 60 | const skip_install_lib_files = b.option(bool, "skip-install-lib-files", "Do not copy lib/ files to installation prefix") orelse false; |
| 61 | 61 | ||
| 62 | const only_install_lib_files = b.option(bool, "lib-files-only", "Only install library files") orelse false; | 62 | const only_install_lib_files = b.option(bool, "lib-files-only", "Only install library files") orelse false; |
| 63 | |||
| 63 | const is_stage1 = b.option(bool, "stage1", "Build the stage1 compiler, put stage2 behind a feature flag") orelse false; | 64 | const is_stage1 = b.option(bool, "stage1", "Build the stage1 compiler, put stage2 behind a feature flag") orelse false; |
| 64 | const omit_stage2 = b.option(bool, "omit-stage2", "Do not include stage2 behind a feature flag inside stage1") orelse false; | 65 | const omit_stage2 = b.option(bool, "omit-stage2", "Do not include stage2 behind a feature flag inside stage1") orelse false; |
| 65 | const static_llvm = b.option(bool, "static-llvm", "Disable integration with system-installed LLVM, Clang, LLD, and libc++") orelse false; | 66 | const static_llvm = b.option(bool, "static-llvm", "Disable integration with system-installed LLVM, Clang, LLD, and libc++") orelse false; |
| ... | @@ -135,9 +136,9 @@ pub fn build(b: *Builder) !void { | ... | @@ -135,9 +136,9 @@ pub fn build(b: *Builder) !void { |
| 135 | break :blk 4; | 136 | break :blk 4; |
| 136 | }; | 137 | }; |
| 137 | 138 | ||
| 138 | const main_file = if (is_stage1) "src/stage1.zig" else "src/main.zig"; | 139 | const main_file: ?[]const u8 = if (is_stage1) null else "src/main.zig"; |
| 139 | 140 | ||
| 140 | var exe = b.addExecutable("zig", main_file); | 141 | const exe = b.addExecutable("zig", main_file); |
| 141 | exe.strip = strip; | 142 | exe.strip = strip; |
| 142 | exe.install(); | 143 | exe.install(); |
| 143 | exe.setBuildMode(mode); | 144 | exe.setBuildMode(mode); |
| ... | @@ -145,6 +146,7 @@ pub fn build(b: *Builder) !void { | ... | @@ -145,6 +146,7 @@ pub fn build(b: *Builder) !void { |
| 145 | if (!skip_stage2_tests) { | 146 | if (!skip_stage2_tests) { |
| 146 | toolchain_step.dependOn(&exe.step); | 147 | toolchain_step.dependOn(&exe.step); |
| 147 | } | 148 | } |
| 149 | |||
| 148 | b.default_step.dependOn(&exe.step); | 150 | b.default_step.dependOn(&exe.step); |
| 149 | exe.single_threaded = single_threaded; | 151 | exe.single_threaded = single_threaded; |
| 150 | 152 | ||
| ... | @@ -166,56 +168,6 @@ pub fn build(b: *Builder) !void { | ... | @@ -166,56 +168,6 @@ pub fn build(b: *Builder) !void { |
| 166 | exe_options.addOption(bool, "llvm_has_arc", llvm_has_arc); | 168 | exe_options.addOption(bool, "llvm_has_arc", llvm_has_arc); |
| 167 | exe_options.addOption(bool, "force_gpa", force_gpa); | 169 | exe_options.addOption(bool, "force_gpa", force_gpa); |
| 168 | 170 | ||
| 169 | if (enable_llvm) { | ||
| 170 | const cmake_cfg = if (static_llvm) null else findAndParseConfigH(b, config_h_path_option); | ||
| 171 | |||
| 172 | if (is_stage1) { | ||
| 173 | exe.addIncludePath("src"); | ||
| 174 | exe.addIncludePath("deps/SoftFloat-3e/source/include"); | ||
| 175 | |||
| 176 | test_stage2.addIncludePath("src"); | ||
| 177 | test_stage2.addIncludePath("deps/SoftFloat-3e/source/include"); | ||
| 178 | // This is intentionally a dummy path. stage1.zig tries to @import("compiler_rt") in case | ||
| 179 | // of being built by cmake. But when built by zig it's gonna get a compiler_rt so that | ||
| 180 | // is pointless. | ||
| 181 | exe.addPackagePath("compiler_rt", "src/empty.zig"); | ||
| 182 | exe.defineCMacro("ZIG_LINK_MODE", "Static"); | ||
| 183 | test_stage2.defineCMacro("ZIG_LINK_MODE", "Static"); | ||
| 184 | |||
| 185 | const softfloat = b.addStaticLibrary("softfloat", null); | ||
| 186 | softfloat.setBuildMode(.ReleaseFast); | ||
| 187 | softfloat.setTarget(target); | ||
| 188 | softfloat.addIncludePath("deps/SoftFloat-3e-prebuilt"); | ||
| 189 | softfloat.addIncludePath("deps/SoftFloat-3e/source/8086"); | ||
| 190 | softfloat.addIncludePath("deps/SoftFloat-3e/source/include"); | ||
| 191 | softfloat.addCSourceFiles(&softfloat_sources, &[_][]const u8{ "-std=c99", "-O3" }); | ||
| 192 | softfloat.single_threaded = single_threaded; | ||
| 193 | |||
| 194 | exe.linkLibrary(softfloat); | ||
| 195 | test_stage2.linkLibrary(softfloat); | ||
| 196 | |||
| 197 | exe.addCSourceFiles(&stage1_sources, &exe_cflags); | ||
| 198 | exe.addCSourceFiles(&optimized_c_sources, &[_][]const u8{ "-std=c99", "-O3" }); | ||
| 199 | |||
| 200 | test_stage2.addCSourceFiles(&stage1_sources, &exe_cflags); | ||
| 201 | test_stage2.addCSourceFiles(&optimized_c_sources, &[_][]const u8{ "-std=c99", "-O3" }); | ||
| 202 | } | ||
| 203 | if (cmake_cfg) |cfg| { | ||
| 204 | // Inside this code path, we have to coordinate with system packaged LLVM, Clang, and LLD. | ||
| 205 | // That means we also have to rely on stage1 compiled c++ files. We parse config.h to find | ||
| 206 | // the information passed on to us from cmake. | ||
| 207 | if (cfg.cmake_prefix_path.len > 0) { | ||
| 208 | b.addSearchPrefix(cfg.cmake_prefix_path); | ||
| 209 | } | ||
| 210 | |||
| 211 | try addCmakeCfgOptionsToExe(b, cfg, exe, use_zig_libcxx); | ||
| 212 | try addCmakeCfgOptionsToExe(b, cfg, test_stage2, use_zig_libcxx); | ||
| 213 | } else { | ||
| 214 | // Here we are -Denable-llvm but no cmake integration. | ||
| 215 | try addStaticLlvmOptionsToExe(exe); | ||
| 216 | try addStaticLlvmOptionsToExe(test_stage2); | ||
| 217 | } | ||
| 218 | } | ||
| 219 | if (link_libc) { | 171 | if (link_libc) { |
| 220 | exe.linkLibC(); | 172 | exe.linkLibC(); |
| 221 | test_stage2.linkLibC(); | 173 | test_stage2.linkLibC(); |
| ... | @@ -227,12 +179,12 @@ pub fn build(b: *Builder) !void { | ... | @@ -227,12 +179,12 @@ pub fn build(b: *Builder) !void { |
| 227 | 179 | ||
| 228 | const opt_version_string = b.option([]const u8, "version-string", "Override Zig version string. Default is to find out with git."); | 180 | const opt_version_string = b.option([]const u8, "version-string", "Override Zig version string. Default is to find out with git."); |
| 229 | const version = if (opt_version_string) |version| version else v: { | 181 | const version = if (opt_version_string) |version| version else v: { |
| 230 | const version_string = b.fmt("{d}.{d}.{d}", .{ zig_version.major, zig_version.minor, zig_version.patch }); | ||
| 231 | |||
| 232 | if (!std.process.can_spawn) { | 182 | if (!std.process.can_spawn) { |
| 233 | std.debug.print("error: version info cannot be retrieved from git. Zig version must be provided using -Dversion-string\n", .{}); | 183 | std.debug.print("error: version info cannot be retrieved from git. Zig version must be provided using -Dversion-string\n", .{}); |
| 234 | std.process.exit(1); | 184 | std.process.exit(1); |
| 235 | } | 185 | } |
| 186 | const version_string = b.fmt("{d}.{d}.{d}", .{ zig_version.major, zig_version.minor, zig_version.patch }); | ||
| 187 | |||
| 236 | var code: u8 = undefined; | 188 | var code: u8 = undefined; |
| 237 | const git_describe_untrimmed = b.execAllowFail(&[_][]const u8{ | 189 | const git_describe_untrimmed = b.execAllowFail(&[_][]const u8{ |
| 238 | "git", "-C", b.build_root, "describe", "--match", "*.*.*", "--tags", | 190 | "git", "-C", b.build_root, "describe", "--match", "*.*.*", "--tags", |
| ... | @@ -280,6 +232,108 @@ pub fn build(b: *Builder) !void { | ... | @@ -280,6 +232,108 @@ pub fn build(b: *Builder) !void { |
| 280 | }; | 232 | }; |
| 281 | exe_options.addOption([:0]const u8, "version", try b.allocator.dupeZ(u8, version)); | 233 | exe_options.addOption([:0]const u8, "version", try b.allocator.dupeZ(u8, version)); |
| 282 | 234 | ||
| 235 | if (enable_llvm) { | ||
| 236 | const cmake_cfg = if (static_llvm) null else findAndParseConfigH(b, config_h_path_option); | ||
| 237 | |||
| 238 | if (is_stage1) { | ||
| 239 | const softfloat = b.addStaticLibrary("softfloat", null); | ||
| 240 | softfloat.setBuildMode(.ReleaseFast); | ||
| 241 | softfloat.setTarget(target); | ||
| 242 | softfloat.addIncludePath("deps/SoftFloat-3e-prebuilt"); | ||
| 243 | softfloat.addIncludePath("deps/SoftFloat-3e/source/8086"); | ||
| 244 | softfloat.addIncludePath("deps/SoftFloat-3e/source/include"); | ||
| 245 | softfloat.addCSourceFiles(&softfloat_sources, &[_][]const u8{ "-std=c99", "-O3" }); | ||
| 246 | softfloat.single_threaded = single_threaded; | ||
| 247 | |||
| 248 | const zig0 = b.addExecutable("zig0", null); | ||
| 249 | zig0.addCSourceFiles(&.{"src/stage1/zig0.cpp"}, &exe_cflags); | ||
| 250 | zig0.addIncludePath("zig-cache/tmp"); // for config.h | ||
| 251 | zig0.defineCMacro("ZIG_VERSION_MAJOR", b.fmt("{d}", .{zig_version.major})); | ||
| 252 | zig0.defineCMacro("ZIG_VERSION_MINOR", b.fmt("{d}", .{zig_version.minor})); | ||
| 253 | zig0.defineCMacro("ZIG_VERSION_PATCH", b.fmt("{d}", .{zig_version.patch})); | ||
| 254 | zig0.defineCMacro("ZIG_VERSION_STRING", b.fmt("\"{s}\"", .{version})); | ||
| 255 | |||
| 256 | for ([_]*std.build.LibExeObjStep{ zig0, exe }) |artifact| { | ||
| 257 | artifact.addIncludePath("src"); | ||
| 258 | artifact.addIncludePath("deps/SoftFloat-3e/source/include"); | ||
| 259 | artifact.addIncludePath("deps/SoftFloat-3e-prebuilt"); | ||
| 260 | |||
| 261 | artifact.defineCMacro("ZIG_LINK_MODE", "Static"); | ||
| 262 | |||
| 263 | artifact.addCSourceFiles(&stage1_sources, &exe_cflags); | ||
| 264 | artifact.addCSourceFiles(&optimized_c_sources, &[_][]const u8{ "-std=c99", "-O3" }); | ||
| 265 | |||
| 266 | artifact.linkLibrary(softfloat); | ||
| 267 | artifact.linkLibCpp(); | ||
| 268 | } | ||
| 269 | |||
| 270 | try addStaticLlvmOptionsToExe(zig0); | ||
| 271 | |||
| 272 | const zig1_obj_ext = target.getObjectFormat().fileExt(target.getCpuArch()); | ||
| 273 | const zig1_obj_path = b.pathJoin(&.{ "zig-cache", "tmp", b.fmt("zig1{s}", .{zig1_obj_ext}) }); | ||
| 274 | const zig1_compiler_rt_path = b.pathJoin(&.{ b.pathFromRoot("lib"), "std", "special", "compiler_rt.zig" }); | ||
| 275 | |||
| 276 | const zig1_obj = zig0.run(); | ||
| 277 | zig1_obj.addArgs(&.{ | ||
| 278 | "src/stage1.zig", | ||
| 279 | "-target", | ||
| 280 | try target.zigTriple(b.allocator), | ||
| 281 | "-mcpu=baseline", | ||
| 282 | "--name", | ||
| 283 | "zig1", | ||
| 284 | "--zig-lib-dir", | ||
| 285 | b.pathFromRoot("lib"), | ||
| 286 | b.fmt("-femit-bin={s}", .{b.pathFromRoot(zig1_obj_path)}), | ||
| 287 | "-fcompiler-rt", | ||
| 288 | "-lc", | ||
| 289 | }); | ||
| 290 | { | ||
| 291 | zig1_obj.addArgs(&.{ "--pkg-begin", "build_options" }); | ||
| 292 | zig1_obj.addFileSourceArg(exe_options.getSource()); | ||
| 293 | zig1_obj.addArgs(&.{ "--pkg-end", "--pkg-begin", "compiler_rt", zig1_compiler_rt_path, "--pkg-end" }); | ||
| 294 | } | ||
| 295 | switch (mode) { | ||
| 296 | .Debug => {}, | ||
| 297 | .ReleaseFast => { | ||
| 298 | zig1_obj.addArg("-OReleaseFast"); | ||
| 299 | zig1_obj.addArg("--strip"); | ||
| 300 | }, | ||
| 301 | .ReleaseSafe => { | ||
| 302 | zig1_obj.addArg("-OReleaseSafe"); | ||
| 303 | zig1_obj.addArg("--strip"); | ||
| 304 | }, | ||
| 305 | .ReleaseSmall => { | ||
| 306 | zig1_obj.addArg("-OReleaseSmall"); | ||
| 307 | zig1_obj.addArg("--strip"); | ||
| 308 | }, | ||
| 309 | } | ||
| 310 | if (single_threaded orelse false) { | ||
| 311 | zig1_obj.addArg("-fsingle-threaded"); | ||
| 312 | } | ||
| 313 | |||
| 314 | exe.step.dependOn(&zig1_obj.step); | ||
| 315 | exe.addObjectFile(zig1_obj_path); | ||
| 316 | |||
| 317 | // This is intentionally a dummy path. stage1.zig tries to @import("compiler_rt") in case | ||
| 318 | // of being built by cmake. But when built by zig it's gonna get a compiler_rt so that | ||
| 319 | // is pointless. | ||
| 320 | exe.addPackagePath("compiler_rt", "src/empty.zig"); | ||
| 321 | } | ||
| 322 | if (cmake_cfg) |cfg| { | ||
| 323 | // Inside this code path, we have to coordinate with system packaged LLVM, Clang, and LLD. | ||
| 324 | // That means we also have to rely on stage1 compiled c++ files. We parse config.h to find | ||
| 325 | // the information passed on to us from cmake. | ||
| 326 | if (cfg.cmake_prefix_path.len > 0) { | ||
| 327 | b.addSearchPrefix(cfg.cmake_prefix_path); | ||
| 328 | } | ||
| 329 | |||
| 330 | try addCmakeCfgOptionsToExe(b, cfg, exe, use_zig_libcxx); | ||
| 331 | } else { | ||
| 332 | // Here we are -Denable-llvm but no cmake integration. | ||
| 333 | try addStaticLlvmOptionsToExe(exe); | ||
| 334 | } | ||
| 335 | } | ||
| 336 | |||
| 283 | const semver = try std.SemanticVersion.parse(version); | 337 | const semver = try std.SemanticVersion.parse(version); |
| 284 | exe_options.addOption(std.SemanticVersion, "semver", semver); | 338 | exe_options.addOption(std.SemanticVersion, "semver", semver); |
| 285 | 339 | ||
| ... | @@ -548,7 +602,6 @@ fn addCxxKnownPath( | ... | @@ -548,7 +602,6 @@ fn addCxxKnownPath( |
| 548 | ) !void { | 602 | ) !void { |
| 549 | if (!std.process.can_spawn) | 603 | if (!std.process.can_spawn) |
| 550 | return error.RequiredLibraryNotFound; | 604 | return error.RequiredLibraryNotFound; |
| 551 | |||
| 552 | const path_padded = try b.exec(&[_][]const u8{ | 605 | const path_padded = try b.exec(&[_][]const u8{ |
| 553 | ctx.cxx_compiler, | 606 | ctx.cxx_compiler, |
| 554 | b.fmt("-print-file-name={s}", .{objname}), | 607 | b.fmt("-print-file-name={s}", .{objname}), |
| ... | @@ -695,15 +748,19 @@ fn toNativePathSep(b: *Builder, s: []const u8) []u8 { | ... | @@ -695,15 +748,19 @@ fn toNativePathSep(b: *Builder, s: []const u8) []u8 { |
| 695 | 748 | ||
| 696 | const softfloat_sources = [_][]const u8{ | 749 | const softfloat_sources = [_][]const u8{ |
| 697 | "deps/SoftFloat-3e/source/8086/f128M_isSignalingNaN.c", | 750 | "deps/SoftFloat-3e/source/8086/f128M_isSignalingNaN.c", |
| 751 | "deps/SoftFloat-3e/source/8086/extF80M_isSignalingNaN.c", | ||
| 698 | "deps/SoftFloat-3e/source/8086/s_commonNaNToF128M.c", | 752 | "deps/SoftFloat-3e/source/8086/s_commonNaNToF128M.c", |
| 753 | "deps/SoftFloat-3e/source/8086/s_commonNaNToExtF80M.c", | ||
| 699 | "deps/SoftFloat-3e/source/8086/s_commonNaNToF16UI.c", | 754 | "deps/SoftFloat-3e/source/8086/s_commonNaNToF16UI.c", |
| 700 | "deps/SoftFloat-3e/source/8086/s_commonNaNToF32UI.c", | 755 | "deps/SoftFloat-3e/source/8086/s_commonNaNToF32UI.c", |
| 701 | "deps/SoftFloat-3e/source/8086/s_commonNaNToF64UI.c", | 756 | "deps/SoftFloat-3e/source/8086/s_commonNaNToF64UI.c", |
| 702 | "deps/SoftFloat-3e/source/8086/s_f128MToCommonNaN.c", | 757 | "deps/SoftFloat-3e/source/8086/s_f128MToCommonNaN.c", |
| 758 | "deps/SoftFloat-3e/source/8086/s_extF80MToCommonNaN.c", | ||
| 703 | "deps/SoftFloat-3e/source/8086/s_f16UIToCommonNaN.c", | 759 | "deps/SoftFloat-3e/source/8086/s_f16UIToCommonNaN.c", |
| 704 | "deps/SoftFloat-3e/source/8086/s_f32UIToCommonNaN.c", | 760 | "deps/SoftFloat-3e/source/8086/s_f32UIToCommonNaN.c", |
| 705 | "deps/SoftFloat-3e/source/8086/s_f64UIToCommonNaN.c", | 761 | "deps/SoftFloat-3e/source/8086/s_f64UIToCommonNaN.c", |
| 706 | "deps/SoftFloat-3e/source/8086/s_propagateNaNF128M.c", | 762 | "deps/SoftFloat-3e/source/8086/s_propagateNaNF128M.c", |
| 763 | "deps/SoftFloat-3e/source/8086/s_propagateNaNExtF80M.c", | ||
| 707 | "deps/SoftFloat-3e/source/8086/s_propagateNaNF16UI.c", | 764 | "deps/SoftFloat-3e/source/8086/s_propagateNaNF16UI.c", |
| 708 | "deps/SoftFloat-3e/source/8086/softfloat_raiseFlags.c", | 765 | "deps/SoftFloat-3e/source/8086/softfloat_raiseFlags.c", |
| 709 | "deps/SoftFloat-3e/source/f128M_add.c", | 766 | "deps/SoftFloat-3e/source/f128M_add.c", |
| ... | @@ -723,6 +780,7 @@ const softfloat_sources = [_][]const u8{ | ... | @@ -723,6 +780,7 @@ const softfloat_sources = [_][]const u8{ |
| 723 | "deps/SoftFloat-3e/source/f128M_to_f16.c", | 780 | "deps/SoftFloat-3e/source/f128M_to_f16.c", |
| 724 | "deps/SoftFloat-3e/source/f128M_to_f32.c", | 781 | "deps/SoftFloat-3e/source/f128M_to_f32.c", |
| 725 | "deps/SoftFloat-3e/source/f128M_to_f64.c", | 782 | "deps/SoftFloat-3e/source/f128M_to_f64.c", |
| 783 | "deps/SoftFloat-3e/source/f128M_to_extF80M.c", | ||
| 726 | "deps/SoftFloat-3e/source/f128M_to_i32.c", | 784 | "deps/SoftFloat-3e/source/f128M_to_i32.c", |
| 727 | "deps/SoftFloat-3e/source/f128M_to_i32_r_minMag.c", | 785 | "deps/SoftFloat-3e/source/f128M_to_i32_r_minMag.c", |
| 728 | "deps/SoftFloat-3e/source/f128M_to_i64.c", | 786 | "deps/SoftFloat-3e/source/f128M_to_i64.c", |
| ... | @@ -731,6 +789,20 @@ const softfloat_sources = [_][]const u8{ | ... | @@ -731,6 +789,20 @@ const softfloat_sources = [_][]const u8{ |
| 731 | "deps/SoftFloat-3e/source/f128M_to_ui32_r_minMag.c", | 789 | "deps/SoftFloat-3e/source/f128M_to_ui32_r_minMag.c", |
| 732 | "deps/SoftFloat-3e/source/f128M_to_ui64.c", | 790 | "deps/SoftFloat-3e/source/f128M_to_ui64.c", |
| 733 | "deps/SoftFloat-3e/source/f128M_to_ui64_r_minMag.c", | 791 | "deps/SoftFloat-3e/source/f128M_to_ui64_r_minMag.c", |
| 792 | "deps/SoftFloat-3e/source/extF80M_add.c", | ||
| 793 | "deps/SoftFloat-3e/source/extF80M_div.c", | ||
| 794 | "deps/SoftFloat-3e/source/extF80M_eq.c", | ||
| 795 | "deps/SoftFloat-3e/source/extF80M_le.c", | ||
| 796 | "deps/SoftFloat-3e/source/extF80M_lt.c", | ||
| 797 | "deps/SoftFloat-3e/source/extF80M_mul.c", | ||
| 798 | "deps/SoftFloat-3e/source/extF80M_rem.c", | ||
| 799 | "deps/SoftFloat-3e/source/extF80M_roundToInt.c", | ||
| 800 | "deps/SoftFloat-3e/source/extF80M_sqrt.c", | ||
| 801 | "deps/SoftFloat-3e/source/extF80M_sub.c", | ||
| 802 | "deps/SoftFloat-3e/source/extF80M_to_f16.c", | ||
| 803 | "deps/SoftFloat-3e/source/extF80M_to_f32.c", | ||
| 804 | "deps/SoftFloat-3e/source/extF80M_to_f64.c", | ||
| 805 | "deps/SoftFloat-3e/source/extF80M_to_f128M.c", | ||
| 734 | "deps/SoftFloat-3e/source/f16_add.c", | 806 | "deps/SoftFloat-3e/source/f16_add.c", |
| 735 | "deps/SoftFloat-3e/source/f16_div.c", | 807 | "deps/SoftFloat-3e/source/f16_div.c", |
| 736 | "deps/SoftFloat-3e/source/f16_eq.c", | 808 | "deps/SoftFloat-3e/source/f16_eq.c", |
| ... | @@ -742,9 +814,12 @@ const softfloat_sources = [_][]const u8{ | ... | @@ -742,9 +814,12 @@ const softfloat_sources = [_][]const u8{ |
| 742 | "deps/SoftFloat-3e/source/f16_roundToInt.c", | 814 | "deps/SoftFloat-3e/source/f16_roundToInt.c", |
| 743 | "deps/SoftFloat-3e/source/f16_sqrt.c", | 815 | "deps/SoftFloat-3e/source/f16_sqrt.c", |
| 744 | "deps/SoftFloat-3e/source/f16_sub.c", | 816 | "deps/SoftFloat-3e/source/f16_sub.c", |
| 817 | "deps/SoftFloat-3e/source/f16_to_extF80M.c", | ||
| 745 | "deps/SoftFloat-3e/source/f16_to_f128M.c", | 818 | "deps/SoftFloat-3e/source/f16_to_f128M.c", |
| 746 | "deps/SoftFloat-3e/source/f16_to_f64.c", | 819 | "deps/SoftFloat-3e/source/f16_to_f64.c", |
| 820 | "deps/SoftFloat-3e/source/f32_to_extF80M.c", | ||
| 747 | "deps/SoftFloat-3e/source/f32_to_f128M.c", | 821 | "deps/SoftFloat-3e/source/f32_to_f128M.c", |
| 822 | "deps/SoftFloat-3e/source/f64_to_extF80M.c", | ||
| 748 | "deps/SoftFloat-3e/source/f64_to_f128M.c", | 823 | "deps/SoftFloat-3e/source/f64_to_f128M.c", |
| 749 | "deps/SoftFloat-3e/source/f64_to_f16.c", | 824 | "deps/SoftFloat-3e/source/f64_to_f16.c", |
| 750 | "deps/SoftFloat-3e/source/i32_to_f128M.c", | 825 | "deps/SoftFloat-3e/source/i32_to_f128M.c", |
| ... | @@ -752,6 +827,7 @@ const softfloat_sources = [_][]const u8{ | ... | @@ -752,6 +827,7 @@ const softfloat_sources = [_][]const u8{ |
| 752 | "deps/SoftFloat-3e/source/s_addCarryM.c", | 827 | "deps/SoftFloat-3e/source/s_addCarryM.c", |
| 753 | "deps/SoftFloat-3e/source/s_addComplCarryM.c", | 828 | "deps/SoftFloat-3e/source/s_addComplCarryM.c", |
| 754 | "deps/SoftFloat-3e/source/s_addF128M.c", | 829 | "deps/SoftFloat-3e/source/s_addF128M.c", |
| 830 | "deps/SoftFloat-3e/source/s_addExtF80M.c", | ||
| 755 | "deps/SoftFloat-3e/source/s_addM.c", | 831 | "deps/SoftFloat-3e/source/s_addM.c", |
| 756 | "deps/SoftFloat-3e/source/s_addMagsF16.c", | 832 | "deps/SoftFloat-3e/source/s_addMagsF16.c", |
| 757 | "deps/SoftFloat-3e/source/s_addMagsF32.c", | 833 | "deps/SoftFloat-3e/source/s_addMagsF32.c", |
| ... | @@ -762,12 +838,14 @@ const softfloat_sources = [_][]const u8{ | ... | @@ -762,12 +838,14 @@ const softfloat_sources = [_][]const u8{ |
| 762 | "deps/SoftFloat-3e/source/s_approxRecip_1Ks.c", | 838 | "deps/SoftFloat-3e/source/s_approxRecip_1Ks.c", |
| 763 | "deps/SoftFloat-3e/source/s_compare128M.c", | 839 | "deps/SoftFloat-3e/source/s_compare128M.c", |
| 764 | "deps/SoftFloat-3e/source/s_compare96M.c", | 840 | "deps/SoftFloat-3e/source/s_compare96M.c", |
| 841 | "deps/SoftFloat-3e/source/s_compareNonnormExtF80M.c", | ||
| 765 | "deps/SoftFloat-3e/source/s_countLeadingZeros16.c", | 842 | "deps/SoftFloat-3e/source/s_countLeadingZeros16.c", |
| 766 | "deps/SoftFloat-3e/source/s_countLeadingZeros32.c", | 843 | "deps/SoftFloat-3e/source/s_countLeadingZeros32.c", |
| 767 | "deps/SoftFloat-3e/source/s_countLeadingZeros64.c", | 844 | "deps/SoftFloat-3e/source/s_countLeadingZeros64.c", |
| 768 | "deps/SoftFloat-3e/source/s_countLeadingZeros8.c", | 845 | "deps/SoftFloat-3e/source/s_countLeadingZeros8.c", |
| 769 | "deps/SoftFloat-3e/source/s_eq128.c", | 846 | "deps/SoftFloat-3e/source/s_eq128.c", |
| 770 | "deps/SoftFloat-3e/source/s_invalidF128M.c", | 847 | "deps/SoftFloat-3e/source/s_invalidF128M.c", |
| 848 | "deps/SoftFloat-3e/source/s_invalidExtF80M.c", | ||
| 771 | "deps/SoftFloat-3e/source/s_isNaNF128M.c", | 849 | "deps/SoftFloat-3e/source/s_isNaNF128M.c", |
| 772 | "deps/SoftFloat-3e/source/s_le128.c", | 850 | "deps/SoftFloat-3e/source/s_le128.c", |
| 773 | "deps/SoftFloat-3e/source/s_lt128.c", | 851 | "deps/SoftFloat-3e/source/s_lt128.c", |
| ... | @@ -778,7 +856,9 @@ const softfloat_sources = [_][]const u8{ | ... | @@ -778,7 +856,9 @@ const softfloat_sources = [_][]const u8{ |
| 778 | "deps/SoftFloat-3e/source/s_mulAddF32.c", | 856 | "deps/SoftFloat-3e/source/s_mulAddF32.c", |
| 779 | "deps/SoftFloat-3e/source/s_mulAddF64.c", | 857 | "deps/SoftFloat-3e/source/s_mulAddF64.c", |
| 780 | "deps/SoftFloat-3e/source/s_negXM.c", | 858 | "deps/SoftFloat-3e/source/s_negXM.c", |
| 859 | "deps/SoftFloat-3e/source/s_normExtF80SigM.c", | ||
| 781 | "deps/SoftFloat-3e/source/s_normRoundPackMToF128M.c", | 860 | "deps/SoftFloat-3e/source/s_normRoundPackMToF128M.c", |
| 861 | "deps/SoftFloat-3e/source/s_normRoundPackMToExtF80M.c", | ||
| 782 | "deps/SoftFloat-3e/source/s_normRoundPackToF16.c", | 862 | "deps/SoftFloat-3e/source/s_normRoundPackToF16.c", |
| 783 | "deps/SoftFloat-3e/source/s_normRoundPackToF32.c", | 863 | "deps/SoftFloat-3e/source/s_normRoundPackToF32.c", |
| 784 | "deps/SoftFloat-3e/source/s_normRoundPackToF64.c", | 864 | "deps/SoftFloat-3e/source/s_normRoundPackToF64.c", |
| ... | @@ -789,6 +869,7 @@ const softfloat_sources = [_][]const u8{ | ... | @@ -789,6 +869,7 @@ const softfloat_sources = [_][]const u8{ |
| 789 | "deps/SoftFloat-3e/source/s_remStepMBy32.c", | 869 | "deps/SoftFloat-3e/source/s_remStepMBy32.c", |
| 790 | "deps/SoftFloat-3e/source/s_roundMToI64.c", | 870 | "deps/SoftFloat-3e/source/s_roundMToI64.c", |
| 791 | "deps/SoftFloat-3e/source/s_roundMToUI64.c", | 871 | "deps/SoftFloat-3e/source/s_roundMToUI64.c", |
| 872 | "deps/SoftFloat-3e/source/s_roundPackMToExtF80M.c", | ||
| 792 | "deps/SoftFloat-3e/source/s_roundPackMToF128M.c", | 873 | "deps/SoftFloat-3e/source/s_roundPackMToF128M.c", |
| 793 | "deps/SoftFloat-3e/source/s_roundPackToF16.c", | 874 | "deps/SoftFloat-3e/source/s_roundPackToF16.c", |
| 794 | "deps/SoftFloat-3e/source/s_roundPackToF32.c", | 875 | "deps/SoftFloat-3e/source/s_roundPackToF32.c", |
| ... | @@ -817,9 +898,12 @@ const softfloat_sources = [_][]const u8{ | ... | @@ -817,9 +898,12 @@ const softfloat_sources = [_][]const u8{ |
| 817 | "deps/SoftFloat-3e/source/s_subMagsF32.c", | 898 | "deps/SoftFloat-3e/source/s_subMagsF32.c", |
| 818 | "deps/SoftFloat-3e/source/s_subMagsF64.c", | 899 | "deps/SoftFloat-3e/source/s_subMagsF64.c", |
| 819 | "deps/SoftFloat-3e/source/s_tryPropagateNaNF128M.c", | 900 | "deps/SoftFloat-3e/source/s_tryPropagateNaNF128M.c", |
| 901 | "deps/SoftFloat-3e/source/s_tryPropagateNaNExtF80M.c", | ||
| 820 | "deps/SoftFloat-3e/source/softfloat_state.c", | 902 | "deps/SoftFloat-3e/source/softfloat_state.c", |
| 821 | "deps/SoftFloat-3e/source/ui32_to_f128M.c", | 903 | "deps/SoftFloat-3e/source/ui32_to_f128M.c", |
| 822 | "deps/SoftFloat-3e/source/ui64_to_f128M.c", | 904 | "deps/SoftFloat-3e/source/ui64_to_f128M.c", |
| 905 | "deps/SoftFloat-3e/source/ui32_to_extF80M.c", | ||
| 906 | "deps/SoftFloat-3e/source/ui64_to_extF80M.c", | ||
| 823 | }; | 907 | }; |
| 824 | 908 | ||
| 825 | const stage1_sources = [_][]const u8{ | 909 | const stage1_sources = [_][]const u8{ |
ci/azure/build.zig created+978| ... | @@ -0,0 +1,978 @@ | ||
| 1 | const std = @import("std"); | ||
| 2 | const builtin = std.builtin; | ||
| 3 | const Builder = std.build.Builder; | ||
| 4 | const BufMap = std.BufMap; | ||
| 5 | const mem = std.mem; | ||
| 6 | const ArrayList = std.ArrayList; | ||
| 7 | const io = std.io; | ||
| 8 | const fs = std.fs; | ||
| 9 | const InstallDirectoryOptions = std.build.InstallDirectoryOptions; | ||
| 10 | const assert = std.debug.assert; | ||
| 11 | |||
| 12 | const zig_version = std.builtin.Version{ .major = 0, .minor = 10, .patch = 0 }; | ||
| 13 | |||
| 14 | pub fn build(b: *Builder) !void { | ||
| 15 | b.setPreferredReleaseMode(.ReleaseFast); | ||
| 16 | const mode = b.standardReleaseOptions(); | ||
| 17 | const target = b.standardTargetOptions(.{}); | ||
| 18 | const single_threaded = b.option(bool, "single-threaded", "Build artifacts that run in single threaded mode"); | ||
| 19 | const use_zig_libcxx = b.option(bool, "use-zig-libcxx", "If libc++ is needed, use zig's bundled version, don't try to integrate with the system") orelse false; | ||
| 20 | |||
| 21 | const docgen_exe = b.addExecutable("docgen", "doc/docgen.zig"); | ||
| 22 | docgen_exe.single_threaded = single_threaded; | ||
| 23 | |||
| 24 | const rel_zig_exe = try fs.path.relative(b.allocator, b.build_root, b.zig_exe); | ||
| 25 | const langref_out_path = fs.path.join( | ||
| 26 | b.allocator, | ||
| 27 | &[_][]const u8{ b.cache_root, "langref.html" }, | ||
| 28 | ) catch unreachable; | ||
| 29 | const docgen_cmd = docgen_exe.run(); | ||
| 30 | docgen_cmd.addArgs(&[_][]const u8{ | ||
| 31 | rel_zig_exe, | ||
| 32 | "doc" ++ fs.path.sep_str ++ "langref.html.in", | ||
| 33 | langref_out_path, | ||
| 34 | }); | ||
| 35 | docgen_cmd.step.dependOn(&docgen_exe.step); | ||
| 36 | |||
| 37 | const docs_step = b.step("docs", "Build documentation"); | ||
| 38 | docs_step.dependOn(&docgen_cmd.step); | ||
| 39 | |||
| 40 | const is_stage1 = b.option(bool, "stage1", "Build the stage1 compiler, put stage2 behind a feature flag") orelse false; | ||
| 41 | const omit_stage2 = b.option(bool, "omit-stage2", "Do not include stage2 behind a feature flag inside stage1") orelse false; | ||
| 42 | const static_llvm = b.option(bool, "static-llvm", "Disable integration with system-installed LLVM, Clang, LLD, and libc++") orelse false; | ||
| 43 | const enable_llvm = b.option(bool, "enable-llvm", "Build self-hosted compiler with LLVM backend enabled") orelse (is_stage1 or static_llvm); | ||
| 44 | const llvm_has_m68k = b.option( | ||
| 45 | bool, | ||
| 46 | "llvm-has-m68k", | ||
| 47 | "Whether LLVM has the experimental target m68k enabled", | ||
| 48 | ) orelse false; | ||
| 49 | const llvm_has_csky = b.option( | ||
| 50 | bool, | ||
| 51 | "llvm-has-csky", | ||
| 52 | "Whether LLVM has the experimental target csky enabled", | ||
| 53 | ) orelse false; | ||
| 54 | const llvm_has_ve = b.option( | ||
| 55 | bool, | ||
| 56 | "llvm-has-ve", | ||
| 57 | "Whether LLVM has the experimental target ve enabled", | ||
| 58 | ) orelse false; | ||
| 59 | const llvm_has_arc = b.option( | ||
| 60 | bool, | ||
| 61 | "llvm-has-arc", | ||
| 62 | "Whether LLVM has the experimental target arc enabled", | ||
| 63 | ) orelse false; | ||
| 64 | const config_h_path_option = b.option([]const u8, "config_h", "Path to the generated config.h"); | ||
| 65 | |||
| 66 | b.installDirectory(InstallDirectoryOptions{ | ||
| 67 | .source_dir = "lib", | ||
| 68 | .install_dir = .lib, | ||
| 69 | .install_subdir = "zig", | ||
| 70 | .exclude_extensions = &[_][]const u8{ | ||
| 71 | // exclude files from lib/std/compress/ | ||
| 72 | ".gz", | ||
| 73 | ".z.0", | ||
| 74 | ".z.9", | ||
| 75 | "rfc1951.txt", | ||
| 76 | "rfc1952.txt", | ||
| 77 | // exclude files from lib/std/compress/deflate/testdata | ||
| 78 | ".expect", | ||
| 79 | ".expect-noinput", | ||
| 80 | ".golden", | ||
| 81 | ".input", | ||
| 82 | "compress-e.txt", | ||
| 83 | "compress-gettysburg.txt", | ||
| 84 | "compress-pi.txt", | ||
| 85 | "rfc1951.txt", | ||
| 86 | // exclude files from lib/std/tz/ | ||
| 87 | ".tzif", | ||
| 88 | // others | ||
| 89 | "README.md", | ||
| 90 | }, | ||
| 91 | .blank_extensions = &[_][]const u8{ | ||
| 92 | "test.zig", | ||
| 93 | }, | ||
| 94 | }); | ||
| 95 | |||
| 96 | const tracy = b.option([]const u8, "tracy", "Enable Tracy integration. Supply path to Tracy source"); | ||
| 97 | const tracy_callstack = b.option(bool, "tracy-callstack", "Include callstack information with Tracy data. Does nothing if -Dtracy is not provided") orelse false; | ||
| 98 | const tracy_allocation = b.option(bool, "tracy-allocation", "Include allocation information with Tracy data. Does nothing if -Dtracy is not provided") orelse false; | ||
| 99 | const force_gpa = b.option(bool, "force-gpa", "Force the compiler to use GeneralPurposeAllocator") orelse false; | ||
| 100 | const link_libc = b.option(bool, "force-link-libc", "Force self-hosted compiler to link libc") orelse enable_llvm; | ||
| 101 | const strip = b.option(bool, "strip", "Omit debug information") orelse false; | ||
| 102 | |||
| 103 | const mem_leak_frames: u32 = b.option(u32, "mem-leak-frames", "How many stack frames to print when a memory leak occurs. Tests get 2x this amount.") orelse blk: { | ||
| 104 | if (strip) break :blk @as(u32, 0); | ||
| 105 | if (mode != .Debug) break :blk 0; | ||
| 106 | break :blk 4; | ||
| 107 | }; | ||
| 108 | |||
| 109 | const main_file: ?[]const u8 = if (is_stage1) null else "src/main.zig"; | ||
| 110 | |||
| 111 | const exe = b.addExecutable("zig", main_file); | ||
| 112 | exe.strip = strip; | ||
| 113 | exe.install(); | ||
| 114 | exe.setBuildMode(mode); | ||
| 115 | exe.setTarget(target); | ||
| 116 | |||
| 117 | b.default_step.dependOn(&exe.step); | ||
| 118 | exe.single_threaded = single_threaded; | ||
| 119 | |||
| 120 | if (target.isWindows() and target.getAbi() == .gnu) { | ||
| 121 | // LTO is currently broken on mingw, this can be removed when it's fixed. | ||
| 122 | exe.want_lto = false; | ||
| 123 | } | ||
| 124 | |||
| 125 | const exe_options = b.addOptions(); | ||
| 126 | exe.addOptions("build_options", exe_options); | ||
| 127 | |||
| 128 | exe_options.addOption(u32, "mem_leak_frames", mem_leak_frames); | ||
| 129 | exe_options.addOption(bool, "skip_non_native", false); | ||
| 130 | exe_options.addOption(bool, "have_llvm", enable_llvm); | ||
| 131 | exe_options.addOption(bool, "llvm_has_m68k", llvm_has_m68k); | ||
| 132 | exe_options.addOption(bool, "llvm_has_csky", llvm_has_csky); | ||
| 133 | exe_options.addOption(bool, "llvm_has_ve", llvm_has_ve); | ||
| 134 | exe_options.addOption(bool, "llvm_has_arc", llvm_has_arc); | ||
| 135 | exe_options.addOption(bool, "force_gpa", force_gpa); | ||
| 136 | |||
| 137 | if (link_libc) { | ||
| 138 | exe.linkLibC(); | ||
| 139 | } | ||
| 140 | |||
| 141 | const is_debug = mode == .Debug; | ||
| 142 | const enable_logging = b.option(bool, "log", "Enable debug logging with --debug-log") orelse is_debug; | ||
| 143 | const enable_link_snapshots = b.option(bool, "link-snapshot", "Whether to enable linker state snapshots") orelse false; | ||
| 144 | |||
| 145 | const opt_version_string = b.option([]const u8, "version-string", "Override Zig version string. Default is to find out with git."); | ||
| 146 | const version = if (opt_version_string) |version| version else v: { | ||
| 147 | const version_string = b.fmt("{d}.{d}.{d}", .{ zig_version.major, zig_version.minor, zig_version.patch }); | ||
| 148 | |||
| 149 | var code: u8 = undefined; | ||
| 150 | const git_describe_untrimmed = b.execAllowFail(&[_][]const u8{ | ||
| 151 | "git", "-C", b.build_root, "describe", "--match", "*.*.*", "--tags", | ||
| 152 | }, &code, .Ignore) catch { | ||
| 153 | break :v version_string; | ||
| 154 | }; | ||
| 155 | const git_describe = mem.trim(u8, git_describe_untrimmed, " \n\r"); | ||
| 156 | |||
| 157 | switch (mem.count(u8, git_describe, "-")) { | ||
| 158 | 0 => { | ||
| 159 | // Tagged release version (e.g. 0.9.0). | ||
| 160 | if (!mem.eql(u8, git_describe, version_string)) { | ||
| 161 | std.debug.print("Zig version '{s}' does not match Git tag '{s}'\n", .{ version_string, git_describe }); | ||
| 162 | std.process.exit(1); | ||
| 163 | } | ||
| 164 | break :v version_string; | ||
| 165 | }, | ||
| 166 | 2 => { | ||
| 167 | // Untagged development build (e.g. 0.9.0-dev.2025+ecf0050a9). | ||
| 168 | var it = mem.split(u8, git_describe, "-"); | ||
| 169 | const tagged_ancestor = it.next() orelse unreachable; | ||
| 170 | const commit_height = it.next() orelse unreachable; | ||
| 171 | const commit_id = it.next() orelse unreachable; | ||
| 172 | |||
| 173 | const ancestor_ver = try std.builtin.Version.parse(tagged_ancestor); | ||
| 174 | if (zig_version.order(ancestor_ver) != .gt) { | ||
| 175 | std.debug.print("Zig version '{}' must be greater than tagged ancestor '{}'\n", .{ zig_version, ancestor_ver }); | ||
| 176 | std.process.exit(1); | ||
| 177 | } | ||
| 178 | |||
| 179 | // Check that the commit hash is prefixed with a 'g' (a Git convention). | ||
| 180 | if (commit_id.len < 1 or commit_id[0] != 'g') { | ||
| 181 | std.debug.print("Unexpected `git describe` output: {s}\n", .{git_describe}); | ||
| 182 | break :v version_string; | ||
| 183 | } | ||
| 184 | |||
| 185 | // The version is reformatted in accordance with the https://semver.org specification. | ||
| 186 | break :v b.fmt("{s}-dev.{s}+{s}", .{ version_string, commit_height, commit_id[1..] }); | ||
| 187 | }, | ||
| 188 | else => { | ||
| 189 | std.debug.print("Unexpected `git describe` output: {s}\n", .{git_describe}); | ||
| 190 | break :v version_string; | ||
| 191 | }, | ||
| 192 | } | ||
| 193 | }; | ||
| 194 | exe_options.addOption([:0]const u8, "version", try b.allocator.dupeZ(u8, version)); | ||
| 195 | |||
| 196 | if (enable_llvm) { | ||
| 197 | const cmake_cfg = if (static_llvm) null else findAndParseConfigH(b, config_h_path_option); | ||
| 198 | |||
| 199 | if (is_stage1) { | ||
| 200 | const softfloat = b.addStaticLibrary("softfloat", null); | ||
| 201 | softfloat.setBuildMode(.ReleaseFast); | ||
| 202 | softfloat.setTarget(target); | ||
| 203 | softfloat.addIncludeDir("deps/SoftFloat-3e-prebuilt"); | ||
| 204 | softfloat.addIncludeDir("deps/SoftFloat-3e/source/8086"); | ||
| 205 | softfloat.addIncludeDir("deps/SoftFloat-3e/source/include"); | ||
| 206 | softfloat.addCSourceFiles(&softfloat_sources, &[_][]const u8{ "-std=c99", "-O3" }); | ||
| 207 | softfloat.single_threaded = single_threaded; | ||
| 208 | |||
| 209 | const zig0 = b.addExecutable("zig0", null); | ||
| 210 | zig0.addCSourceFiles(&.{"src/stage1/zig0.cpp"}, &exe_cflags); | ||
| 211 | zig0.addIncludeDir("zig-cache/tmp"); // for config.h | ||
| 212 | zig0.defineCMacro("ZIG_VERSION_MAJOR", b.fmt("{d}", .{zig_version.major})); | ||
| 213 | zig0.defineCMacro("ZIG_VERSION_MINOR", b.fmt("{d}", .{zig_version.minor})); | ||
| 214 | zig0.defineCMacro("ZIG_VERSION_PATCH", b.fmt("{d}", .{zig_version.patch})); | ||
| 215 | zig0.defineCMacro("ZIG_VERSION_STRING", b.fmt("\"{s}\"", .{version})); | ||
| 216 | |||
| 217 | for ([_]*std.build.LibExeObjStep{ zig0, exe }) |artifact| { | ||
| 218 | artifact.addIncludeDir("src"); | ||
| 219 | artifact.addIncludeDir("deps/SoftFloat-3e/source/include"); | ||
| 220 | artifact.addIncludeDir("deps/SoftFloat-3e-prebuilt"); | ||
| 221 | |||
| 222 | artifact.defineCMacro("ZIG_LINK_MODE", "Static"); | ||
| 223 | |||
| 224 | artifact.addCSourceFiles(&stage1_sources, &exe_cflags); | ||
| 225 | artifact.addCSourceFiles(&optimized_c_sources, &[_][]const u8{ "-std=c99", "-O3" }); | ||
| 226 | |||
| 227 | artifact.linkLibrary(softfloat); | ||
| 228 | artifact.linkLibCpp(); | ||
| 229 | } | ||
| 230 | |||
| 231 | try addStaticLlvmOptionsToExe(zig0); | ||
| 232 | |||
| 233 | const zig1_obj_ext = target.getObjectFormat().fileExt(target.getCpuArch()); | ||
| 234 | const zig1_obj_path = b.pathJoin(&.{ "zig-cache", "tmp", b.fmt("zig1{s}", .{zig1_obj_ext}) }); | ||
| 235 | const zig1_compiler_rt_path = b.pathJoin(&.{ b.pathFromRoot("lib"), "std", "special", "compiler_rt.zig" }); | ||
| 236 | |||
| 237 | const zig1_obj = zig0.run(); | ||
| 238 | zig1_obj.addArgs(&.{ | ||
| 239 | "src/stage1.zig", | ||
| 240 | "-target", | ||
| 241 | try target.zigTriple(b.allocator), | ||
| 242 | "-mcpu=baseline", | ||
| 243 | "--name", | ||
| 244 | "zig1", | ||
| 245 | "--zig-lib-dir", | ||
| 246 | b.pathFromRoot("lib"), | ||
| 247 | b.fmt("-femit-bin={s}", .{b.pathFromRoot(zig1_obj_path)}), | ||
| 248 | "-fcompiler-rt", | ||
| 249 | "-lc", | ||
| 250 | }); | ||
| 251 | { | ||
| 252 | zig1_obj.addArgs(&.{ "--pkg-begin", "build_options" }); | ||
| 253 | zig1_obj.addFileSourceArg(exe_options.getSource()); | ||
| 254 | zig1_obj.addArgs(&.{ "--pkg-end", "--pkg-begin", "compiler_rt", zig1_compiler_rt_path, "--pkg-end" }); | ||
| 255 | } | ||
| 256 | switch (mode) { | ||
| 257 | .Debug => {}, | ||
| 258 | .ReleaseFast => { | ||
| 259 | zig1_obj.addArg("-OReleaseFast"); | ||
| 260 | zig1_obj.addArg("--strip"); | ||
| 261 | }, | ||
| 262 | .ReleaseSafe => { | ||
| 263 | zig1_obj.addArg("-OReleaseSafe"); | ||
| 264 | zig1_obj.addArg("--strip"); | ||
| 265 | }, | ||
| 266 | .ReleaseSmall => { | ||
| 267 | zig1_obj.addArg("-OReleaseSmall"); | ||
| 268 | zig1_obj.addArg("--strip"); | ||
| 269 | }, | ||
| 270 | } | ||
| 271 | if (single_threaded orelse false) { | ||
| 272 | zig1_obj.addArg("-fsingle-threaded"); | ||
| 273 | } | ||
| 274 | |||
| 275 | exe.step.dependOn(&zig1_obj.step); | ||
| 276 | exe.addObjectFile(zig1_obj_path); | ||
| 277 | |||
| 278 | // This is intentionally a dummy path. stage1.zig tries to @import("compiler_rt") in case | ||
| 279 | // of being built by cmake. But when built by zig it's gonna get a compiler_rt so that | ||
| 280 | // is pointless. | ||
| 281 | exe.addPackagePath("compiler_rt", "src/empty.zig"); | ||
| 282 | } | ||
| 283 | if (cmake_cfg) |cfg| { | ||
| 284 | // Inside this code path, we have to coordinate with system packaged LLVM, Clang, and LLD. | ||
| 285 | // That means we also have to rely on stage1 compiled c++ files. We parse config.h to find | ||
| 286 | // the information passed on to us from cmake. | ||
| 287 | if (cfg.cmake_prefix_path.len > 0) { | ||
| 288 | b.addSearchPrefix(cfg.cmake_prefix_path); | ||
| 289 | } | ||
| 290 | |||
| 291 | try addCmakeCfgOptionsToExe(b, cfg, exe, use_zig_libcxx); | ||
| 292 | } else { | ||
| 293 | // Here we are -Denable-llvm but no cmake integration. | ||
| 294 | try addStaticLlvmOptionsToExe(exe); | ||
| 295 | } | ||
| 296 | } | ||
| 297 | |||
| 298 | const semver = try std.SemanticVersion.parse(version); | ||
| 299 | exe_options.addOption(std.SemanticVersion, "semver", semver); | ||
| 300 | |||
| 301 | exe_options.addOption(bool, "enable_logging", enable_logging); | ||
| 302 | exe_options.addOption(bool, "enable_link_snapshots", enable_link_snapshots); | ||
| 303 | exe_options.addOption(bool, "enable_tracy", tracy != null); | ||
| 304 | exe_options.addOption(bool, "enable_tracy_callstack", tracy_callstack); | ||
| 305 | exe_options.addOption(bool, "enable_tracy_allocation", tracy_allocation); | ||
| 306 | exe_options.addOption(bool, "is_stage1", is_stage1); | ||
| 307 | exe_options.addOption(bool, "omit_stage2", omit_stage2); | ||
| 308 | if (tracy) |tracy_path| { | ||
| 309 | const client_cpp = fs.path.join( | ||
| 310 | b.allocator, | ||
| 311 | &[_][]const u8{ tracy_path, "TracyClient.cpp" }, | ||
| 312 | ) catch unreachable; | ||
| 313 | |||
| 314 | // On mingw, we need to opt into windows 7+ to get some features required by tracy. | ||
| 315 | const tracy_c_flags: []const []const u8 = if (target.isWindows() and target.getAbi() == .gnu) | ||
| 316 | &[_][]const u8{ "-DTRACY_ENABLE=1", "-fno-sanitize=undefined", "-D_WIN32_WINNT=0x601" } | ||
| 317 | else | ||
| 318 | &[_][]const u8{ "-DTRACY_ENABLE=1", "-fno-sanitize=undefined" }; | ||
| 319 | |||
| 320 | exe.addIncludeDir(tracy_path); | ||
| 321 | exe.addCSourceFile(client_cpp, tracy_c_flags); | ||
| 322 | if (!enable_llvm) { | ||
| 323 | exe.linkSystemLibraryName("c++"); | ||
| 324 | } | ||
| 325 | exe.linkLibC(); | ||
| 326 | |||
| 327 | if (target.isWindows()) { | ||
| 328 | exe.linkSystemLibrary("dbghelp"); | ||
| 329 | exe.linkSystemLibrary("ws2_32"); | ||
| 330 | } | ||
| 331 | } | ||
| 332 | } | ||
| 333 | |||
| 334 | const exe_cflags = [_][]const u8{ | ||
| 335 | "-std=c++14", | ||
| 336 | "-D__STDC_CONSTANT_MACROS", | ||
| 337 | "-D__STDC_FORMAT_MACROS", | ||
| 338 | "-D__STDC_LIMIT_MACROS", | ||
| 339 | "-D_GNU_SOURCE", | ||
| 340 | "-fvisibility-inlines-hidden", | ||
| 341 | "-fno-exceptions", | ||
| 342 | "-fno-rtti", | ||
| 343 | "-Werror=type-limits", | ||
| 344 | "-Wno-missing-braces", | ||
| 345 | "-Wno-comment", | ||
| 346 | }; | ||
| 347 | |||
| 348 | fn addCmakeCfgOptionsToExe( | ||
| 349 | b: *Builder, | ||
| 350 | cfg: CMakeConfig, | ||
| 351 | exe: *std.build.LibExeObjStep, | ||
| 352 | use_zig_libcxx: bool, | ||
| 353 | ) !void { | ||
| 354 | exe.addObjectFile(fs.path.join(b.allocator, &[_][]const u8{ | ||
| 355 | cfg.cmake_binary_dir, | ||
| 356 | "zigcpp", | ||
| 357 | b.fmt("{s}{s}{s}", .{ exe.target.libPrefix(), "zigcpp", exe.target.staticLibSuffix() }), | ||
| 358 | }) catch unreachable); | ||
| 359 | assert(cfg.lld_include_dir.len != 0); | ||
| 360 | exe.addIncludeDir(cfg.lld_include_dir); | ||
| 361 | addCMakeLibraryList(exe, cfg.clang_libraries); | ||
| 362 | addCMakeLibraryList(exe, cfg.lld_libraries); | ||
| 363 | addCMakeLibraryList(exe, cfg.llvm_libraries); | ||
| 364 | |||
| 365 | if (use_zig_libcxx) { | ||
| 366 | exe.linkLibCpp(); | ||
| 367 | } else { | ||
| 368 | const need_cpp_includes = true; | ||
| 369 | |||
| 370 | // System -lc++ must be used because in this code path we are attempting to link | ||
| 371 | // against system-provided LLVM, Clang, LLD. | ||
| 372 | if (exe.target.getOsTag() == .linux) { | ||
| 373 | // First we try to static link against gcc libstdc++. If that doesn't work, | ||
| 374 | // we fall back to -lc++ and cross our fingers. | ||
| 375 | addCxxKnownPath(b, cfg, exe, "libstdc++.a", "", need_cpp_includes) catch |err| switch (err) { | ||
| 376 | error.RequiredLibraryNotFound => { | ||
| 377 | exe.linkSystemLibrary("c++"); | ||
| 378 | }, | ||
| 379 | else => |e| return e, | ||
| 380 | }; | ||
| 381 | exe.linkSystemLibrary("unwind"); | ||
| 382 | } else if (exe.target.isFreeBSD()) { | ||
| 383 | try addCxxKnownPath(b, cfg, exe, "libc++.a", null, need_cpp_includes); | ||
| 384 | exe.linkSystemLibrary("pthread"); | ||
| 385 | } else if (exe.target.getOsTag() == .openbsd) { | ||
| 386 | try addCxxKnownPath(b, cfg, exe, "libc++.a", null, need_cpp_includes); | ||
| 387 | try addCxxKnownPath(b, cfg, exe, "libc++abi.a", null, need_cpp_includes); | ||
| 388 | } else if (exe.target.isDarwin()) { | ||
| 389 | exe.linkSystemLibrary("c++"); | ||
| 390 | } | ||
| 391 | } | ||
| 392 | |||
| 393 | if (cfg.dia_guids_lib.len != 0) { | ||
| 394 | exe.addObjectFile(cfg.dia_guids_lib); | ||
| 395 | } | ||
| 396 | } | ||
| 397 | |||
| 398 | fn addStaticLlvmOptionsToExe( | ||
| 399 | exe: *std.build.LibExeObjStep, | ||
| 400 | ) !void { | ||
| 401 | // Adds the Zig C++ sources which both stage1 and stage2 need. | ||
| 402 | // | ||
| 403 | // We need this because otherwise zig_clang_cc1_main.cpp ends up pulling | ||
| 404 | // in a dependency on llvm::cfg::Update<llvm::BasicBlock*>::dump() which is | ||
| 405 | // unavailable when LLVM is compiled in Release mode. | ||
| 406 | const zig_cpp_cflags = exe_cflags ++ [_][]const u8{"-DNDEBUG=1"}; | ||
| 407 | exe.addCSourceFiles(&zig_cpp_sources, &zig_cpp_cflags); | ||
| 408 | |||
| 409 | for (clang_libs) |lib_name| { | ||
| 410 | exe.linkSystemLibrary(lib_name); | ||
| 411 | } | ||
| 412 | |||
| 413 | for (lld_libs) |lib_name| { | ||
| 414 | exe.linkSystemLibrary(lib_name); | ||
| 415 | } | ||
| 416 | |||
| 417 | for (llvm_libs) |lib_name| { | ||
| 418 | exe.linkSystemLibrary(lib_name); | ||
| 419 | } | ||
| 420 | |||
| 421 | exe.linkSystemLibrary("z"); | ||
| 422 | |||
| 423 | // This means we rely on clang-or-zig-built LLVM, Clang, LLD libraries. | ||
| 424 | exe.linkSystemLibrary("c++"); | ||
| 425 | |||
| 426 | if (exe.target.getOs().tag == .windows) { | ||
| 427 | exe.linkSystemLibrary("version"); | ||
| 428 | exe.linkSystemLibrary("uuid"); | ||
| 429 | exe.linkSystemLibrary("ole32"); | ||
| 430 | } | ||
| 431 | } | ||
| 432 | |||
| 433 | fn addCxxKnownPath( | ||
| 434 | b: *Builder, | ||
| 435 | ctx: CMakeConfig, | ||
| 436 | exe: *std.build.LibExeObjStep, | ||
| 437 | objname: []const u8, | ||
| 438 | errtxt: ?[]const u8, | ||
| 439 | need_cpp_includes: bool, | ||
| 440 | ) !void { | ||
| 441 | const path_padded = try b.exec(&[_][]const u8{ | ||
| 442 | ctx.cxx_compiler, | ||
| 443 | b.fmt("-print-file-name={s}", .{objname}), | ||
| 444 | }); | ||
| 445 | const path_unpadded = mem.tokenize(u8, path_padded, "\r\n").next().?; | ||
| 446 | if (mem.eql(u8, path_unpadded, objname)) { | ||
| 447 | if (errtxt) |msg| { | ||
| 448 | std.debug.print("{s}", .{msg}); | ||
| 449 | } else { | ||
| 450 | std.debug.print("Unable to determine path to {s}\n", .{objname}); | ||
| 451 | } | ||
| 452 | return error.RequiredLibraryNotFound; | ||
| 453 | } | ||
| 454 | exe.addObjectFile(path_unpadded); | ||
| 455 | |||
| 456 | // TODO a way to integrate with system c++ include files here | ||
| 457 | // cc -E -Wp,-v -xc++ /dev/null | ||
| 458 | if (need_cpp_includes) { | ||
| 459 | // I used these temporarily for testing something but we obviously need a | ||
| 460 | // more general purpose solution here. | ||
| 461 | //exe.addIncludeDir("/nix/store/fvf3qjqa5qpcjjkq37pb6ypnk1mzhf5h-gcc-9.3.0/lib/gcc/x86_64-unknown-linux-gnu/9.3.0/../../../../include/c++/9.3.0"); | ||
| 462 | //exe.addIncludeDir("/nix/store/fvf3qjqa5qpcjjkq37pb6ypnk1mzhf5h-gcc-9.3.0/lib/gcc/x86_64-unknown-linux-gnu/9.3.0/../../../../include/c++/9.3.0/x86_64-unknown-linux-gnu"); | ||
| 463 | //exe.addIncludeDir("/nix/store/fvf3qjqa5qpcjjkq37pb6ypnk1mzhf5h-gcc-9.3.0/lib/gcc/x86_64-unknown-linux-gnu/9.3.0/../../../../include/c++/9.3.0/backward"); | ||
| 464 | } | ||
| 465 | } | ||
| 466 | |||
| 467 | fn addCMakeLibraryList(exe: *std.build.LibExeObjStep, list: []const u8) void { | ||
| 468 | var it = mem.tokenize(u8, list, ";"); | ||
| 469 | while (it.next()) |lib| { | ||
| 470 | if (mem.startsWith(u8, lib, "-l")) { | ||
| 471 | exe.linkSystemLibrary(lib["-l".len..]); | ||
| 472 | } else { | ||
| 473 | exe.addObjectFile(lib); | ||
| 474 | } | ||
| 475 | } | ||
| 476 | } | ||
| 477 | |||
| 478 | const CMakeConfig = struct { | ||
| 479 | cmake_binary_dir: []const u8, | ||
| 480 | cmake_prefix_path: []const u8, | ||
| 481 | cxx_compiler: []const u8, | ||
| 482 | lld_include_dir: []const u8, | ||
| 483 | lld_libraries: []const u8, | ||
| 484 | clang_libraries: []const u8, | ||
| 485 | llvm_libraries: []const u8, | ||
| 486 | dia_guids_lib: []const u8, | ||
| 487 | }; | ||
| 488 | |||
| 489 | const max_config_h_bytes = 1 * 1024 * 1024; | ||
| 490 | |||
| 491 | fn findAndParseConfigH(b: *Builder, config_h_path_option: ?[]const u8) ?CMakeConfig { | ||
| 492 | const config_h_text: []const u8 = if (config_h_path_option) |config_h_path| blk: { | ||
| 493 | break :blk fs.cwd().readFileAlloc(b.allocator, config_h_path, max_config_h_bytes) catch unreachable; | ||
| 494 | } else blk: { | ||
| 495 | // TODO this should stop looking for config.h once it detects we hit the | ||
| 496 | // zig source root directory. | ||
| 497 | var check_dir = fs.path.dirname(b.zig_exe).?; | ||
| 498 | while (true) { | ||
| 499 | var dir = fs.cwd().openDir(check_dir, .{}) catch unreachable; | ||
| 500 | defer dir.close(); | ||
| 501 | |||
| 502 | break :blk dir.readFileAlloc(b.allocator, "config.h", max_config_h_bytes) catch |err| switch (err) { | ||
| 503 | error.FileNotFound => { | ||
| 504 | const new_check_dir = fs.path.dirname(check_dir); | ||
| 505 | if (new_check_dir == null or mem.eql(u8, new_check_dir.?, check_dir)) { | ||
| 506 | return null; | ||
| 507 | } | ||
| 508 | check_dir = new_check_dir.?; | ||
| 509 | continue; | ||
| 510 | }, | ||
| 511 | else => unreachable, | ||
| 512 | }; | ||
| 513 | } else unreachable; // TODO should not need `else unreachable`. | ||
| 514 | }; | ||
| 515 | |||
| 516 | var ctx: CMakeConfig = .{ | ||
| 517 | .cmake_binary_dir = undefined, | ||
| 518 | .cmake_prefix_path = undefined, | ||
| 519 | .cxx_compiler = undefined, | ||
| 520 | .lld_include_dir = undefined, | ||
| 521 | .lld_libraries = undefined, | ||
| 522 | .clang_libraries = undefined, | ||
| 523 | .llvm_libraries = undefined, | ||
| 524 | .dia_guids_lib = undefined, | ||
| 525 | }; | ||
| 526 | |||
| 527 | const mappings = [_]struct { prefix: []const u8, field: []const u8 }{ | ||
| 528 | .{ | ||
| 529 | .prefix = "#define ZIG_CMAKE_BINARY_DIR ", | ||
| 530 | .field = "cmake_binary_dir", | ||
| 531 | }, | ||
| 532 | .{ | ||
| 533 | .prefix = "#define ZIG_CMAKE_PREFIX_PATH ", | ||
| 534 | .field = "cmake_prefix_path", | ||
| 535 | }, | ||
| 536 | .{ | ||
| 537 | .prefix = "#define ZIG_CXX_COMPILER ", | ||
| 538 | .field = "cxx_compiler", | ||
| 539 | }, | ||
| 540 | .{ | ||
| 541 | .prefix = "#define ZIG_LLD_INCLUDE_PATH ", | ||
| 542 | .field = "lld_include_dir", | ||
| 543 | }, | ||
| 544 | .{ | ||
| 545 | .prefix = "#define ZIG_LLD_LIBRARIES ", | ||
| 546 | .field = "lld_libraries", | ||
| 547 | }, | ||
| 548 | .{ | ||
| 549 | .prefix = "#define ZIG_CLANG_LIBRARIES ", | ||
| 550 | .field = "clang_libraries", | ||
| 551 | }, | ||
| 552 | .{ | ||
| 553 | .prefix = "#define ZIG_LLVM_LIBRARIES ", | ||
| 554 | .field = "llvm_libraries", | ||
| 555 | }, | ||
| 556 | .{ | ||
| 557 | .prefix = "#define ZIG_DIA_GUIDS_LIB ", | ||
| 558 | .field = "dia_guids_lib", | ||
| 559 | }, | ||
| 560 | }; | ||
| 561 | |||
| 562 | var lines_it = mem.tokenize(u8, config_h_text, "\r\n"); | ||
| 563 | while (lines_it.next()) |line| { | ||
| 564 | inline for (mappings) |mapping| { | ||
| 565 | if (mem.startsWith(u8, line, mapping.prefix)) { | ||
| 566 | var it = mem.split(u8, line, "\""); | ||
| 567 | _ = it.next().?; // skip the stuff before the quote | ||
| 568 | const quoted = it.next().?; // the stuff inside the quote | ||
| 569 | @field(ctx, mapping.field) = toNativePathSep(b, quoted); | ||
| 570 | } | ||
| 571 | } | ||
| 572 | } | ||
| 573 | return ctx; | ||
| 574 | } | ||
| 575 | |||
| 576 | fn toNativePathSep(b: *Builder, s: []const u8) []u8 { | ||
| 577 | const duplicated = b.allocator.dupe(u8, s) catch unreachable; | ||
| 578 | for (duplicated) |*byte| switch (byte.*) { | ||
| 579 | '/' => byte.* = fs.path.sep, | ||
| 580 | else => {}, | ||
| 581 | }; | ||
| 582 | return duplicated; | ||
| 583 | } | ||
| 584 | |||
| 585 | const softfloat_sources = [_][]const u8{ | ||
| 586 | "deps/SoftFloat-3e/source/8086/f128M_isSignalingNaN.c", | ||
| 587 | "deps/SoftFloat-3e/source/8086/extF80M_isSignalingNaN.c", | ||
| 588 | "deps/SoftFloat-3e/source/8086/s_commonNaNToF128M.c", | ||
| 589 | "deps/SoftFloat-3e/source/8086/s_commonNaNToExtF80M.c", | ||
| 590 | "deps/SoftFloat-3e/source/8086/s_commonNaNToF16UI.c", | ||
| 591 | "deps/SoftFloat-3e/source/8086/s_commonNaNToF32UI.c", | ||
| 592 | "deps/SoftFloat-3e/source/8086/s_commonNaNToF64UI.c", | ||
| 593 | "deps/SoftFloat-3e/source/8086/s_f128MToCommonNaN.c", | ||
| 594 | "deps/SoftFloat-3e/source/8086/s_extF80MToCommonNaN.c", | ||
| 595 | "deps/SoftFloat-3e/source/8086/s_f16UIToCommonNaN.c", | ||
| 596 | "deps/SoftFloat-3e/source/8086/s_f32UIToCommonNaN.c", | ||
| 597 | "deps/SoftFloat-3e/source/8086/s_f64UIToCommonNaN.c", | ||
| 598 | "deps/SoftFloat-3e/source/8086/s_propagateNaNF128M.c", | ||
| 599 | "deps/SoftFloat-3e/source/8086/s_propagateNaNExtF80M.c", | ||
| 600 | "deps/SoftFloat-3e/source/8086/s_propagateNaNF16UI.c", | ||
| 601 | "deps/SoftFloat-3e/source/8086/softfloat_raiseFlags.c", | ||
| 602 | "deps/SoftFloat-3e/source/f128M_add.c", | ||
| 603 | "deps/SoftFloat-3e/source/f128M_div.c", | ||
| 604 | "deps/SoftFloat-3e/source/f128M_eq.c", | ||
| 605 | "deps/SoftFloat-3e/source/f128M_eq_signaling.c", | ||
| 606 | "deps/SoftFloat-3e/source/f128M_le.c", | ||
| 607 | "deps/SoftFloat-3e/source/f128M_le_quiet.c", | ||
| 608 | "deps/SoftFloat-3e/source/f128M_lt.c", | ||
| 609 | "deps/SoftFloat-3e/source/f128M_lt_quiet.c", | ||
| 610 | "deps/SoftFloat-3e/source/f128M_mul.c", | ||
| 611 | "deps/SoftFloat-3e/source/f128M_mulAdd.c", | ||
| 612 | "deps/SoftFloat-3e/source/f128M_rem.c", | ||
| 613 | "deps/SoftFloat-3e/source/f128M_roundToInt.c", | ||
| 614 | "deps/SoftFloat-3e/source/f128M_sqrt.c", | ||
| 615 | "deps/SoftFloat-3e/source/f128M_sub.c", | ||
| 616 | "deps/SoftFloat-3e/source/f128M_to_f16.c", | ||
| 617 | "deps/SoftFloat-3e/source/f128M_to_f32.c", | ||
| 618 | "deps/SoftFloat-3e/source/f128M_to_f64.c", | ||
| 619 | "deps/SoftFloat-3e/source/f128M_to_extF80M.c", | ||
| 620 | "deps/SoftFloat-3e/source/f128M_to_i32.c", | ||
| 621 | "deps/SoftFloat-3e/source/f128M_to_i32_r_minMag.c", | ||
| 622 | "deps/SoftFloat-3e/source/f128M_to_i64.c", | ||
| 623 | "deps/SoftFloat-3e/source/f128M_to_i64_r_minMag.c", | ||
| 624 | "deps/SoftFloat-3e/source/f128M_to_ui32.c", | ||
| 625 | "deps/SoftFloat-3e/source/f128M_to_ui32_r_minMag.c", | ||
| 626 | "deps/SoftFloat-3e/source/f128M_to_ui64.c", | ||
| 627 | "deps/SoftFloat-3e/source/f128M_to_ui64_r_minMag.c", | ||
| 628 | "deps/SoftFloat-3e/source/extF80M_add.c", | ||
| 629 | "deps/SoftFloat-3e/source/extF80M_div.c", | ||
| 630 | "deps/SoftFloat-3e/source/extF80M_eq.c", | ||
| 631 | "deps/SoftFloat-3e/source/extF80M_le.c", | ||
| 632 | "deps/SoftFloat-3e/source/extF80M_lt.c", | ||
| 633 | "deps/SoftFloat-3e/source/extF80M_mul.c", | ||
| 634 | "deps/SoftFloat-3e/source/extF80M_rem.c", | ||
| 635 | "deps/SoftFloat-3e/source/extF80M_roundToInt.c", | ||
| 636 | "deps/SoftFloat-3e/source/extF80M_sqrt.c", | ||
| 637 | "deps/SoftFloat-3e/source/extF80M_sub.c", | ||
| 638 | "deps/SoftFloat-3e/source/extF80M_to_f16.c", | ||
| 639 | "deps/SoftFloat-3e/source/extF80M_to_f32.c", | ||
| 640 | "deps/SoftFloat-3e/source/extF80M_to_f64.c", | ||
| 641 | "deps/SoftFloat-3e/source/extF80M_to_f128M.c", | ||
| 642 | "deps/SoftFloat-3e/source/f16_add.c", | ||
| 643 | "deps/SoftFloat-3e/source/f16_div.c", | ||
| 644 | "deps/SoftFloat-3e/source/f16_eq.c", | ||
| 645 | "deps/SoftFloat-3e/source/f16_isSignalingNaN.c", | ||
| 646 | "deps/SoftFloat-3e/source/f16_lt.c", | ||
| 647 | "deps/SoftFloat-3e/source/f16_mul.c", | ||
| 648 | "deps/SoftFloat-3e/source/f16_mulAdd.c", | ||
| 649 | "deps/SoftFloat-3e/source/f16_rem.c", | ||
| 650 | "deps/SoftFloat-3e/source/f16_roundToInt.c", | ||
| 651 | "deps/SoftFloat-3e/source/f16_sqrt.c", | ||
| 652 | "deps/SoftFloat-3e/source/f16_sub.c", | ||
| 653 | "deps/SoftFloat-3e/source/f16_to_extF80M.c", | ||
| 654 | "deps/SoftFloat-3e/source/f16_to_f128M.c", | ||
| 655 | "deps/SoftFloat-3e/source/f16_to_f64.c", | ||
| 656 | "deps/SoftFloat-3e/source/f32_to_extF80M.c", | ||
| 657 | "deps/SoftFloat-3e/source/f32_to_f128M.c", | ||
| 658 | "deps/SoftFloat-3e/source/f64_to_extF80M.c", | ||
| 659 | "deps/SoftFloat-3e/source/f64_to_f128M.c", | ||
| 660 | "deps/SoftFloat-3e/source/f64_to_f16.c", | ||
| 661 | "deps/SoftFloat-3e/source/i32_to_f128M.c", | ||
| 662 | "deps/SoftFloat-3e/source/s_add256M.c", | ||
| 663 | "deps/SoftFloat-3e/source/s_addCarryM.c", | ||
| 664 | "deps/SoftFloat-3e/source/s_addComplCarryM.c", | ||
| 665 | "deps/SoftFloat-3e/source/s_addF128M.c", | ||
| 666 | "deps/SoftFloat-3e/source/s_addExtF80M.c", | ||
| 667 | "deps/SoftFloat-3e/source/s_addM.c", | ||
| 668 | "deps/SoftFloat-3e/source/s_addMagsF16.c", | ||
| 669 | "deps/SoftFloat-3e/source/s_addMagsF32.c", | ||
| 670 | "deps/SoftFloat-3e/source/s_addMagsF64.c", | ||
| 671 | "deps/SoftFloat-3e/source/s_approxRecip32_1.c", | ||
| 672 | "deps/SoftFloat-3e/source/s_approxRecipSqrt32_1.c", | ||
| 673 | "deps/SoftFloat-3e/source/s_approxRecipSqrt_1Ks.c", | ||
| 674 | "deps/SoftFloat-3e/source/s_approxRecip_1Ks.c", | ||
| 675 | "deps/SoftFloat-3e/source/s_compare128M.c", | ||
| 676 | "deps/SoftFloat-3e/source/s_compare96M.c", | ||
| 677 | "deps/SoftFloat-3e/source/s_compareNonnormExtF80M.c", | ||
| 678 | "deps/SoftFloat-3e/source/s_countLeadingZeros16.c", | ||
| 679 | "deps/SoftFloat-3e/source/s_countLeadingZeros32.c", | ||
| 680 | "deps/SoftFloat-3e/source/s_countLeadingZeros64.c", | ||
| 681 | "deps/SoftFloat-3e/source/s_countLeadingZeros8.c", | ||
| 682 | "deps/SoftFloat-3e/source/s_eq128.c", | ||
| 683 | "deps/SoftFloat-3e/source/s_invalidF128M.c", | ||
| 684 | "deps/SoftFloat-3e/source/s_invalidExtF80M.c", | ||
| 685 | "deps/SoftFloat-3e/source/s_isNaNF128M.c", | ||
| 686 | "deps/SoftFloat-3e/source/s_le128.c", | ||
| 687 | "deps/SoftFloat-3e/source/s_lt128.c", | ||
| 688 | "deps/SoftFloat-3e/source/s_mul128MTo256M.c", | ||
| 689 | "deps/SoftFloat-3e/source/s_mul64To128M.c", | ||
| 690 | "deps/SoftFloat-3e/source/s_mulAddF128M.c", | ||
| 691 | "deps/SoftFloat-3e/source/s_mulAddF16.c", | ||
| 692 | "deps/SoftFloat-3e/source/s_mulAddF32.c", | ||
| 693 | "deps/SoftFloat-3e/source/s_mulAddF64.c", | ||
| 694 | "deps/SoftFloat-3e/source/s_negXM.c", | ||
| 695 | "deps/SoftFloat-3e/source/s_normExtF80SigM.c", | ||
| 696 | "deps/SoftFloat-3e/source/s_normRoundPackMToF128M.c", | ||
| 697 | "deps/SoftFloat-3e/source/s_normRoundPackMToExtF80M.c", | ||
| 698 | "deps/SoftFloat-3e/source/s_normRoundPackToF16.c", | ||
| 699 | "deps/SoftFloat-3e/source/s_normRoundPackToF32.c", | ||
| 700 | "deps/SoftFloat-3e/source/s_normRoundPackToF64.c", | ||
| 701 | "deps/SoftFloat-3e/source/s_normSubnormalF128SigM.c", | ||
| 702 | "deps/SoftFloat-3e/source/s_normSubnormalF16Sig.c", | ||
| 703 | "deps/SoftFloat-3e/source/s_normSubnormalF32Sig.c", | ||
| 704 | "deps/SoftFloat-3e/source/s_normSubnormalF64Sig.c", | ||
| 705 | "deps/SoftFloat-3e/source/s_remStepMBy32.c", | ||
| 706 | "deps/SoftFloat-3e/source/s_roundMToI64.c", | ||
| 707 | "deps/SoftFloat-3e/source/s_roundMToUI64.c", | ||
| 708 | "deps/SoftFloat-3e/source/s_roundPackMToExtF80M.c", | ||
| 709 | "deps/SoftFloat-3e/source/s_roundPackMToF128M.c", | ||
| 710 | "deps/SoftFloat-3e/source/s_roundPackToF16.c", | ||
| 711 | "deps/SoftFloat-3e/source/s_roundPackToF32.c", | ||
| 712 | "deps/SoftFloat-3e/source/s_roundPackToF64.c", | ||
| 713 | "deps/SoftFloat-3e/source/s_roundToI32.c", | ||
| 714 | "deps/SoftFloat-3e/source/s_roundToI64.c", | ||
| 715 | "deps/SoftFloat-3e/source/s_roundToUI32.c", | ||
| 716 | "deps/SoftFloat-3e/source/s_roundToUI64.c", | ||
| 717 | "deps/SoftFloat-3e/source/s_shiftLeftM.c", | ||
| 718 | "deps/SoftFloat-3e/source/s_shiftNormSigF128M.c", | ||
| 719 | "deps/SoftFloat-3e/source/s_shiftRightJam256M.c", | ||
| 720 | "deps/SoftFloat-3e/source/s_shiftRightJam32.c", | ||
| 721 | "deps/SoftFloat-3e/source/s_shiftRightJam64.c", | ||
| 722 | "deps/SoftFloat-3e/source/s_shiftRightJamM.c", | ||
| 723 | "deps/SoftFloat-3e/source/s_shiftRightM.c", | ||
| 724 | "deps/SoftFloat-3e/source/s_shortShiftLeft64To96M.c", | ||
| 725 | "deps/SoftFloat-3e/source/s_shortShiftLeftM.c", | ||
| 726 | "deps/SoftFloat-3e/source/s_shortShiftRightExtendM.c", | ||
| 727 | "deps/SoftFloat-3e/source/s_shortShiftRightJam64.c", | ||
| 728 | "deps/SoftFloat-3e/source/s_shortShiftRightJamM.c", | ||
| 729 | "deps/SoftFloat-3e/source/s_shortShiftRightM.c", | ||
| 730 | "deps/SoftFloat-3e/source/s_sub1XM.c", | ||
| 731 | "deps/SoftFloat-3e/source/s_sub256M.c", | ||
| 732 | "deps/SoftFloat-3e/source/s_subM.c", | ||
| 733 | "deps/SoftFloat-3e/source/s_subMagsF16.c", | ||
| 734 | "deps/SoftFloat-3e/source/s_subMagsF32.c", | ||
| 735 | "deps/SoftFloat-3e/source/s_subMagsF64.c", | ||
| 736 | "deps/SoftFloat-3e/source/s_tryPropagateNaNF128M.c", | ||
| 737 | "deps/SoftFloat-3e/source/s_tryPropagateNaNExtF80M.c", | ||
| 738 | "deps/SoftFloat-3e/source/softfloat_state.c", | ||
| 739 | "deps/SoftFloat-3e/source/ui32_to_f128M.c", | ||
| 740 | "deps/SoftFloat-3e/source/ui64_to_f128M.c", | ||
| 741 | "deps/SoftFloat-3e/source/ui32_to_extF80M.c", | ||
| 742 | "deps/SoftFloat-3e/source/ui64_to_extF80M.c", | ||
| 743 | }; | ||
| 744 | |||
| 745 | const stage1_sources = [_][]const u8{ | ||
| 746 | "src/stage1/analyze.cpp", | ||
| 747 | "src/stage1/astgen.cpp", | ||
| 748 | "src/stage1/bigfloat.cpp", | ||
| 749 | "src/stage1/bigint.cpp", | ||
| 750 | "src/stage1/buffer.cpp", | ||
| 751 | "src/stage1/codegen.cpp", | ||
| 752 | "src/stage1/dump_analysis.cpp", | ||
| 753 | "src/stage1/errmsg.cpp", | ||
| 754 | "src/stage1/error.cpp", | ||
| 755 | "src/stage1/heap.cpp", | ||
| 756 | "src/stage1/ir.cpp", | ||
| 757 | "src/stage1/ir_print.cpp", | ||
| 758 | "src/stage1/mem.cpp", | ||
| 759 | "src/stage1/os.cpp", | ||
| 760 | "src/stage1/parser.cpp", | ||
| 761 | "src/stage1/range_set.cpp", | ||
| 762 | "src/stage1/stage1.cpp", | ||
| 763 | "src/stage1/target.cpp", | ||
| 764 | "src/stage1/tokenizer.cpp", | ||
| 765 | "src/stage1/util.cpp", | ||
| 766 | "src/stage1/softfloat_ext.cpp", | ||
| 767 | }; | ||
| 768 | const optimized_c_sources = [_][]const u8{ | ||
| 769 | "src/stage1/parse_f128.c", | ||
| 770 | }; | ||
| 771 | const zig_cpp_sources = [_][]const u8{ | ||
| 772 | // These are planned to stay even when we are self-hosted. | ||
| 773 | "src/zig_llvm.cpp", | ||
| 774 | "src/zig_clang.cpp", | ||
| 775 | "src/zig_llvm-ar.cpp", | ||
| 776 | "src/zig_clang_driver.cpp", | ||
| 777 | "src/zig_clang_cc1_main.cpp", | ||
| 778 | "src/zig_clang_cc1as_main.cpp", | ||
| 779 | // https://github.com/ziglang/zig/issues/6363 | ||
| 780 | "src/windows_sdk.cpp", | ||
| 781 | }; | ||
| 782 | |||
| 783 | const clang_libs = [_][]const u8{ | ||
| 784 | "clangFrontendTool", | ||
| 785 | "clangCodeGen", | ||
| 786 | "clangFrontend", | ||
| 787 | "clangDriver", | ||
| 788 | "clangSerialization", | ||
| 789 | "clangSema", | ||
| 790 | "clangStaticAnalyzerFrontend", | ||
| 791 | "clangStaticAnalyzerCheckers", | ||
| 792 | "clangStaticAnalyzerCore", | ||
| 793 | "clangAnalysis", | ||
| 794 | "clangASTMatchers", | ||
| 795 | "clangAST", | ||
| 796 | "clangParse", | ||
| 797 | "clangSema", | ||
| 798 | "clangBasic", | ||
| 799 | "clangEdit", | ||
| 800 | "clangLex", | ||
| 801 | "clangARCMigrate", | ||
| 802 | "clangRewriteFrontend", | ||
| 803 | "clangRewrite", | ||
| 804 | "clangCrossTU", | ||
| 805 | "clangIndex", | ||
| 806 | "clangToolingCore", | ||
| 807 | }; | ||
| 808 | const lld_libs = [_][]const u8{ | ||
| 809 | "lldDriver", | ||
| 810 | "lldMinGW", | ||
| 811 | "lldELF", | ||
| 812 | "lldCOFF", | ||
| 813 | "lldMachO", | ||
| 814 | "lldWasm", | ||
| 815 | "lldReaderWriter", | ||
| 816 | "lldCore", | ||
| 817 | "lldYAML", | ||
| 818 | "lldCommon", | ||
| 819 | }; | ||
| 820 | // This list can be re-generated with `llvm-config --libfiles` and then | ||
| 821 | // reformatting using your favorite text editor. Note we do not execute | ||
| 822 | // `llvm-config` here because we are cross compiling. Also omit LLVMTableGen | ||
| 823 | // from these libs. | ||
| 824 | const llvm_libs = [_][]const u8{ | ||
| 825 | "LLVMWindowsManifest", | ||
| 826 | "LLVMXRay", | ||
| 827 | "LLVMLibDriver", | ||
| 828 | "LLVMDlltoolDriver", | ||
| 829 | "LLVMCoverage", | ||
| 830 | "LLVMLineEditor", | ||
| 831 | "LLVMXCoreDisassembler", | ||
| 832 | "LLVMXCoreCodeGen", | ||
| 833 | "LLVMXCoreDesc", | ||
| 834 | "LLVMXCoreInfo", | ||
| 835 | "LLVMX86Disassembler", | ||
| 836 | "LLVMX86AsmParser", | ||
| 837 | "LLVMX86CodeGen", | ||
| 838 | "LLVMX86Desc", | ||
| 839 | "LLVMX86Info", | ||
| 840 | "LLVMWebAssemblyDisassembler", | ||
| 841 | "LLVMWebAssemblyAsmParser", | ||
| 842 | "LLVMWebAssemblyCodeGen", | ||
| 843 | "LLVMWebAssemblyDesc", | ||
| 844 | "LLVMWebAssemblyUtils", | ||
| 845 | "LLVMWebAssemblyInfo", | ||
| 846 | "LLVMSystemZDisassembler", | ||
| 847 | "LLVMSystemZAsmParser", | ||
| 848 | "LLVMSystemZCodeGen", | ||
| 849 | "LLVMSystemZDesc", | ||
| 850 | "LLVMSystemZInfo", | ||
| 851 | "LLVMSparcDisassembler", | ||
| 852 | "LLVMSparcAsmParser", | ||
| 853 | "LLVMSparcCodeGen", | ||
| 854 | "LLVMSparcDesc", | ||
| 855 | "LLVMSparcInfo", | ||
| 856 | "LLVMRISCVDisassembler", | ||
| 857 | "LLVMRISCVAsmParser", | ||
| 858 | "LLVMRISCVCodeGen", | ||
| 859 | "LLVMRISCVDesc", | ||
| 860 | "LLVMRISCVInfo", | ||
| 861 | "LLVMPowerPCDisassembler", | ||
| 862 | "LLVMPowerPCAsmParser", | ||
| 863 | "LLVMPowerPCCodeGen", | ||
| 864 | "LLVMPowerPCDesc", | ||
| 865 | "LLVMPowerPCInfo", | ||
| 866 | "LLVMNVPTXCodeGen", | ||
| 867 | "LLVMNVPTXDesc", | ||
| 868 | "LLVMNVPTXInfo", | ||
| 869 | "LLVMMSP430Disassembler", | ||
| 870 | "LLVMMSP430AsmParser", | ||
| 871 | "LLVMMSP430CodeGen", | ||
| 872 | "LLVMMSP430Desc", | ||
| 873 | "LLVMMSP430Info", | ||
| 874 | "LLVMMipsDisassembler", | ||
| 875 | "LLVMMipsAsmParser", | ||
| 876 | "LLVMMipsCodeGen", | ||
| 877 | "LLVMMipsDesc", | ||
| 878 | "LLVMMipsInfo", | ||
| 879 | "LLVMLanaiDisassembler", | ||
| 880 | "LLVMLanaiCodeGen", | ||
| 881 | "LLVMLanaiAsmParser", | ||
| 882 | "LLVMLanaiDesc", | ||
| 883 | "LLVMLanaiInfo", | ||
| 884 | "LLVMHexagonDisassembler", | ||
| 885 | "LLVMHexagonCodeGen", | ||
| 886 | "LLVMHexagonAsmParser", | ||
| 887 | "LLVMHexagonDesc", | ||
| 888 | "LLVMHexagonInfo", | ||
| 889 | "LLVMBPFDisassembler", | ||
| 890 | "LLVMBPFAsmParser", | ||
| 891 | "LLVMBPFCodeGen", | ||
| 892 | "LLVMBPFDesc", | ||
| 893 | "LLVMBPFInfo", | ||
| 894 | "LLVMAVRDisassembler", | ||
| 895 | "LLVMAVRAsmParser", | ||
| 896 | "LLVMAVRCodeGen", | ||
| 897 | "LLVMAVRDesc", | ||
| 898 | "LLVMAVRInfo", | ||
| 899 | "LLVMARMDisassembler", | ||
| 900 | "LLVMARMAsmParser", | ||
| 901 | "LLVMARMCodeGen", | ||
| 902 | "LLVMARMDesc", | ||
| 903 | "LLVMARMUtils", | ||
| 904 | "LLVMARMInfo", | ||
| 905 | "LLVMAMDGPUDisassembler", | ||
| 906 | "LLVMAMDGPUAsmParser", | ||
| 907 | "LLVMAMDGPUCodeGen", | ||
| 908 | "LLVMAMDGPUDesc", | ||
| 909 | "LLVMAMDGPUUtils", | ||
| 910 | "LLVMAMDGPUInfo", | ||
| 911 | "LLVMAArch64Disassembler", | ||
| 912 | "LLVMAArch64AsmParser", | ||
| 913 | "LLVMAArch64CodeGen", | ||
| 914 | "LLVMAArch64Desc", | ||
| 915 | "LLVMAArch64Utils", | ||
| 916 | "LLVMAArch64Info", | ||
| 917 | "LLVMOrcJIT", | ||
| 918 | "LLVMMCJIT", | ||
| 919 | "LLVMJITLink", | ||
| 920 | "LLVMInterpreter", | ||
| 921 | "LLVMExecutionEngine", | ||
| 922 | "LLVMRuntimeDyld", | ||
| 923 | "LLVMOrcTargetProcess", | ||
| 924 | "LLVMOrcShared", | ||
| 925 | "LLVMDWP", | ||
| 926 | "LLVMSymbolize", | ||
| 927 | "LLVMDebugInfoPDB", | ||
| 928 | "LLVMDebugInfoGSYM", | ||
| 929 | "LLVMOption", | ||
| 930 | "LLVMObjectYAML", | ||
| 931 | "LLVMMCA", | ||
| 932 | "LLVMMCDisassembler", | ||
| 933 | "LLVMLTO", | ||
| 934 | "LLVMPasses", | ||
| 935 | "LLVMCFGuard", | ||
| 936 | "LLVMCoroutines", | ||
| 937 | "LLVMObjCARCOpts", | ||
| 938 | "LLVMipo", | ||
| 939 | "LLVMVectorize", | ||
| 940 | "LLVMLinker", | ||
| 941 | "LLVMInstrumentation", | ||
| 942 | "LLVMFrontendOpenMP", | ||
| 943 | "LLVMFrontendOpenACC", | ||
| 944 | "LLVMExtensions", | ||
| 945 | "LLVMDWARFLinker", | ||
| 946 | "LLVMGlobalISel", | ||
| 947 | "LLVMMIRParser", | ||
| 948 | "LLVMAsmPrinter", | ||
| 949 | "LLVMDebugInfoMSF", | ||
| 950 | "LLVMDebugInfoDWARF", | ||
| 951 | "LLVMSelectionDAG", | ||
| 952 | "LLVMCodeGen", | ||
| 953 | "LLVMIRReader", | ||
| 954 | "LLVMAsmParser", | ||
| 955 | "LLVMInterfaceStub", | ||
| 956 | "LLVMFileCheck", | ||
| 957 | "LLVMFuzzMutate", | ||
| 958 | "LLVMTarget", | ||
| 959 | "LLVMScalarOpts", | ||
| 960 | "LLVMInstCombine", | ||
| 961 | "LLVMAggressiveInstCombine", | ||
| 962 | "LLVMTransformUtils", | ||
| 963 | "LLVMBitWriter", | ||
| 964 | "LLVMAnalysis", | ||
| 965 | "LLVMProfileData", | ||
| 966 | "LLVMObject", | ||
| 967 | "LLVMTextAPI", | ||
| 968 | "LLVMMCParser", | ||
| 969 | "LLVMMC", | ||
| 970 | "LLVMDebugInfoCodeView", | ||
| 971 | "LLVMBitReader", | ||
| 972 | "LLVMCore", | ||
| 973 | "LLVMRemarks", | ||
| 974 | "LLVMBitstreamReader", | ||
| 975 | "LLVMBinaryFormat", | ||
| 976 | "LLVMSupport", | ||
| 977 | "LLVMDemangle", | ||
| 978 | }; | ||
ci/azure/pipelines.yml+1-1| ... | @@ -42,7 +42,7 @@ jobs: | ... | @@ -42,7 +42,7 @@ jobs: |
| 42 | - task: DownloadSecureFile@1 | 42 | - task: DownloadSecureFile@1 |
| 43 | inputs: | 43 | inputs: |
| 44 | secureFile: s3cfg | 44 | secureFile: s3cfg |
| 45 | - script: ci/azure/windows_msvc_script.bat | 45 | - script: ci/azure/windows_script.bat |
| 46 | name: main | 46 | name: main |
| 47 | displayName: 'Build and test' | 47 | displayName: 'Build and test' |
| 48 | - job: OnMasterSuccess | 48 | - job: OnMasterSuccess |
ci/azure/windows_msvc_install deleted-16| ... | @@ -1,16 +0,0 @@ | ||
| 1 | #!/bin/sh | ||
| 2 | |||
| 3 | set -x | ||
| 4 | set -e | ||
| 5 | |||
| 6 | pacman -Suy --needed --noconfirm | ||
| 7 | pacman -S --needed --noconfirm wget p7zip python3-pip tar xz | ||
| 8 | |||
| 9 | TARBALL="llvm+clang+lld-13.0.0-x86_64-windows-msvc-release-mt.tar.xz" | ||
| 10 | |||
| 11 | pip install s3cmd | ||
| 12 | wget -nv "https://ziglang.org/deps/$TARBALL" | ||
| 13 | # If the first extraction fails, re-try it once; this can happen if the tarball | ||
| 14 | # contains symlinks that are in the table of contents before the files that | ||
| 15 | # they point to. | ||
| 16 | tar -xf $TARBALL || tar --overwrite -xf $TARBALL | ||
ci/azure/windows_msvc_script.bat deleted-39| ... | @@ -1,39 +0,0 @@ | ||
| 1 | @echo on | ||
| 2 | SET "SRCROOT=%cd%" | ||
| 3 | SET "PREVPATH=%PATH%" | ||
| 4 | SET "PREVMSYSTEM=%MSYSTEM%" | ||
| 5 | |||
| 6 | set "PATH=%CD:~0,2%\msys64\usr\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem" | ||
| 7 | SET "MSYSTEM=MINGW64" | ||
| 8 | bash -lc "cd ${SRCROOT} && ci/azure/windows_msvc_install" || exit /b | ||
| 9 | SET "PATH=%PREVPATH%" | ||
| 10 | SET "MSYSTEM=%PREVMSYSTEM%" | ||
| 11 | |||
| 12 | SET "ZIGBUILDDIR=%SRCROOT%\build" | ||
| 13 | SET "ZIGINSTALLDIR=%ZIGBUILDDIR%\dist" | ||
| 14 | SET "ZIGPREFIXPATH=%SRCROOT%\llvm+clang+lld-13.0.0-x86_64-windows-msvc-release-mt" | ||
| 15 | |||
| 16 | call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x64 | ||
| 17 | |||
| 18 | REM Make the `zig version` number consistent. | ||
| 19 | REM This will affect the cmake command below. | ||
| 20 | git.exe config core.abbrev 9 | ||
| 21 | git.exe fetch --unshallow | ||
| 22 | git.exe fetch --tags | ||
| 23 | |||
| 24 | mkdir %ZIGBUILDDIR% | ||
| 25 | cd %ZIGBUILDDIR% | ||
| 26 | cmake.exe .. -Thost=x64 -G"Visual Studio 16 2019" -A x64 "-DCMAKE_INSTALL_PREFIX=%ZIGINSTALLDIR%" "-DCMAKE_PREFIX_PATH=%ZIGPREFIXPATH%" -DCMAKE_BUILD_TYPE=Release -DZIG_OMIT_STAGE2=ON || exit /b | ||
| 27 | msbuild /maxcpucount /p:Configuration=Release INSTALL.vcxproj || exit /b | ||
| 28 | |||
| 29 | REM Sadly, stage2 is omitted from this build to save memory on the CI server. Once self-hosted is | ||
| 30 | REM built with itself and does not gobble as much memory, we can enable these tests. | ||
| 31 | REM "%ZIGINSTALLDIR%\bin\zig.exe" test "..\test\behavior.zig" -fno-stage1 -fLLVM -I "..\test" || exit /b | ||
| 32 | |||
| 33 | "%ZIGINSTALLDIR%\bin\zig.exe" build test-toolchain -Dskip-non-native -Dskip-stage2-tests || exit /b | ||
| 34 | "%ZIGINSTALLDIR%\bin\zig.exe" build test-std -Dskip-non-native || exit /b | ||
| 35 | "%ZIGINSTALLDIR%\bin\zig.exe" build docs || exit /b | ||
| 36 | |||
| 37 | set "PATH=%CD:~0,2%\msys64\usr\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem" | ||
| 38 | SET "MSYSTEM=MINGW64" | ||
| 39 | bash -lc "cd ${SRCROOT} && ci/azure/windows_upload" || exit /b | ||
ci/azure/windows_script created+94| ... | @@ -0,0 +1,94 @@ | ||
| 1 | #!/bin/sh | ||
| 2 | |||
| 3 | set -x | ||
| 4 | set -e | ||
| 5 | |||
| 6 | pacman -Suy --needed --noconfirm | ||
| 7 | pacman -S --needed --noconfirm wget p7zip python3-pip git | ||
| 8 | pip install s3cmd | ||
| 9 | |||
| 10 | ZIGDIR="$(pwd)" | ||
| 11 | ARCH="x86_64" | ||
| 12 | TARGET="$ARCH-windows-gnu" | ||
| 13 | CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.9.1" | ||
| 14 | PREFIX="$HOME/$CACHE_BASENAME" | ||
| 15 | ZIG="$PREFIX/bin/zig.exe" | ||
| 16 | |||
| 17 | rm -rf $PREFIX | ||
| 18 | cd $HOME | ||
| 19 | |||
| 20 | wget -nv "https://ziglang.org/deps/$CACHE_BASENAME.zip" | ||
| 21 | 7z x "$CACHE_BASENAME.zip" | ||
| 22 | |||
| 23 | cd $ZIGDIR | ||
| 24 | |||
| 25 | # Make the `zig version` number consistent. | ||
| 26 | # This will affect the `zig build` command below. | ||
| 27 | git config core.abbrev 9 | ||
| 28 | git fetch --unshallow || true | ||
| 29 | git fetch --tags | ||
| 30 | |||
| 31 | # The dev kit zip file that we have here is old, and may be incompatible with | ||
| 32 | # the build.zig script of master branch. So we keep an old version of build.zig | ||
| 33 | # here in the CI directory. | ||
| 34 | mv build.zig build.zig.master | ||
| 35 | mv ci/azure/build.zig build.zig | ||
| 36 | |||
| 37 | # stage2 is omitted until we resolve https://github.com/ziglang/zig/issues/6485 | ||
| 38 | $ZIG build \ | ||
| 39 | --prefix dist \ | ||
| 40 | --search-prefix "$PREFIX" \ | ||
| 41 | -Dstage1 \ | ||
| 42 | -Domit-stage2 \ | ||
| 43 | -Dstatic-llvm \ | ||
| 44 | -Drelease \ | ||
| 45 | -Dstrip \ | ||
| 46 | -Duse-zig-libcxx \ | ||
| 47 | -Dtarget=$TARGET | ||
| 48 | |||
| 49 | # Now that we have built an up-to-date zig.exe, we restore the original | ||
| 50 | # build script from master branch. | ||
| 51 | mv build.zig.master build.zig | ||
| 52 | |||
| 53 | dist/bin/zig.exe build test-toolchain -Dskip-non-native -Dskip-stage2-tests | ||
| 54 | dist/bin/zig.exe build test-std -Dskip-non-native | ||
| 55 | dist/bin/zig.exe build docs | ||
| 56 | |||
| 57 | if [ "${BUILD_REASON}" != "PullRequest" ]; then | ||
| 58 | mv LICENSE dist/ | ||
| 59 | mv zig-cache/langref.html dist/ | ||
| 60 | mv dist/bin/zig.exe dist/ | ||
| 61 | rmdir dist/bin | ||
| 62 | |||
| 63 | # Remove the unnecessary zig dir in $prefix/lib/zig/std/std.zig | ||
| 64 | mv dist/lib/zig dist/lib2 | ||
| 65 | rmdir dist/lib | ||
| 66 | mv dist/lib2 dist/lib | ||
| 67 | |||
| 68 | VERSION=$(dist/zig.exe version) | ||
| 69 | DIRNAME="zig-windows-x86_64-$VERSION" | ||
| 70 | TARBALL="$DIRNAME.zip" | ||
| 71 | mv dist "$DIRNAME" | ||
| 72 | 7z a "$TARBALL" "$DIRNAME" | ||
| 73 | |||
| 74 | s3cmd -c "$DOWNLOADSECUREFILE_SECUREFILEPATH" put -P --add-header="cache-control: public, max-age=31536000, immutable" "$TARBALL" s3://ziglang.org/builds/ | ||
| 75 | |||
| 76 | SHASUM=$(sha256sum $TARBALL | cut '-d ' -f1) | ||
| 77 | BYTESIZE=$(wc -c < $TARBALL) | ||
| 78 | |||
| 79 | JSONFILE="windows-$GITBRANCH.json" | ||
| 80 | touch $JSONFILE | ||
| 81 | echo "{\"tarball\": \"$TARBALL\"," >>$JSONFILE | ||
| 82 | echo "\"shasum\": \"$SHASUM\"," >>$JSONFILE | ||
| 83 | echo "\"size\": \"$BYTESIZE\"}" >>$JSONFILE | ||
| 84 | |||
| 85 | s3cmd -c "$DOWNLOADSECUREFILE_SECUREFILEPATH" put -P --add-header="Cache-Control: max-age=0, must-revalidate" "$JSONFILE" "s3://ziglang.org/builds/$JSONFILE" | ||
| 86 | s3cmd -c "$DOWNLOADSECUREFILE_SECUREFILEPATH" put -P "$JSONFILE" "s3://ziglang.org/builds/x86_64-windows-$VERSION.json" | ||
| 87 | |||
| 88 | # `set -x` causes these variables to be mangled. | ||
| 89 | # See https://developercommunity.visualstudio.com/content/problem/375679/pipeline-variable-incorrectly-inserts-single-quote.html | ||
| 90 | set +x | ||
| 91 | echo "##vso[task.setvariable variable=tarball;isOutput=true]$TARBALL" | ||
| 92 | echo "##vso[task.setvariable variable=shasum;isOutput=true]$SHASUM" | ||
| 93 | echo "##vso[task.setvariable variable=bytesize;isOutput=true]$BYTESIZE" | ||
| 94 | fi | ||
ci/azure/windows_script.bat created+8| ... | @@ -0,0 +1,8 @@ | ||
| 1 | @echo on | ||
| 2 | SET "SRCROOT=%cd%" | ||
| 3 | SET "PREVPATH=%PATH%" | ||
| 4 | SET "PREVMSYSTEM=%MSYSTEM%" | ||
| 5 | |||
| 6 | set "PATH=%CD:~0,2%\msys64\usr\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem" | ||
| 7 | SET "MSYSTEM=MINGW64" | ||
| 8 | bash -lc "cd ${SRCROOT} && ci/azure/windows_script" || exit /b | ||
ci/azure/windows_upload deleted-46| ... | @@ -1,46 +0,0 @@ | ||
| 1 | #!/bin/sh | ||
| 2 | |||
| 3 | set -x | ||
| 4 | set -e | ||
| 5 | |||
| 6 | if [ "${BUILD_REASON}" != "PullRequest" ]; then | ||
| 7 | cd "$ZIGBUILDDIR" | ||
| 8 | |||
| 9 | mv ../LICENSE dist/ | ||
| 10 | mv ../zig-cache/langref.html dist/ | ||
| 11 | mv dist/bin/zig.exe dist/ | ||
| 12 | rmdir dist/bin | ||
| 13 | |||
| 14 | # Remove the unnecessary zig dir in $prefix/lib/zig/std/std.zig | ||
| 15 | mv dist/lib/zig dist/lib2 | ||
| 16 | rmdir dist/lib | ||
| 17 | mv dist/lib2 dist/lib | ||
| 18 | |||
| 19 | VERSION=$(dist/zig.exe version) | ||
| 20 | DIRNAME="zig-windows-x86_64-$VERSION" | ||
| 21 | TARBALL="$DIRNAME.zip" | ||
| 22 | mv dist "$DIRNAME" | ||
| 23 | 7z a "$TARBALL" "$DIRNAME" | ||
| 24 | |||
| 25 | # mv "$DOWNLOADSECUREFILE_SECUREFILEPATH" "$HOME/.s3cfg" | ||
| 26 | s3cmd -c "$DOWNLOADSECUREFILE_SECUREFILEPATH" put -P --add-header="cache-control: public, max-age=31536000, immutable" "$TARBALL" s3://ziglang.org/builds/ | ||
| 27 | |||
| 28 | SHASUM=$(sha256sum $TARBALL | cut '-d ' -f1) | ||
| 29 | BYTESIZE=$(wc -c < $TARBALL) | ||
| 30 | |||
| 31 | JSONFILE="windows-$GITBRANCH.json" | ||
| 32 | touch $JSONFILE | ||
| 33 | echo "{\"tarball\": \"$TARBALL\"," >>$JSONFILE | ||
| 34 | echo "\"shasum\": \"$SHASUM\"," >>$JSONFILE | ||
| 35 | echo "\"size\": \"$BYTESIZE\"}" >>$JSONFILE | ||
| 36 | |||
| 37 | s3cmd -c "$DOWNLOADSECUREFILE_SECUREFILEPATH" put -P --add-header="Cache-Control: max-age=0, must-revalidate" "$JSONFILE" "s3://ziglang.org/builds/$JSONFILE" | ||
| 38 | s3cmd -c "$DOWNLOADSECUREFILE_SECUREFILEPATH" put -P "$JSONFILE" "s3://ziglang.org/builds/x86_64-windows-$VERSION.json" | ||
| 39 | |||
| 40 | # `set -x` causes these variables to be mangled. | ||
| 41 | # See https://developercommunity.visualstudio.com/content/problem/375679/pipeline-variable-incorrectly-inserts-single-quote.html | ||
| 42 | set +x | ||
| 43 | echo "##vso[task.setvariable variable=tarball;isOutput=true]$TARBALL" | ||
| 44 | echo "##vso[task.setvariable variable=shasum;isOutput=true]$SHASUM" | ||
| 45 | echo "##vso[task.setvariable variable=bytesize;isOutput=true]$BYTESIZE" | ||
| 46 | fi | ||
cmake/Findllvm.cmake+1-13| ... | @@ -181,19 +181,7 @@ else() | ... | @@ -181,19 +181,7 @@ else() |
| 181 | 181 | ||
| 182 | macro(FIND_AND_ADD_LLVM_LIB _libname_) | 182 | macro(FIND_AND_ADD_LLVM_LIB _libname_) |
| 183 | string(TOUPPER ${_libname_} _prettylibname_) | 183 | string(TOUPPER ${_libname_} _prettylibname_) |
| 184 | find_library(LLVM_${_prettylibname_}_LIB NAMES ${_libname_} | 184 | find_library(LLVM_${_prettylibname_}_LIB NAMES ${_libname_} PATHS ${LLVM_LIBDIRS}) |
| 185 | PATHS | ||
| 186 | ${LLVM_LIBDIRS} | ||
| 187 | /usr/lib/llvm/13/lib | ||
| 188 | /usr/lib/llvm-13/lib | ||
| 189 | /usr/lib/llvm-13.0/lib | ||
| 190 | /usr/local/llvm130/lib | ||
| 191 | /usr/local/llvm13/lib | ||
| 192 | /usr/local/opt/llvm@13/lib | ||
| 193 | /opt/homebrew/opt/llvm@13/lib | ||
| 194 | /mingw64/lib | ||
| 195 | /c/msys64/mingw64/lib | ||
| 196 | c:\\msys64\\mingw64\\lib) | ||
| 197 | set(LLVM_LIBRARIES ${LLVM_LIBRARIES} ${LLVM_${_prettylibname_}_LIB}) | 185 | set(LLVM_LIBRARIES ${LLVM_LIBRARIES} ${LLVM_${_prettylibname_}_LIB}) |
| 198 | endmacro(FIND_AND_ADD_LLVM_LIB) | 186 | endmacro(FIND_AND_ADD_LLVM_LIB) |
| 199 | 187 |
src/link/Coff.zig+3-5| ... | @@ -134,16 +134,14 @@ pub fn openPath(allocator: Allocator, sub_path: []const u8, options: link.Option | ... | @@ -134,16 +134,14 @@ pub fn openPath(allocator: Allocator, sub_path: []const u8, options: link.Option |
| 134 | return createEmpty(allocator, options); | 134 | return createEmpty(allocator, options); |
| 135 | } | 135 | } |
| 136 | 136 | ||
| 137 | const self = try createEmpty(allocator, options); | ||
| 138 | errdefer self.base.destroy(); | ||
| 139 | |||
| 137 | const file = try options.emit.?.directory.handle.createFile(sub_path, .{ | 140 | const file = try options.emit.?.directory.handle.createFile(sub_path, .{ |
| 138 | .truncate = false, | 141 | .truncate = false, |
| 139 | .read = true, | 142 | .read = true, |
| 140 | .mode = link.determineMode(options), | 143 | .mode = link.determineMode(options), |
| 141 | }); | 144 | }); |
| 142 | errdefer file.close(); | ||
| 143 | |||
| 144 | const self = try createEmpty(allocator, options); | ||
| 145 | errdefer self.base.destroy(); | ||
| 146 | |||
| 147 | self.base.file = file; | 145 | self.base.file = file; |
| 148 | 146 | ||
| 149 | // TODO Write object specific relocations, COFF symbol table, then enable object file output. | 147 | // TODO Write object specific relocations, COFF symbol table, then enable object file output. |
src/link/Elf.zig+3-4| ... | @@ -299,15 +299,14 @@ pub fn openPath(allocator: Allocator, sub_path: []const u8, options: link.Option | ... | @@ -299,15 +299,14 @@ pub fn openPath(allocator: Allocator, sub_path: []const u8, options: link.Option |
| 299 | return createEmpty(allocator, options); | 299 | return createEmpty(allocator, options); |
| 300 | } | 300 | } |
| 301 | 301 | ||
| 302 | const self = try createEmpty(allocator, options); | ||
| 303 | errdefer self.base.destroy(); | ||
| 304 | |||
| 302 | const file = try options.emit.?.directory.handle.createFile(sub_path, .{ | 305 | const file = try options.emit.?.directory.handle.createFile(sub_path, .{ |
| 303 | .truncate = false, | 306 | .truncate = false, |
| 304 | .read = true, | 307 | .read = true, |
| 305 | .mode = link.determineMode(options), | 308 | .mode = link.determineMode(options), |
| 306 | }); | 309 | }); |
| 307 | errdefer file.close(); | ||
| 308 | |||
| 309 | const self = try createEmpty(allocator, options); | ||
| 310 | errdefer self.base.destroy(); | ||
| 311 | 310 | ||
| 312 | self.base.file = file; | 311 | self.base.file = file; |
| 313 | self.shdr_table_dirty = true; | 312 | self.shdr_table_dirty = true; |
src/link/Plan9.zig+5-4| ... | @@ -643,14 +643,16 @@ pub fn openPath(allocator: Allocator, sub_path: []const u8, options: link.Option | ... | @@ -643,14 +643,16 @@ pub fn openPath(allocator: Allocator, sub_path: []const u8, options: link.Option |
| 643 | if (options.use_llvm) | 643 | if (options.use_llvm) |
| 644 | return error.LLVMBackendDoesNotSupportPlan9; | 644 | return error.LLVMBackendDoesNotSupportPlan9; |
| 645 | assert(options.object_format == .plan9); | 645 | assert(options.object_format == .plan9); |
| 646 | |||
| 647 | const self = try createEmpty(allocator, options); | ||
| 648 | errdefer self.base.destroy(); | ||
| 649 | |||
| 646 | const file = try options.emit.?.directory.handle.createFile(sub_path, .{ | 650 | const file = try options.emit.?.directory.handle.createFile(sub_path, .{ |
| 647 | .read = true, | 651 | .read = true, |
| 648 | .mode = link.determineMode(options), | 652 | .mode = link.determineMode(options), |
| 649 | }); | 653 | }); |
| 650 | errdefer file.close(); | 654 | errdefer file.close(); |
| 651 | 655 | self.base.file = file; | |
| 652 | const self = try createEmpty(allocator, options); | ||
| 653 | errdefer self.base.destroy(); | ||
| 654 | 656 | ||
| 655 | self.bases = defaultBaseAddrs(options.target.cpu.arch); | 657 | self.bases = defaultBaseAddrs(options.target.cpu.arch); |
| 656 | 658 | ||
| ... | @@ -673,7 +675,6 @@ pub fn openPath(allocator: Allocator, sub_path: []const u8, options: link.Option | ... | @@ -673,7 +675,6 @@ pub fn openPath(allocator: Allocator, sub_path: []const u8, options: link.Option |
| 673 | }, | 675 | }, |
| 674 | }); | 676 | }); |
| 675 | 677 | ||
| 676 | self.base.file = file; | ||
| 677 | return self; | 678 | return self; |
| 678 | } | 679 | } |
| 679 | 680 |
src/link/SpirV.zig+2-4| ... | @@ -104,13 +104,11 @@ pub fn openPath(allocator: Allocator, sub_path: []const u8, options: link.Option | ... | @@ -104,13 +104,11 @@ pub fn openPath(allocator: Allocator, sub_path: []const u8, options: link.Option |
| 104 | if (options.use_llvm) return error.LLVM_BackendIsTODO_ForSpirV; // TODO: LLVM Doesn't support SpirV at all. | 104 | if (options.use_llvm) return error.LLVM_BackendIsTODO_ForSpirV; // TODO: LLVM Doesn't support SpirV at all. |
| 105 | if (options.use_lld) return error.LLD_LinkingIsTODO_ForSpirV; // TODO: LLD Doesn't support SpirV at all. | 105 | if (options.use_lld) return error.LLD_LinkingIsTODO_ForSpirV; // TODO: LLD Doesn't support SpirV at all. |
| 106 | 106 | ||
| 107 | // TODO: read the file and keep valid parts instead of truncating | ||
| 108 | const file = try options.emit.?.directory.handle.createFile(sub_path, .{ .truncate = true, .read = true }); | ||
| 109 | errdefer file.close(); | ||
| 110 | |||
| 111 | const spirv = try createEmpty(allocator, options); | 107 | const spirv = try createEmpty(allocator, options); |
| 112 | errdefer spirv.base.destroy(); | 108 | errdefer spirv.base.destroy(); |
| 113 | 109 | ||
| 110 | // TODO: read the file and keep valid parts instead of truncating | ||
| 111 | const file = try options.emit.?.directory.handle.createFile(sub_path, .{ .truncate = true, .read = true }); | ||
| 114 | spirv.base.file = file; | 112 | spirv.base.file = file; |
| 115 | return spirv; | 113 | return spirv; |
| 116 | } | 114 | } |
src/link/Wasm.zig+2-4| ... | @@ -105,13 +105,11 @@ pub fn openPath(allocator: Allocator, sub_path: []const u8, options: link.Option | ... | @@ -105,13 +105,11 @@ pub fn openPath(allocator: Allocator, sub_path: []const u8, options: link.Option |
| 105 | return createEmpty(allocator, options); | 105 | return createEmpty(allocator, options); |
| 106 | } | 106 | } |
| 107 | 107 | ||
| 108 | // TODO: read the file and keep valid parts instead of truncating | ||
| 109 | const file = try options.emit.?.directory.handle.createFile(sub_path, .{ .truncate = true, .read = true }); | ||
| 110 | errdefer file.close(); | ||
| 111 | |||
| 112 | const wasm_bin = try createEmpty(allocator, options); | 108 | const wasm_bin = try createEmpty(allocator, options); |
| 113 | errdefer wasm_bin.base.destroy(); | 109 | errdefer wasm_bin.base.destroy(); |
| 114 | 110 | ||
| 111 | // TODO: read the file and keep valid parts instead of truncating | ||
| 112 | const file = try options.emit.?.directory.handle.createFile(sub_path, .{ .truncate = true, .read = true }); | ||
| 115 | wasm_bin.base.file = file; | 113 | wasm_bin.base.file = file; |
| 116 | 114 | ||
| 117 | try file.writeAll(&(wasm.magic ++ wasm.version)); | 115 | try file.writeAll(&(wasm.magic ++ wasm.version)); |
src/stage1/zig0.cpp+2-3| ... | @@ -18,10 +18,9 @@ | ... | @@ -18,10 +18,9 @@ |
| 18 | #include "buffer.hpp" | 18 | #include "buffer.hpp" |
| 19 | #include "os.hpp" | 19 | #include "os.hpp" |
| 20 | 20 | ||
| 21 | // This is the only file allowed to include config.h because config.h is | 21 | #ifndef ZIG_VERSION_STRING |
| 22 | // only produced when building with cmake. When using the zig build system, | ||
| 23 | // zig0.cpp is never touched. | ||
| 24 | #include "config.h" | 22 | #include "config.h" |
| 23 | #endif | ||
| 25 | 24 | ||
| 26 | #include <stdio.h> | 25 | #include <stdio.h> |
| 27 | #include <string.h> | 26 | #include <string.h> |