This commit is contained in:
David Gonzalez Martin 2024-03-27 23:46:47 -06:00
parent 12fe8d9fd8
commit c1ec772654
6 changed files with 41 additions and 53 deletions

View File

@ -314,17 +314,10 @@ pub fn compileCSourceFile(context: *const Context, arguments: []const []const u8
if (data_structures.last_byte(argument, '.')) |dot_index| { if (data_structures.last_byte(argument, '.')) |dot_index| {
const extension_string = argument[dot_index..]; const extension_string = argument[dot_index..];
const extension: Extension = const extension: Extension =
if (byte_equal(extension_string, ".c")) .c if (byte_equal(extension_string, ".c")) .c else if (byte_equal(extension_string, ".cpp") or byte_equal(extension_string, ".cxx") or byte_equal(extension_string, ".cc")) .cpp else if (byte_equal(extension_string, ".S")) .assembly else if (byte_equal(extension_string, ".o")) .object else if (byte_equal(extension_string, ".a")) .static_library else if (byte_equal(extension_string, ".so") or
else if (byte_equal(extension_string, ".cpp") or byte_equal(extension_string, ".cxx") or byte_equal(extension_string, ".cc")) .cpp
else if (byte_equal(extension_string, ".S")) .assembly
else if (byte_equal(extension_string, ".o")) .object
else if (byte_equal(extension_string, ".a")) .static_library
else if (byte_equal(extension_string, ".so") or
byte_equal(extension_string, ".dll") or byte_equal(extension_string, ".dll") or
byte_equal(extension_string, ".dylib") or byte_equal(extension_string, ".dylib") or
byte_equal(extension_string, ".tbd") byte_equal(extension_string, ".tbd")) .shared_library else {
) .shared_library
else {
try write(.panic, argument); try write(.panic, argument);
try write(.panic, "\n"); try write(.panic, "\n");
@panic("Unable to recognize extension for the file above"); @panic("Unable to recognize extension for the file above");
@ -533,15 +526,13 @@ pub fn compileCSourceFile(context: *const Context, arguments: []const []const u8
try argv.append(context.my_allocator, "-fno-builtin"); try argv.append(context.my_allocator, "-fno-builtin");
} }
if (link_libcpp) { if (link_libcpp) {
// include paths // include paths
} }
const link_libc = c_source_file.extension == .c; const link_libc = c_source_file.extension == .c;
if (link_libc) { if (link_libc) {}
}
const link_libunwind = false; const link_libunwind = false;
if (link_libunwind) { if (link_libunwind) {

View File

@ -80,7 +80,6 @@ pub fn link(context: *const Compilation.Context, options: linker.Options) !void
else => @compileError("OS not supported"), else => @compileError("OS not supported"),
} }
for (options.libraries) |lib| { for (options.libraries) |lib| {
try argv.append(context.my_allocator, try std.mem.concat(context.allocator, u8, &.{ "-l", lib.path })); try argv.append(context.my_allocator, try std.mem.concat(context.allocator, u8, &.{ "-l", lib.path }));
} }

View File

@ -413,9 +413,7 @@ fn runCmakeTests(allocator: Allocator, dir_path: []const u8) !void {
const ninja = try std.ChildProcess.run(.{ const ninja = try std.ChildProcess.run(.{
.allocator = allocator, .allocator = allocator,
// TODO: delete -main_source_file? // TODO: delete -main_source_file?
.argv = &.{ .argv = &.{"ninja"},
"ninja"
},
.max_output_bytes = std.math.maxInt(u64), .max_output_bytes = std.math.maxInt(u64),
}); });
const ninja_result: TestError!bool = switch (ninja.term) { const ninja_result: TestError!bool = switch (ninja.term) {