| ... | ... | @@ -7,6 +7,13 @@ const Compilation = @import("Compilation.zig"); |
| 7 | 7 | const build_options = @import("build_options"); |
| 8 | 8 | const trace = @import("tracy.zig").trace; |
| 9 | 9 | |
| 10 | pub const AbiVersion = enum(u2) { |
| 11 | @"1" = 1, |
| 12 | @"2" = 2, |
| 13 | |
| 14 | pub const default: AbiVersion = .@"1"; |
| 15 | }; |
| 16 | |
| 10 | 17 | const libcxxabi_files = [_][]const u8{ |
| 11 | 18 | "src/abort_message.cpp", |
| 12 | 19 | "src/cxa_aux_runtime.cpp", |
| ... | ... | @@ -120,6 +127,12 @@ pub fn buildLibCXX(comp: *Compilation) !void { |
| 120 | 127 | const cxxabi_include_path = try comp.zig_lib_directory.join(arena, &[_][]const u8{ "libcxxabi", "include" }); |
| 121 | 128 | const cxx_include_path = try comp.zig_lib_directory.join(arena, &[_][]const u8{ "libcxx", "include" }); |
| 122 | 129 | const cxx_src_include_path = try comp.zig_lib_directory.join(arena, &[_][]const u8{ "libcxx", "src" }); |
| 130 | const abi_version_arg = try std.fmt.allocPrint(arena, "-D_LIBCPP_ABI_VERSION={d}", .{ |
| 131 | @enumToInt(comp.libcxx_abi_version), |
| 132 | }); |
| 133 | const abi_namespace_arg = try std.fmt.allocPrint(arena, "-D_LIBCPP_ABI_NAMESPACE=__{d}", .{ |
| 134 | @enumToInt(comp.libcxx_abi_version), |
| 135 | }); |
| 123 | 136 | var c_source_files = try std.ArrayList(Compilation.CSourceFile).initCapacity(arena, libcxx_files.len); |
| 124 | 137 | |
| 125 | 138 | for (libcxx_files) |cxx_src| { |
| ... | ... | @@ -152,6 +165,10 @@ pub fn buildLibCXX(comp: *Compilation) !void { |
| 152 | 165 | try cflags.append("-D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS"); |
| 153 | 166 | try cflags.append("-D_LIBCPP_DISABLE_NEW_DELETE_DEFINITIONS"); |
| 154 | 167 | try cflags.append("-D_LIBCPP_HAS_NO_VENDOR_AVAILABILITY_ANNOTATIONS"); |
| 168 | |
| 169 | try cflags.append(abi_version_arg); |
| 170 | try cflags.append(abi_namespace_arg); |
| 171 | |
| 155 | 172 | try cflags.append("-fvisibility=hidden"); |
| 156 | 173 | try cflags.append("-fvisibility-inlines-hidden"); |
| 157 | 174 | |
| ... | ... | @@ -277,6 +294,12 @@ pub fn buildLibCXXABI(comp: *Compilation) !void { |
| 277 | 294 | const cxxabi_include_path = try comp.zig_lib_directory.join(arena, &[_][]const u8{ "libcxxabi", "include" }); |
| 278 | 295 | const cxx_include_path = try comp.zig_lib_directory.join(arena, &[_][]const u8{ "libcxx", "include" }); |
| 279 | 296 | const cxx_src_include_path = try comp.zig_lib_directory.join(arena, &[_][]const u8{ "libcxx", "src" }); |
| 297 | const abi_version_arg = try std.fmt.allocPrint(arena, "-D_LIBCPP_ABI_VERSION={d}", .{ |
| 298 | @enumToInt(comp.libcxx_abi_version), |
| 299 | }); |
| 300 | const abi_namespace_arg = try std.fmt.allocPrint(arena, "-D_LIBCPP_ABI_NAMESPACE=__{d}", .{ |
| 301 | @enumToInt(comp.libcxx_abi_version), |
| 302 | }); |
| 280 | 303 | var c_source_files = try std.ArrayList(Compilation.CSourceFile).initCapacity(arena, libcxxabi_files.len); |
| 281 | 304 | |
| 282 | 305 | for (libcxxabi_files) |cxxabi_src| { |
| ... | ... | @@ -306,6 +329,10 @@ pub fn buildLibCXXABI(comp: *Compilation) !void { |
| 306 | 329 | try cflags.append("-D_LIBCXXABI_BUILDING_LIBRARY"); |
| 307 | 330 | try cflags.append("-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS"); |
| 308 | 331 | try cflags.append("-D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS"); |
| 332 | |
| 333 | try cflags.append(abi_version_arg); |
| 334 | try cflags.append(abi_namespace_arg); |
| 335 | |
| 309 | 336 | try cflags.append("-fvisibility=hidden"); |
| 310 | 337 | try cflags.append("-fvisibility-inlines-hidden"); |
| 311 | 338 | |