aboutsummaryrefslogtreecommitdiff
path: root/lib/compilers/zig.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/compilers/zig.js')
-rw-r--r--lib/compilers/zig.js29
1 files changed, 15 insertions, 14 deletions
diff --git a/lib/compilers/zig.js b/lib/compilers/zig.js
index 52e67c8b0..ff2b6f6e0 100644
--- a/lib/compilers/zig.js
+++ b/lib/compilers/zig.js
@@ -24,7 +24,8 @@
const BaseCompiler = require('../base-compiler'),
_ = require('underscore'),
- path = require('path');
+ path = require('path'),
+ Semver = require('semver');
class ZigCompiler extends BaseCompiler {
constructor(info, env) {
@@ -53,21 +54,17 @@ class ZigCompiler extends BaseCompiler {
}
optionsForFilter(filters, outputFilename, userOptions) {
- let options;
- if (filters.execute) {
- options = [
- 'build-exe',
- '--cache-dir', path.dirname(outputFilename),
- '--output', this.filename(outputFilename),
- '--output-h', '/dev/null'
- ];
+ let options = [filters.execute ? 'build-exe' : 'build-obj'];
+ if (this.compiler.semver === 'trunk' || Semver.gt(this.compiler.semver, '0.3.0')) {
+ const outputDir = path.dirname(outputFilename);
+ options.push('--cache-dir', outputDir,
+ '--output-dir', outputDir,
+ '--name', path.basename(outputFilename, '.s'));
} else {
- options = [
- 'build-obj',
- '--cache-dir', path.dirname(outputFilename),
+ // Older versions use a different command line interface (#1304)
+ options.push('--cache-dir', path.dirname(outputFilename),
'--output', this.filename(outputFilename),
- '--output-h', '/dev/null'
- ];
+ '--output-h', '/dev/null');
}
if (!filters.binary) {
@@ -84,6 +81,10 @@ class ZigCompiler extends BaseCompiler {
const blacklist = /^(((--(cache-dir|name|output|verbose))|(-mllvm)).*)$/;
return _.filter(userOptions, option => !blacklist.test(option));
}
+
+ isCfgCompiler(/*compilerVersion*/) {
+ return true;
+ }
}
module.exports = ZigCompiler;