diff --git a/README.md b/README.md index 6b35922..7004bbb 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,8 @@ # boost-libraries-zig -Boost Libraries using `build.zig` +[Boost Libraries](https://boost.io) using `build.zig`. + +Replacing the [CMake](https://cmake.org/) and [B2](https://www.bfgroup.xyz/b2/) build system. ### Requirements @@ -8,6 +10,40 @@ Boost Libraries using `build.zig` ## How to use +Build libraries + +```bash +# Build no-header-only libraries +$ zig build -Doptimize= -Dtarget= --summary -Dcontext -Djson -Dsystem -Dcontainer -Dcobalt -Dfilesystem -Dheaders-only=false +``` + +#### Helper + +```bash +Project-Specific Options: + -Dtarget=[string] The CPU architecture, OS, and ABI to build for + -Dcpu=[string] Target CPU features to add or subtract + -Ddynamic-linker=[string] Path to interpreter on the target system + -Doptimize=[enum] Prioritize performance, safety, or binary size + Supported Values: + Debug + ReleaseSafe + ReleaseFast + ReleaseSmall + -Dheaders-only=[bool] Use headers-only libraries (default: true) + -Dcobalt=[bool] Build cobalt library (default: false) + -Dcontext=[bool] Build context library (default: false) + -Djson=[bool] Build json library (default: false) + -Dcontainer=[bool] Build container library (default: false) + -Dfilesystem=[bool] Build filesystem library (default: false) + -Dcoroutine2=[bool] Build coroutine2 library (default: false) + -Dsystem=[bool] Build system library (default: false) + -Dshared=[bool] Build as shared library (default: false) +``` + + +### or use in new zig project + Make directory and init ```bash diff --git a/build.zig b/build.zig index 5b0086f..66145d2 100644 --- a/build.zig +++ b/build.zig @@ -115,7 +115,7 @@ pub fn build(b: *std.Build) !void { const boost = boostLibraries(b, .{ .target = target, .optimize = optimize, - .header_only = b.option(bool, "headers-only", "Build headers-only libraries (default: true)") orelse true, + .headers_only = b.option(bool, "headers-only", "Use headers-only libraries (default: true)") orelse true, .module = .{ .cobalt = b.option(bool, "cobalt", "Build cobalt library (default: false)") orelse false, .context = b.option(bool, "context", "Build context library (default: false)") orelse false, @@ -123,6 +123,7 @@ pub fn build(b: *std.Build) !void { .container = b.option(bool, "container", "Build container library (default: false)") orelse false, .filesystem = b.option(bool, "filesystem", "Build filesystem library (default: false)") orelse false, .coroutine2 = b.option(bool, "coroutine2", "Build coroutine2 library (default: false)") orelse false, + .system = b.option(bool, "system", "Build system library (default: false)") orelse false, }, }); b.installArtifact(boost); @@ -138,7 +139,14 @@ const cxxFlags: []const []const u8 = &.{ const boost_version: std.SemanticVersion = .{ .major = 1, .minor = 86, .patch = 0 }; pub fn boostLibraries(b: *std.Build, config: Config) *std.Build.Step.Compile { - const lib = b.addStaticLibrary(.{ + const shared = b.option(bool, "shared", "Build as shared library (default: false)") orelse false; + + const lib = if (shared) b.addSharedLibrary(.{ + .name = "boost", + .target = config.target, + .optimize = config.optimize, + .version = boost_version, + }) else b.addStaticLibrary(.{ .name = "boost", .target = config.target, .optimize = config.optimize, @@ -150,7 +158,7 @@ pub fn boostLibraries(b: *std.Build, config: Config) *std.Build.Step.Compile { lib.addIncludePath(boostLib); } - if (config.header_only) { + if (config.headers_only) { // zig-pkg bypass (artifact need source file) const empty = b.addWriteFile("empty.cc", \\ #include @@ -165,7 +173,7 @@ pub fn boostLibraries(b: *std.Build, config: Config) *std.Build.Step.Compile { if (config.module) |module| { if (module.cobalt) { const boostCobalt = buildCobalt(b, .{ - .header_only = config.header_only, + .headers_only = config.headers_only, .target = config.target, .optimize = config.optimize, .include_dirs = lib.root_module.include_dirs, @@ -174,7 +182,7 @@ pub fn boostLibraries(b: *std.Build, config: Config) *std.Build.Step.Compile { } if (module.container) { const boostContainer = buildContainer(b, .{ - .header_only = config.header_only, + .headers_only = config.headers_only, .target = config.target, .optimize = config.optimize, .include_dirs = lib.root_module.include_dirs, @@ -183,7 +191,7 @@ pub fn boostLibraries(b: *std.Build, config: Config) *std.Build.Step.Compile { } if (module.context) { const boostContext = buildContext(b, .{ - .header_only = config.header_only, + .headers_only = config.headers_only, .target = config.target, .optimize = config.optimize, .include_dirs = lib.root_module.include_dirs, @@ -192,13 +200,31 @@ pub fn boostLibraries(b: *std.Build, config: Config) *std.Build.Step.Compile { } if (module.json) { const boostJson = buildJson(b, .{ - .header_only = config.header_only, + .headers_only = config.headers_only, .target = config.target, .optimize = config.optimize, .include_dirs = lib.root_module.include_dirs, }); lib.addObject(boostJson); } + if (module.filesystem) { + const boostFileSystem = buildFileSystem(b, .{ + .headers_only = config.headers_only, + .target = config.target, + .optimize = config.optimize, + .include_dirs = lib.root_module.include_dirs, + }); + lib.addObject(boostFileSystem); + } + if (module.system) { + const boostSystem = buildSystem(b, .{ + .headers_only = config.headers_only, + .target = config.target, + .optimize = config.optimize, + .include_dirs = lib.root_module.include_dirs, + }); + lib.addObject(boostSystem); + } } } if (lib.rootModuleTarget().abi == .msvc) @@ -211,7 +237,7 @@ pub fn boostLibraries(b: *std.Build, config: Config) *std.Build.Step.Compile { } pub const Config = struct { - header_only: bool = false, + headers_only: bool = false, target: std.Build.ResolvedTarget, optimize: std.builtin.OptimizeMode, module: ?boostLibrariesModules = null, @@ -226,10 +252,11 @@ const boostLibrariesModules = struct { container: bool = false, filesystem: bool = false, cobalt: bool = false, + system: bool = false, }; fn buildCobalt(b: *std.Build, config: Config) *std.Build.Step.Compile { - const cobaltPath = b.dependency("cobalt", .{}).path(""); + const cobaltPath = b.dependency("cobalt", .{}).path("src"); const obj = b.addObject(.{ .name = "cobalt", .target = config.target, @@ -246,13 +273,13 @@ fn buildCobalt(b: *std.Build, config: Config) *std.Build.Step.Compile { obj.addCSourceFiles(.{ .root = cobaltPath, .files = &.{ - "src/channel.cpp", - "src/detail/exception.cpp", - "src/detail/util.cpp", - "src/error.cpp", - "src/main.cpp", - "src/this_thread.cpp", - "src/thread.cpp", + "channel.cpp", + "detail/exception.cpp", + "detail/util.cpp", + "error.cpp", + "main.cpp", + "this_thread.cpp", + "thread.cpp", }, .flags = cxxFlags ++ &[_][]const u8{"-std=c++20"}, }); @@ -267,7 +294,7 @@ fn buildCobalt(b: *std.Build, config: Config) *std.Build.Step.Compile { } fn buildContainer(b: *std.Build, config: Config) *std.Build.Step.Compile { - const containerPath = b.dependency("container", .{}).path(""); + const containerPath = b.dependency("container", .{}).path("src"); const obj = b.addObject(.{ .name = "container", .target = config.target, @@ -282,11 +309,11 @@ fn buildContainer(b: *std.Build, config: Config) *std.Build.Step.Compile { obj.addCSourceFiles(.{ .root = containerPath, .files = &.{ - "src/pool_resource.cpp", - "src/monotonic_buffer_resource.cpp", - "src/synchronized_pool_resource.cpp", - "src/unsynchronized_pool_resource.cpp", - "src/global_resource.cpp", + "pool_resource.cpp", + "monotonic_buffer_resource.cpp", + "synchronized_pool_resource.cpp", + "unsynchronized_pool_resource.cpp", + "global_resource.cpp", }, .flags = cxxFlags, }); @@ -301,7 +328,7 @@ fn buildContainer(b: *std.Build, config: Config) *std.Build.Step.Compile { } fn buildJson(b: *std.Build, config: Config) *std.Build.Step.Compile { - const jsonPath = b.dependency("json", .{}).path(""); + const jsonPath = b.dependency("json", .{}).path("src"); const obj = b.addObject(.{ .name = "json", .target = config.target, @@ -316,7 +343,7 @@ fn buildJson(b: *std.Build, config: Config) *std.Build.Step.Compile { obj.addCSourceFiles(.{ .root = jsonPath, .files = &.{ - "src/src.cpp", + "src.cpp", }, .flags = cxxFlags, }); @@ -330,8 +357,91 @@ fn buildJson(b: *std.Build, config: Config) *std.Build.Step.Compile { return obj; } +fn buildSystem(b: *std.Build, config: Config) *std.Build.Step.Compile { + const systemPath = b.dependency("system", .{}).path("src"); + const obj = b.addObject(.{ + .name = "system", + .target = config.target, + .optimize = config.optimize, + }); + + if (config.include_dirs) |include_dirs| { + for (include_dirs.items) |include| { + obj.root_module.include_dirs.append(b.allocator, include) catch unreachable; + } + } + obj.addCSourceFiles(.{ + .root = systemPath, + .files = &.{ + "error_code.cpp", + }, + .flags = cxxFlags, + }); + if (obj.rootModuleTarget().abi == .msvc) + obj.linkLibC() + else { + obj.defineCMacro("_GNU_SOURCE", null); + obj.linkLibCpp(); + } + + return obj; +} + +fn buildFileSystem(b: *std.Build, config: Config) *std.Build.Step.Compile { + const fsPath = b.dependency("filesystem", .{}).path("src"); + const obj = b.addObject(.{ + .name = "filesystem", + .target = config.target, + .optimize = config.optimize, + }); + + if (config.include_dirs) |include_dirs| { + for (include_dirs.items) |include| { + obj.root_module.include_dirs.append(b.allocator, include) catch unreachable; + } + } + if (obj.rootModuleTarget().os.tag == .windows) { + obj.addCSourceFiles(.{ + .root = fsPath, + .files = &.{"windows_file_codecvt.cpp"}, + .flags = cxxFlags, + }); + obj.defineCMacro("BOOST_USE_WINDOWS_H", null); + obj.defineCMacro("NOMINMAX", null); + } + obj.defineCMacro("BOOST_FILESYSTEM_NO_CXX20_ATOMIC_REF", null); + obj.addIncludePath(fsPath); + obj.addCSourceFiles(.{ + .root = fsPath, + .files = &.{ + "codecvt_error_category.cpp", + "directory.cpp", + "exception.cpp", + "path.cpp", + "path_traits.cpp", + "portability.cpp", + "operations.cpp", + "unique_path.cpp", + "utf8_codecvt_facet.cpp", + }, + .flags = cxxFlags, + }); + if (obj.rootModuleTarget().abi == .msvc) { + obj.linkLibC(); + obj.defineCMacro("_SCL_SECURE_NO_WARNINGS", null); + obj.defineCMacro("_SCL_SECURE_NO_DEPRECATE", null); + obj.defineCMacro("_CRT_SECURE_NO_WARNINGS", null); + obj.defineCMacro("_CRT_SECURE_NO_DEPRECATE", null); + } else { + obj.defineCMacro("_GNU_SOURCE", null); + obj.linkLibCpp(); + } + + return obj; +} + fn buildContext(b: *std.Build, config: Config) *std.Build.Step.Compile { - const contextPath = b.dependency("context", .{}).path(""); + const contextPath = b.dependency("context", .{}).path("src"); const obj = b.addObject(.{ .name = "context", .target = config.target, @@ -345,13 +455,13 @@ fn buildContext(b: *std.Build, config: Config) *std.Build.Step.Compile { } const ctxPath = contextPath.getPath(b); obj.addIncludePath(.{ - .cwd_relative = b.pathJoin(&.{ ctxPath, "src/asm" }), + .cwd_relative = b.pathJoin(&.{ ctxPath, "asm" }), }); // common.h obj.addCSourceFiles(.{ .root = contextPath, .files = &.{ - "src/continuation.cpp", - "src/fiber.cpp", + "continuation.cpp", + "fiber.cpp", }, .flags = cxxFlags, }); @@ -359,10 +469,10 @@ fn buildContext(b: *std.Build, config: Config) *std.Build.Step.Compile { obj.addCSourceFile(.{ .file = switch (obj.rootModuleTarget().os.tag) { .windows => .{ - .cwd_relative = b.pathJoin(&.{ ctxPath, "src/windows/stack_traits.cpp" }), + .cwd_relative = b.pathJoin(&.{ ctxPath, "windows/stack_traits.cpp" }), }, else => .{ - .cwd_relative = b.pathJoin(&.{ ctxPath, "src/posix/stack_traits.cpp" }), + .cwd_relative = b.pathJoin(&.{ ctxPath, "posix/stack_traits.cpp" }), }, }, .flags = cxxFlags, @@ -377,123 +487,123 @@ fn buildContext(b: *std.Build, config: Config) *std.Build.Step.Compile { .arm => switch (obj.rootModuleTarget().os.tag) { .windows => { if (obj.rootModuleTarget().abi == .msvc) { - obj.addAssemblyFile(.{ .cwd_relative = b.pathJoin(&.{ ctxPath, "src/asm/jump_arm_aapcs_pe_armasm.asm" }) }); - obj.addAssemblyFile(.{ .cwd_relative = b.pathJoin(&.{ ctxPath, "src/asm/make_arm_aapcs_pe_armasm.asm" }) }); - obj.addAssemblyFile(.{ .cwd_relative = b.pathJoin(&.{ ctxPath, "src/asm/ontop_arm_aapcs_pe_armasm.asm" }) }); + obj.addAssemblyFile(.{ .cwd_relative = b.pathJoin(&.{ ctxPath, "asm/jump_arm_aapcs_pe_armasm.asm" }) }); + obj.addAssemblyFile(.{ .cwd_relative = b.pathJoin(&.{ ctxPath, "asm/make_arm_aapcs_pe_armasm.asm" }) }); + obj.addAssemblyFile(.{ .cwd_relative = b.pathJoin(&.{ ctxPath, "asm/ontop_arm_aapcs_pe_armasm.asm" }) }); } }, .macos => { - obj.addAssemblyFile(.{ .cwd_relative = b.pathJoin(&.{ ctxPath, "src/asm/jump_arm_aapcs_macho_gas.S" }) }); - obj.addAssemblyFile(.{ .cwd_relative = b.pathJoin(&.{ ctxPath, "src/asm/make_arm_aapcs_macho_gas.S" }) }); - obj.addAssemblyFile(.{ .cwd_relative = b.pathJoin(&.{ ctxPath, "src/asm/ontop_arm_aapcs_macho_gas.S" }) }); + obj.addAssemblyFile(.{ .cwd_relative = b.pathJoin(&.{ ctxPath, "asm/jump_arm_aapcs_macho_gas.S" }) }); + obj.addAssemblyFile(.{ .cwd_relative = b.pathJoin(&.{ ctxPath, "asm/make_arm_aapcs_macho_gas.S" }) }); + obj.addAssemblyFile(.{ .cwd_relative = b.pathJoin(&.{ ctxPath, "asm/ontop_arm_aapcs_macho_gas.S" }) }); }, else => { - obj.addAssemblyFile(.{ .cwd_relative = b.pathJoin(&.{ ctxPath, "src/asm/jump_arm_aapcs_elf_gas.S" }) }); - obj.addAssemblyFile(.{ .cwd_relative = b.pathJoin(&.{ ctxPath, "src/asm/make_arm_aapcs_elf_gas.S" }) }); - obj.addAssemblyFile(.{ .cwd_relative = b.pathJoin(&.{ ctxPath, "src/asm/ontop_arm_aapcs_elf_gas.S" }) }); + obj.addAssemblyFile(.{ .cwd_relative = b.pathJoin(&.{ ctxPath, "asm/jump_arm_aapcs_elf_gas.S" }) }); + obj.addAssemblyFile(.{ .cwd_relative = b.pathJoin(&.{ ctxPath, "asm/make_arm_aapcs_elf_gas.S" }) }); + obj.addAssemblyFile(.{ .cwd_relative = b.pathJoin(&.{ ctxPath, "asm/ontop_arm_aapcs_elf_gas.S" }) }); }, }, .aarch64 => switch (obj.rootModuleTarget().os.tag) { .windows => { if (obj.rootModuleTarget().abi == .msvc) { - obj.addAssemblyFile(.{ .cwd_relative = b.pathJoin(&.{ ctxPath, "src/asm/jump_arm64_aapcs_pe_armasm.asm" }) }); - obj.addAssemblyFile(.{ .cwd_relative = b.pathJoin(&.{ ctxPath, "src/asm/make_arm64_aapcs_pe_armasm.asm" }) }); - obj.addAssemblyFile(.{ .cwd_relative = b.pathJoin(&.{ ctxPath, "src/asm/ontop_arm64_aapcs_pe_armasm.asm" }) }); + obj.addAssemblyFile(.{ .cwd_relative = b.pathJoin(&.{ ctxPath, "asm/jump_arm64_aapcs_pe_armasm.asm" }) }); + obj.addAssemblyFile(.{ .cwd_relative = b.pathJoin(&.{ ctxPath, "asm/make_arm64_aapcs_pe_armasm.asm" }) }); + obj.addAssemblyFile(.{ .cwd_relative = b.pathJoin(&.{ ctxPath, "asm/ontop_arm64_aapcs_pe_armasm.asm" }) }); } }, .macos => { - obj.addAssemblyFile(.{ .cwd_relative = b.pathJoin(&.{ ctxPath, "src/asm/jump_arm64_aapcs_macho_gas.S" }) }); - obj.addAssemblyFile(.{ .cwd_relative = b.pathJoin(&.{ ctxPath, "src/asm/make_arm64_aapcs_macho_gas.S" }) }); - obj.addAssemblyFile(.{ .cwd_relative = b.pathJoin(&.{ ctxPath, "src/asm/ontop_arm64_aapcs_macho_gas.S" }) }); + obj.addAssemblyFile(.{ .cwd_relative = b.pathJoin(&.{ ctxPath, "asm/jump_arm64_aapcs_macho_gas.S" }) }); + obj.addAssemblyFile(.{ .cwd_relative = b.pathJoin(&.{ ctxPath, "asm/make_arm64_aapcs_macho_gas.S" }) }); + obj.addAssemblyFile(.{ .cwd_relative = b.pathJoin(&.{ ctxPath, "asm/ontop_arm64_aapcs_macho_gas.S" }) }); }, else => { - obj.addAssemblyFile(.{ .cwd_relative = b.pathJoin(&.{ ctxPath, "src/asm/jump_arm64_aapcs_elf_gas.S" }) }); - obj.addAssemblyFile(.{ .cwd_relative = b.pathJoin(&.{ ctxPath, "src/asm/make_arm64_aapcs_elf_gas.S" }) }); - obj.addAssemblyFile(.{ .cwd_relative = b.pathJoin(&.{ ctxPath, "src/asm/ontop_arm64_aapcs_elf_gas.S" }) }); + obj.addAssemblyFile(.{ .cwd_relative = b.pathJoin(&.{ ctxPath, "asm/jump_arm64_aapcs_elf_gas.S" }) }); + obj.addAssemblyFile(.{ .cwd_relative = b.pathJoin(&.{ ctxPath, "asm/make_arm64_aapcs_elf_gas.S" }) }); + obj.addAssemblyFile(.{ .cwd_relative = b.pathJoin(&.{ ctxPath, "asm/ontop_arm64_aapcs_elf_gas.S" }) }); }, }, .riscv64 => { - obj.addAssemblyFile(.{ .cwd_relative = b.pathJoin(&.{ ctxPath, "src/asm/jump_riscv64_sysv_elf_gas.S" }) }); - obj.addAssemblyFile(.{ .cwd_relative = b.pathJoin(&.{ ctxPath, "src/asm/make_riscv64_sysv_elf_gas.S" }) }); - obj.addAssemblyFile(.{ .cwd_relative = b.pathJoin(&.{ ctxPath, "src/asm/ontop_riscv64_sysv_elf_gas.S" }) }); + obj.addAssemblyFile(.{ .cwd_relative = b.pathJoin(&.{ ctxPath, "asm/jump_riscv64_sysv_elf_gas.S" }) }); + obj.addAssemblyFile(.{ .cwd_relative = b.pathJoin(&.{ ctxPath, "asm/make_riscv64_sysv_elf_gas.S" }) }); + obj.addAssemblyFile(.{ .cwd_relative = b.pathJoin(&.{ ctxPath, "asm/ontop_riscv64_sysv_elf_gas.S" }) }); }, .x86 => switch (obj.rootModuleTarget().os.tag) { .windows => { // @panic("undefined symbol:{j/m/o}-fcontext"); - obj.addAssemblyFile(.{ .cwd_relative = b.pathJoin(&.{ ctxPath, "src/asm/jump_i386_ms_pe_clang_gas.S" }) }); - obj.addAssemblyFile(.{ .cwd_relative = b.pathJoin(&.{ ctxPath, "src/asm/make_i386_ms_pe_clang_gas.S" }) }); - obj.addAssemblyFile(.{ .cwd_relative = b.pathJoin(&.{ ctxPath, "src/asm/ontop_i386_ms_pe_clang_gas.S" }) }); - obj.addAssemblyFile(.{ .cwd_relative = b.pathJoin(&.{ ctxPath, "src/asm/jump_i386_ms_pe_gas.S" }) }); - obj.addAssemblyFile(.{ .cwd_relative = b.pathJoin(&.{ ctxPath, "src/asm/make_i386_ms_pe_gas.S" }) }); - obj.addAssemblyFile(.{ .cwd_relative = b.pathJoin(&.{ ctxPath, "src/asm/ontop_i386_ms_pe_gas.S" }) }); + obj.addAssemblyFile(.{ .cwd_relative = b.pathJoin(&.{ ctxPath, "asm/jump_i386_ms_pe_clang_gas.S" }) }); + obj.addAssemblyFile(.{ .cwd_relative = b.pathJoin(&.{ ctxPath, "asm/make_i386_ms_pe_clang_gas.S" }) }); + obj.addAssemblyFile(.{ .cwd_relative = b.pathJoin(&.{ ctxPath, "asm/ontop_i386_ms_pe_clang_gas.S" }) }); + obj.addAssemblyFile(.{ .cwd_relative = b.pathJoin(&.{ ctxPath, "asm/jump_i386_ms_pe_gas.S" }) }); + obj.addAssemblyFile(.{ .cwd_relative = b.pathJoin(&.{ ctxPath, "asm/make_i386_ms_pe_gas.S" }) }); + obj.addAssemblyFile(.{ .cwd_relative = b.pathJoin(&.{ ctxPath, "asm/ontop_i386_ms_pe_gas.S" }) }); }, .macos => { - obj.addAssemblyFile(.{ .cwd_relative = b.pathJoin(&.{ ctxPath, "src/asm/jump_i386_x86_64_sysv_macho_gas.S" }) }); - obj.addAssemblyFile(.{ .cwd_relative = b.pathJoin(&.{ ctxPath, "src/asm/jump_i386_sysv_macho_gas.S" }) }); - obj.addAssemblyFile(.{ .cwd_relative = b.pathJoin(&.{ ctxPath, "src/asm/make_i386_x86_64_sysv_macho_gas.S" }) }); - obj.addAssemblyFile(.{ .cwd_relative = b.pathJoin(&.{ ctxPath, "src/asm/make_i386_sysv_macho_gas.S" }) }); - obj.addAssemblyFile(.{ .cwd_relative = b.pathJoin(&.{ ctxPath, "src/asm/ontop_i386_sysv_macho_gas.S" }) }); - obj.addAssemblyFile(.{ .cwd_relative = b.pathJoin(&.{ ctxPath, "src/asm/ontop_i386_x86_64_sysv_macho_gas.S" }) }); + obj.addAssemblyFile(.{ .cwd_relative = b.pathJoin(&.{ ctxPath, "asm/jump_i386_x86_64_sysv_macho_gas.S" }) }); + obj.addAssemblyFile(.{ .cwd_relative = b.pathJoin(&.{ ctxPath, "asm/jump_i386_sysv_macho_gas.S" }) }); + obj.addAssemblyFile(.{ .cwd_relative = b.pathJoin(&.{ ctxPath, "asm/make_i386_x86_64_sysv_macho_gas.S" }) }); + obj.addAssemblyFile(.{ .cwd_relative = b.pathJoin(&.{ ctxPath, "asm/make_i386_sysv_macho_gas.S" }) }); + obj.addAssemblyFile(.{ .cwd_relative = b.pathJoin(&.{ ctxPath, "asm/ontop_i386_sysv_macho_gas.S" }) }); + obj.addAssemblyFile(.{ .cwd_relative = b.pathJoin(&.{ ctxPath, "asm/ontop_i386_x86_64_sysv_macho_gas.S" }) }); }, else => { - obj.addAssemblyFile(.{ .cwd_relative = b.pathJoin(&.{ ctxPath, "src/asm/jump_i386_sysv_elf_gas.S" }) }); - obj.addAssemblyFile(.{ .cwd_relative = b.pathJoin(&.{ ctxPath, "src/asm/make_i386_sysv_elf_gas.S" }) }); - obj.addAssemblyFile(.{ .cwd_relative = b.pathJoin(&.{ ctxPath, "src/asm/ontop_i386_sysv_elf_gas.S" }) }); + obj.addAssemblyFile(.{ .cwd_relative = b.pathJoin(&.{ ctxPath, "asm/jump_i386_sysv_elf_gas.S" }) }); + obj.addAssemblyFile(.{ .cwd_relative = b.pathJoin(&.{ ctxPath, "asm/make_i386_sysv_elf_gas.S" }) }); + obj.addAssemblyFile(.{ .cwd_relative = b.pathJoin(&.{ ctxPath, "asm/ontop_i386_sysv_elf_gas.S" }) }); }, }, .x86_64 => switch (obj.rootModuleTarget().os.tag) { .windows => { - obj.addAssemblyFile(.{ .cwd_relative = b.pathJoin(&.{ ctxPath, "src/asm/jump_x86_64_ms_pe_clang_gas.S" }) }); - obj.addAssemblyFile(.{ .cwd_relative = b.pathJoin(&.{ ctxPath, "src/asm/make_x86_64_ms_pe_clang_gas.S" }) }); - obj.addAssemblyFile(.{ .cwd_relative = b.pathJoin(&.{ ctxPath, "src/asm/ontop_x86_64_ms_pe_clang_gas.S" }) }); + obj.addAssemblyFile(.{ .cwd_relative = b.pathJoin(&.{ ctxPath, "asm/jump_x86_64_ms_pe_clang_gas.S" }) }); + obj.addAssemblyFile(.{ .cwd_relative = b.pathJoin(&.{ ctxPath, "asm/make_x86_64_ms_pe_clang_gas.S" }) }); + obj.addAssemblyFile(.{ .cwd_relative = b.pathJoin(&.{ ctxPath, "asm/ontop_x86_64_ms_pe_clang_gas.S" }) }); }, .macos => { - obj.addAssemblyFile(.{ .cwd_relative = b.pathJoin(&.{ ctxPath, "src/asm/jump_i386_x86_64_sysv_macho_gas.S" }) }); - obj.addAssemblyFile(.{ .cwd_relative = b.pathJoin(&.{ ctxPath, "src/asm/jump_x86_64_sysv_macho_gas.S" }) }); - obj.addAssemblyFile(.{ .cwd_relative = b.pathJoin(&.{ ctxPath, "src/asm/make_i386_x86_64_sysv_macho_gas.S" }) }); - obj.addAssemblyFile(.{ .cwd_relative = b.pathJoin(&.{ ctxPath, "src/asm/make_x86_64_sysv_macho_gas.S" }) }); - obj.addAssemblyFile(.{ .cwd_relative = b.pathJoin(&.{ ctxPath, "src/asm/ontop_x86_64_sysv_macho_gas.S" }) }); - obj.addAssemblyFile(.{ .cwd_relative = b.pathJoin(&.{ ctxPath, "src/asm/ontop_i386_x86_64_sysv_macho_gas.S" }) }); + obj.addAssemblyFile(.{ .cwd_relative = b.pathJoin(&.{ ctxPath, "asm/jump_i386_x86_64_sysv_macho_gas.S" }) }); + obj.addAssemblyFile(.{ .cwd_relative = b.pathJoin(&.{ ctxPath, "asm/jump_x86_64_sysv_macho_gas.S" }) }); + obj.addAssemblyFile(.{ .cwd_relative = b.pathJoin(&.{ ctxPath, "asm/make_i386_x86_64_sysv_macho_gas.S" }) }); + obj.addAssemblyFile(.{ .cwd_relative = b.pathJoin(&.{ ctxPath, "asm/make_x86_64_sysv_macho_gas.S" }) }); + obj.addAssemblyFile(.{ .cwd_relative = b.pathJoin(&.{ ctxPath, "asm/ontop_x86_64_sysv_macho_gas.S" }) }); + obj.addAssemblyFile(.{ .cwd_relative = b.pathJoin(&.{ ctxPath, "asm/ontop_i386_x86_64_sysv_macho_gas.S" }) }); }, else => { - obj.addAssemblyFile(.{ .cwd_relative = b.pathJoin(&.{ ctxPath, "src/asm/jump_x86_64_sysv_elf_gas.S" }) }); - obj.addAssemblyFile(.{ .cwd_relative = b.pathJoin(&.{ ctxPath, "src/asm/make_x86_64_sysv_elf_gas.S" }) }); - obj.addAssemblyFile(.{ .cwd_relative = b.pathJoin(&.{ ctxPath, "src/asm/ontop_x86_64_sysv_elf_gas.S" }) }); + obj.addAssemblyFile(.{ .cwd_relative = b.pathJoin(&.{ ctxPath, "asm/jump_x86_64_sysv_elf_gas.S" }) }); + obj.addAssemblyFile(.{ .cwd_relative = b.pathJoin(&.{ ctxPath, "asm/make_x86_64_sysv_elf_gas.S" }) }); + obj.addAssemblyFile(.{ .cwd_relative = b.pathJoin(&.{ ctxPath, "asm/ontop_x86_64_sysv_elf_gas.S" }) }); }, }, .s390x => { - obj.addAssemblyFile(.{ .cwd_relative = b.pathJoin(&.{ ctxPath, "src/asm/jump_s390x_sysv_elf_gas.S" }) }); - obj.addAssemblyFile(.{ .cwd_relative = b.pathJoin(&.{ ctxPath, "src/asm/make_s390x_sysv_elf_gas.S" }) }); - obj.addAssemblyFile(.{ .cwd_relative = b.pathJoin(&.{ ctxPath, "src/asm/ontop_s390x_sysv_elf_gas.S" }) }); + obj.addAssemblyFile(.{ .cwd_relative = b.pathJoin(&.{ ctxPath, "asm/jump_s390x_sysv_elf_gas.S" }) }); + obj.addAssemblyFile(.{ .cwd_relative = b.pathJoin(&.{ ctxPath, "asm/make_s390x_sysv_elf_gas.S" }) }); + obj.addAssemblyFile(.{ .cwd_relative = b.pathJoin(&.{ ctxPath, "asm/ontop_s390x_sysv_elf_gas.S" }) }); }, .mips, .mipsel => { - obj.addAssemblyFile(.{ .cwd_relative = b.pathJoin(&.{ ctxPath, "src/asm/jump_mips32_o32_elf_gas.S" }) }); - obj.addAssemblyFile(.{ .cwd_relative = b.pathJoin(&.{ ctxPath, "src/asm/make_mips32_o32_elf_gas.S" }) }); - obj.addAssemblyFile(.{ .cwd_relative = b.pathJoin(&.{ ctxPath, "src/asm/ontop_mips32_o32_elf_gas.S" }) }); + obj.addAssemblyFile(.{ .cwd_relative = b.pathJoin(&.{ ctxPath, "asm/jump_mips32_o32_elf_gas.S" }) }); + obj.addAssemblyFile(.{ .cwd_relative = b.pathJoin(&.{ ctxPath, "asm/make_mips32_o32_elf_gas.S" }) }); + obj.addAssemblyFile(.{ .cwd_relative = b.pathJoin(&.{ ctxPath, "asm/ontop_mips32_o32_elf_gas.S" }) }); }, .mips64, .mips64el => { - obj.addAssemblyFile(.{ .cwd_relative = b.pathJoin(&.{ ctxPath, "src/asm/jump_mips64_n64_elf_gas.S" }) }); - obj.addAssemblyFile(.{ .cwd_relative = b.pathJoin(&.{ ctxPath, "src/asm/make_mips64_n64_elf_gas.S" }) }); - obj.addAssemblyFile(.{ .cwd_relative = b.pathJoin(&.{ ctxPath, "src/asm/ontop_mips64_n64_elf_gas.S" }) }); + obj.addAssemblyFile(.{ .cwd_relative = b.pathJoin(&.{ ctxPath, "asm/jump_mips64_n64_elf_gas.S" }) }); + obj.addAssemblyFile(.{ .cwd_relative = b.pathJoin(&.{ ctxPath, "asm/make_mips64_n64_elf_gas.S" }) }); + obj.addAssemblyFile(.{ .cwd_relative = b.pathJoin(&.{ ctxPath, "asm/ontop_mips64_n64_elf_gas.S" }) }); }, .loongarch64 => { - obj.addAssemblyFile(.{ .cwd_relative = b.pathJoin(&.{ ctxPath, "src/asm/jump_loongarch64_sysv_elf_gas.S" }) }); - obj.addAssemblyFile(.{ .cwd_relative = b.pathJoin(&.{ ctxPath, "src/asm/make_loongarch64_sysv_elf_gas.S" }) }); - obj.addAssemblyFile(.{ .cwd_relative = b.pathJoin(&.{ ctxPath, "src/asm/ontop_loongarch64_sysv_elf_gas.S" }) }); + obj.addAssemblyFile(.{ .cwd_relative = b.pathJoin(&.{ ctxPath, "asm/jump_loongarch64_sysv_elf_gas.S" }) }); + obj.addAssemblyFile(.{ .cwd_relative = b.pathJoin(&.{ ctxPath, "asm/make_loongarch64_sysv_elf_gas.S" }) }); + obj.addAssemblyFile(.{ .cwd_relative = b.pathJoin(&.{ ctxPath, "asm/ontop_loongarch64_sysv_elf_gas.S" }) }); }, .powerpc => { obj.addCSourceFile(.{ - .file = .{ .cwd_relative = b.pathJoin(&.{ ctxPath, "src/asm/tail_ontop_ppc32_sysv.cpp" }) }, + .file = .{ .cwd_relative = b.pathJoin(&.{ ctxPath, "asm/tail_ontop_ppc32_sysv.cpp" }) }, .flags = cxxFlags, }); - obj.addAssemblyFile(.{ .cwd_relative = b.pathJoin(&.{ ctxPath, "src/asm/jump_ppc32_sysv_elf_gas.S" }) }); - obj.addAssemblyFile(.{ .cwd_relative = b.pathJoin(&.{ ctxPath, "src/asm/make_ppc32_sysv_elf_gas.S" }) }); - obj.addAssemblyFile(.{ .cwd_relative = b.pathJoin(&.{ ctxPath, "src/asm/ontop_ppc32_sysv_elf_gas.S" }) }); + obj.addAssemblyFile(.{ .cwd_relative = b.pathJoin(&.{ ctxPath, "asm/jump_ppc32_sysv_elf_gas.S" }) }); + obj.addAssemblyFile(.{ .cwd_relative = b.pathJoin(&.{ ctxPath, "asm/make_ppc32_sysv_elf_gas.S" }) }); + obj.addAssemblyFile(.{ .cwd_relative = b.pathJoin(&.{ ctxPath, "asm/ontop_ppc32_sysv_elf_gas.S" }) }); }, .powerpc64 => { - obj.addAssemblyFile(.{ .cwd_relative = b.pathJoin(&.{ ctxPath, "src/asm/jump_ppc64_sysv_elf_gas.S" }) }); - obj.addAssemblyFile(.{ .cwd_relative = b.pathJoin(&.{ ctxPath, "src/asm/make_ppc64_sysv_elf_gas.S" }) }); - obj.addAssemblyFile(.{ .cwd_relative = b.pathJoin(&.{ ctxPath, "src/asm/ontop_ppc64_sysv_elf_gas.S" }) }); + obj.addAssemblyFile(.{ .cwd_relative = b.pathJoin(&.{ ctxPath, "asm/jump_ppc64_sysv_elf_gas.S" }) }); + obj.addAssemblyFile(.{ .cwd_relative = b.pathJoin(&.{ ctxPath, "asm/make_ppc64_sysv_elf_gas.S" }) }); + obj.addAssemblyFile(.{ .cwd_relative = b.pathJoin(&.{ ctxPath, "asm/ontop_ppc64_sysv_elf_gas.S" }) }); }, else => @panic("Invalid arch"), }