| ... | @@ -7,6 +7,13 @@ const Compilation = @import("Compilation.zig"); | ... | @@ -7,6 +7,13 @@ const Compilation = @import("Compilation.zig"); |
| 7 | const build_options = @import("build_options"); | 7 | const build_options = @import("build_options"); |
| 8 | const trace = @import("tracy.zig").trace; | 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 | const libcxxabi_files = [_][]const u8{ | 17 | const libcxxabi_files = [_][]const u8{ |
| 11 | "src/abort_message.cpp", | 18 | "src/abort_message.cpp", |
| 12 | "src/cxa_aux_runtime.cpp", | 19 | "src/cxa_aux_runtime.cpp", |
| ... | @@ -120,6 +127,12 @@ pub fn buildLibCXX(comp: *Compilation) !void { | ... | @@ -120,6 +127,12 @@ pub fn buildLibCXX(comp: *Compilation) !void { |
| 120 | const cxxabi_include_path = try comp.zig_lib_directory.join(arena, &[_][]const u8{ "libcxxabi", "include" }); | 127 | const cxxabi_include_path = try comp.zig_lib_directory.join(arena, &[_][]const u8{ "libcxxabi", "include" }); |
| 121 | const cxx_include_path = try comp.zig_lib_directory.join(arena, &[_][]const u8{ "libcxx", "include" }); | 128 | const cxx_include_path = try comp.zig_lib_directory.join(arena, &[_][]const u8{ "libcxx", "include" }); |
| 122 | const cxx_src_include_path = try comp.zig_lib_directory.join(arena, &[_][]const u8{ "libcxx", "src" }); | 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 | var c_source_files = try std.ArrayList(Compilation.CSourceFile).initCapacity(arena, libcxx_files.len); | 136 | var c_source_files = try std.ArrayList(Compilation.CSourceFile).initCapacity(arena, libcxx_files.len); |
| 124 | | 137 | |
| 125 | for (libcxx_files) |cxx_src| { | 138 | for (libcxx_files) |cxx_src| { |
| ... | @@ -152,6 +165,10 @@ pub fn buildLibCXX(comp: *Compilation) !void { | ... | @@ -152,6 +165,10 @@ pub fn buildLibCXX(comp: *Compilation) !void { |
| 152 | try cflags.append("-D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS"); | 165 | try cflags.append("-D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS"); |
| 153 | try cflags.append("-D_LIBCPP_DISABLE_NEW_DELETE_DEFINITIONS"); | 166 | try cflags.append("-D_LIBCPP_DISABLE_NEW_DELETE_DEFINITIONS"); |
| 154 | try cflags.append("-D_LIBCPP_HAS_NO_VENDOR_AVAILABILITY_ANNOTATIONS"); | 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 | try cflags.append("-fvisibility=hidden"); | 172 | try cflags.append("-fvisibility=hidden"); |
| 156 | try cflags.append("-fvisibility-inlines-hidden"); | 173 | try cflags.append("-fvisibility-inlines-hidden"); |
| 157 | | 174 | |
| ... | @@ -277,6 +294,12 @@ pub fn buildLibCXXABI(comp: *Compilation) !void { | ... | @@ -277,6 +294,12 @@ pub fn buildLibCXXABI(comp: *Compilation) !void { |
| 277 | const cxxabi_include_path = try comp.zig_lib_directory.join(arena, &[_][]const u8{ "libcxxabi", "include" }); | 294 | const cxxabi_include_path = try comp.zig_lib_directory.join(arena, &[_][]const u8{ "libcxxabi", "include" }); |
| 278 | const cxx_include_path = try comp.zig_lib_directory.join(arena, &[_][]const u8{ "libcxx", "include" }); | 295 | const cxx_include_path = try comp.zig_lib_directory.join(arena, &[_][]const u8{ "libcxx", "include" }); |
| 279 | const cxx_src_include_path = try comp.zig_lib_directory.join(arena, &[_][]const u8{ "libcxx", "src" }); | 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 | var c_source_files = try std.ArrayList(Compilation.CSourceFile).initCapacity(arena, libcxxabi_files.len); | 303 | var c_source_files = try std.ArrayList(Compilation.CSourceFile).initCapacity(arena, libcxxabi_files.len); |
| 281 | | 304 | |
| 282 | for (libcxxabi_files) |cxxabi_src| { | 305 | for (libcxxabi_files) |cxxabi_src| { |
| ... | @@ -306,6 +329,10 @@ pub fn buildLibCXXABI(comp: *Compilation) !void { | ... | @@ -306,6 +329,10 @@ pub fn buildLibCXXABI(comp: *Compilation) !void { |
| 306 | try cflags.append("-D_LIBCXXABI_BUILDING_LIBRARY"); | 329 | try cflags.append("-D_LIBCXXABI_BUILDING_LIBRARY"); |
| 307 | try cflags.append("-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS"); | 330 | try cflags.append("-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS"); |
| 308 | try cflags.append("-D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS"); | 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 | try cflags.append("-fvisibility=hidden"); | 336 | try cflags.append("-fvisibility=hidden"); |
| 310 | try cflags.append("-fvisibility-inlines-hidden"); | 337 | try cflags.append("-fvisibility-inlines-hidden"); |
| 311 | | 338 | |