This code converts mingw's .def.in files to .def files:
|
// We need to invoke `zig clang` to use the preprocessor. |
|
if (!build_options.have_llvm) return error.ZigCompilerNotBuiltWithLLVMExtensions; |
|
const self_exe_path = comp.self_exe_path orelse return error.PreprocessorDisabled; |
|
const args = [_][]const u8{ |
|
self_exe_path, |
|
"clang", |
|
"-x", |
|
"c", |
|
def_file_path, |
|
"-Wp,-w", |
|
"-undef", |
|
"-P", |
|
"-I", |
|
try comp.zig_lib_directory.join(arena, &[_][]const u8{ "libc", "mingw", "def-include" }), |
|
target_def_arg, |
|
"-E", |
|
"-o", |
|
def_final_path, |
|
}; |
|
|
|
if (comp.verbose_cc) { |
|
Compilation.dump_argv(&args); |
|
} |
|
|
|
if (std.process.can_spawn) { |
|
var child = std.ChildProcess.init(&args, arena); |
|
child.stdin_behavior = .Ignore; |
|
child.stdout_behavior = .Pipe; |
|
child.stderr_behavior = .Pipe; |
|
|
|
try child.spawn(); |
Instead of using clang's preprocessor, it should use Aro's.
Related:
cc @Vexu @ehaas