| author | |
| committer | |
| log | 021c1190af90514aa776ed64515cdaf3cd53b319 |
| tree | 7d732f28eca0cbe0f2a97497385993dc75e3b1d7 |
| parent | 45cd1114f76b80bae1513f10d29b8d09261ae632 |
however .cu files are a superset of c++.2 files changed, 11 insertions(+), 14 deletions(-)
src/Compilation.zig+7-10| ... | @@ -3448,7 +3448,7 @@ pub fn addCCArgs( | ... | @@ -3448,7 +3448,7 @@ pub fn addCCArgs( |
| 3448 | try argv.appendSlice(&[_][]const u8{ "-target", llvm_triple }); | 3448 | try argv.appendSlice(&[_][]const u8{ "-target", llvm_triple }); |
| 3449 | 3449 | ||
| 3450 | switch (ext) { | 3450 | switch (ext) { |
| 3451 | .c, .cpp, .m, .mm, .h, .cuda => { | 3451 | .c, .cpp, .m, .mm, .h, .cu => { |
| 3452 | try argv.appendSlice(&[_][]const u8{ | 3452 | try argv.appendSlice(&[_][]const u8{ |
| 3453 | "-nostdinc", | 3453 | "-nostdinc", |
| 3454 | "-fno-spell-checking", | 3454 | "-fno-spell-checking", |
| ... | @@ -3747,7 +3747,7 @@ fn failCObjWithOwnedErrorMsg( | ... | @@ -3747,7 +3747,7 @@ fn failCObjWithOwnedErrorMsg( |
| 3747 | pub const FileExt = enum { | 3747 | pub const FileExt = enum { |
| 3748 | c, | 3748 | c, |
| 3749 | cpp, | 3749 | cpp, |
| 3750 | cuda, | 3750 | cu, |
| 3751 | h, | 3751 | h, |
| 3752 | m, | 3752 | m, |
| 3753 | mm, | 3753 | mm, |
| ... | @@ -3762,7 +3762,7 @@ pub const FileExt = enum { | ... | @@ -3762,7 +3762,7 @@ pub const FileExt = enum { |
| 3762 | 3762 | ||
| 3763 | pub fn clangSupportsDepFile(ext: FileExt) bool { | 3763 | pub fn clangSupportsDepFile(ext: FileExt) bool { |
| 3764 | return switch (ext) { | 3764 | return switch (ext) { |
| 3765 | .c, .cpp, .h, .m, .mm, .cuda => true, | 3765 | .c, .cpp, .h, .m, .mm, .cu => true, |
| 3766 | 3766 | ||
| 3767 | .ll, | 3767 | .ll, |
| 3768 | .bc, | 3768 | .bc, |
| ... | @@ -3793,11 +3793,8 @@ pub fn hasCppExt(filename: []const u8) bool { | ... | @@ -3793,11 +3793,8 @@ pub fn hasCppExt(filename: []const u8) bool { |
| 3793 | return mem.endsWith(u8, filename, ".C") or | 3793 | return mem.endsWith(u8, filename, ".C") or |
| 3794 | mem.endsWith(u8, filename, ".cc") or | 3794 | mem.endsWith(u8, filename, ".cc") or |
| 3795 | mem.endsWith(u8, filename, ".cpp") or | 3795 | mem.endsWith(u8, filename, ".cpp") or |
| 3796 | mem.endsWith(u8, filename, ".cxx"); | 3796 | mem.endsWith(u8, filename, ".cxx") or |
| 3797 | } | 3797 | mem.endsWith(u8, filename, ".stub"); |
| 3798 | |||
| 3799 | pub fn hasCudaExt(filename: []const u8) bool { | ||
| 3800 | return mem.endsWith(u8, filename, ".cu") or mem.endsWith(u8, filename, ".stub"); | ||
| 3801 | } | 3798 | } |
| 3802 | 3799 | ||
| 3803 | pub fn hasObjCExt(filename: []const u8) bool { | 3800 | pub fn hasObjCExt(filename: []const u8) bool { |
| ... | @@ -3864,8 +3861,8 @@ pub fn classifyFileExt(filename: []const u8) FileExt { | ... | @@ -3864,8 +3861,8 @@ pub fn classifyFileExt(filename: []const u8) FileExt { |
| 3864 | return .static_library; | 3861 | return .static_library; |
| 3865 | } else if (hasObjectExt(filename)) { | 3862 | } else if (hasObjectExt(filename)) { |
| 3866 | return .object; | 3863 | return .object; |
| 3867 | } else if (hasCudaExt(filename)) { | 3864 | } else if (mem.endsWith(u8, filename, ".cu")) { |
| 3868 | return .cuda; | 3865 | return .cu; |
| 3869 | } else { | 3866 | } else { |
| 3870 | return .unknown; | 3867 | return .unknown; |
| 3871 | } | 3868 | } |
src/main.zig+4-4| ... | @@ -294,11 +294,11 @@ const usage_build_generic = | ... | @@ -294,11 +294,11 @@ const usage_build_generic = |
| 294 | \\ .s Target-specific assembly source code | 294 | \\ .s Target-specific assembly source code |
| 295 | \\ .S Assembly with C preprocessor (requires LLVM extensions) | 295 | \\ .S Assembly with C preprocessor (requires LLVM extensions) |
| 296 | \\ .c C source code (requires LLVM extensions) | 296 | \\ .c C source code (requires LLVM extensions) |
| 297 | \\ .cxx .cc .C .cpp C++ source code (requires LLVM extensions) | 297 | \\ .cxx .cc .C .cpp .stub C++ source code (requires LLVM extensions) |
| 298 | \\ .m Objective-C source code (requires LLVM extensions) | 298 | \\ .m Objective-C source code (requires LLVM extensions) |
| 299 | \\ .mm Objective-C++ source code (requires LLVM extensions) | 299 | \\ .mm Objective-C++ source code (requires LLVM extensions) |
| 300 | \\ .bc LLVM IR Module (requires LLVM extensions) | 300 | \\ .bc LLVM IR Module (requires LLVM extensions) |
| 301 | \\ .cu .stub Cuda source code (requires LLVM extensions) | 301 | \\ .cu Cuda source code (requires LLVM extensions) |
| 302 | \\ | 302 | \\ |
| 303 | \\General Options: | 303 | \\General Options: |
| 304 | \\ -h, --help Print this help and exit | 304 | \\ -h, --help Print this help and exit |
| ... | @@ -1240,7 +1240,7 @@ fn buildOutputType( | ... | @@ -1240,7 +1240,7 @@ fn buildOutputType( |
| 1240 | .object, .static_library, .shared_library => { | 1240 | .object, .static_library, .shared_library => { |
| 1241 | try link_objects.append(.{ .path = arg }); | 1241 | try link_objects.append(.{ .path = arg }); |
| 1242 | }, | 1242 | }, |
| 1243 | .assembly, .c, .cpp, .h, .ll, .bc, .m, .mm, .cuda => { | 1243 | .assembly, .c, .cpp, .h, .ll, .bc, .m, .mm, .cu => { |
| 1244 | try c_source_files.append(.{ | 1244 | try c_source_files.append(.{ |
| 1245 | .src_path = arg, | 1245 | .src_path = arg, |
| 1246 | .extra_flags = try arena.dupe([]const u8, extra_cflags.items), | 1246 | .extra_flags = try arena.dupe([]const u8, extra_cflags.items), |
| ... | @@ -1308,7 +1308,7 @@ fn buildOutputType( | ... | @@ -1308,7 +1308,7 @@ fn buildOutputType( |
| 1308 | .positional => { | 1308 | .positional => { |
| 1309 | const file_ext = Compilation.classifyFileExt(mem.sliceTo(it.only_arg, 0)); | 1309 | const file_ext = Compilation.classifyFileExt(mem.sliceTo(it.only_arg, 0)); |
| 1310 | switch (file_ext) { | 1310 | switch (file_ext) { |
| 1311 | .assembly, .c, .cpp, .ll, .bc, .h, .m, .mm, .cuda => { | 1311 | .assembly, .c, .cpp, .ll, .bc, .h, .m, .mm, .cu => { |
| 1312 | try c_source_files.append(.{ .src_path = it.only_arg }); | 1312 | try c_source_files.append(.{ .src_path = it.only_arg }); |
| 1313 | }, | 1313 | }, |
| 1314 | .unknown, .shared_library, .object, .static_library => { | 1314 | .unknown, .shared_library, .object, .static_library => { |