| author | |
| committer | |
| log | 0e6d2184cacf2dd1fad7508b2f9ae99d78763148 |
| tree | 96431e859e91a817e1f0e8cc990b658a8f8bf957 |
| parent | f589a66062fb99c737ab84dc5106add596cc03d4 |
however .cu files are a superset of c++.2 files changed, 11 insertions(+), 14 deletions(-)
src/Compilation.zig+7-10| ... | @@ -3854,7 +3854,7 @@ pub fn addCCArgs( | ... | @@ -3854,7 +3854,7 @@ pub fn addCCArgs( |
| 3854 | try argv.appendSlice(&[_][]const u8{ "-target", llvm_triple }); | 3854 | try argv.appendSlice(&[_][]const u8{ "-target", llvm_triple }); |
| 3855 | 3855 | ||
| 3856 | switch (ext) { | 3856 | switch (ext) { |
| 3857 | .c, .cpp, .m, .mm, .h, .cuda => { | 3857 | .c, .cpp, .m, .mm, .h, .cu => { |
| 3858 | try argv.appendSlice(&[_][]const u8{ | 3858 | try argv.appendSlice(&[_][]const u8{ |
| 3859 | "-nostdinc", | 3859 | "-nostdinc", |
| 3860 | "-fno-spell-checking", | 3860 | "-fno-spell-checking", |
| ... | @@ -4153,7 +4153,7 @@ fn failCObjWithOwnedErrorMsg( | ... | @@ -4153,7 +4153,7 @@ fn failCObjWithOwnedErrorMsg( |
| 4153 | pub const FileExt = enum { | 4153 | pub const FileExt = enum { |
| 4154 | c, | 4154 | c, |
| 4155 | cpp, | 4155 | cpp, |
| 4156 | cuda, | 4156 | cu, |
| 4157 | h, | 4157 | h, |
| 4158 | m, | 4158 | m, |
| 4159 | mm, | 4159 | mm, |
| ... | @@ -4168,7 +4168,7 @@ pub const FileExt = enum { | ... | @@ -4168,7 +4168,7 @@ pub const FileExt = enum { |
| 4168 | 4168 | ||
| 4169 | pub fn clangSupportsDepFile(ext: FileExt) bool { | 4169 | pub fn clangSupportsDepFile(ext: FileExt) bool { |
| 4170 | return switch (ext) { | 4170 | return switch (ext) { |
| 4171 | .c, .cpp, .h, .m, .mm, .cuda => true, | 4171 | .c, .cpp, .h, .m, .mm, .cu => true, |
| 4172 | 4172 | ||
| 4173 | .ll, | 4173 | .ll, |
| 4174 | .bc, | 4174 | .bc, |
| ... | @@ -4199,11 +4199,8 @@ pub fn hasCppExt(filename: []const u8) bool { | ... | @@ -4199,11 +4199,8 @@ pub fn hasCppExt(filename: []const u8) bool { |
| 4199 | return mem.endsWith(u8, filename, ".C") or | 4199 | return mem.endsWith(u8, filename, ".C") or |
| 4200 | mem.endsWith(u8, filename, ".cc") or | 4200 | mem.endsWith(u8, filename, ".cc") or |
| 4201 | mem.endsWith(u8, filename, ".cpp") or | 4201 | mem.endsWith(u8, filename, ".cpp") or |
| 4202 | mem.endsWith(u8, filename, ".cxx"); | 4202 | mem.endsWith(u8, filename, ".cxx") or |
| 4203 | } | 4203 | mem.endsWith(u8, filename, ".stub"); |
| 4204 | |||
| 4205 | pub fn hasCudaExt(filename: []const u8) bool { | ||
| 4206 | return mem.endsWith(u8, filename, ".cu") or mem.endsWith(u8, filename, ".stub"); | ||
| 4207 | } | 4204 | } |
| 4208 | 4205 | ||
| 4209 | pub fn hasObjCExt(filename: []const u8) bool { | 4206 | pub fn hasObjCExt(filename: []const u8) bool { |
| ... | @@ -4270,8 +4267,8 @@ pub fn classifyFileExt(filename: []const u8) FileExt { | ... | @@ -4270,8 +4267,8 @@ pub fn classifyFileExt(filename: []const u8) FileExt { |
| 4270 | return .static_library; | 4267 | return .static_library; |
| 4271 | } else if (hasObjectExt(filename)) { | 4268 | } else if (hasObjectExt(filename)) { |
| 4272 | return .object; | 4269 | return .object; |
| 4273 | } else if (hasCudaExt(filename)) { | 4270 | } else if (mem.endsWith(u8, filename, ".cu")) { |
| 4274 | return .cuda; | 4271 | return .cu; |
| 4275 | } else { | 4272 | } else { |
| 4276 | return .unknown; | 4273 | return .unknown; |
| 4277 | } | 4274 | } |
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 |
| ... | @@ -1248,7 +1248,7 @@ fn buildOutputType( | ... | @@ -1248,7 +1248,7 @@ fn buildOutputType( |
| 1248 | .object, .static_library, .shared_library => { | 1248 | .object, .static_library, .shared_library => { |
| 1249 | try link_objects.append(.{ .path = arg }); | 1249 | try link_objects.append(.{ .path = arg }); |
| 1250 | }, | 1250 | }, |
| 1251 | .assembly, .c, .cpp, .h, .ll, .bc, .m, .mm, .cuda => { | 1251 | .assembly, .c, .cpp, .h, .ll, .bc, .m, .mm, .cu => { |
| 1252 | try c_source_files.append(.{ | 1252 | try c_source_files.append(.{ |
| 1253 | .src_path = arg, | 1253 | .src_path = arg, |
| 1254 | .extra_flags = try arena.dupe([]const u8, extra_cflags.items), | 1254 | .extra_flags = try arena.dupe([]const u8, extra_cflags.items), |
| ... | @@ -1316,7 +1316,7 @@ fn buildOutputType( | ... | @@ -1316,7 +1316,7 @@ fn buildOutputType( |
| 1316 | .positional => { | 1316 | .positional => { |
| 1317 | const file_ext = Compilation.classifyFileExt(mem.sliceTo(it.only_arg, 0)); | 1317 | const file_ext = Compilation.classifyFileExt(mem.sliceTo(it.only_arg, 0)); |
| 1318 | switch (file_ext) { | 1318 | switch (file_ext) { |
| 1319 | .assembly, .c, .cpp, .ll, .bc, .h, .m, .mm, .cuda => { | 1319 | .assembly, .c, .cpp, .ll, .bc, .h, .m, .mm, .cu => { |
| 1320 | try c_source_files.append(.{ .src_path = it.only_arg }); | 1320 | try c_source_files.append(.{ .src_path = it.only_arg }); |
| 1321 | }, | 1321 | }, |
| 1322 | .unknown, .shared_library, .object, .static_library => { | 1322 | .unknown, .shared_library, .object, .static_library => { |