diff options
author | Matt Godbolt <matt@godbolt.org> | 2019-03-21 20:31:42 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-03-21 20:31:42 -0500 |
commit | b87322568ed7f73a8583cdce707f68f07a0995dd (patch) | |
tree | 387ffc9ba2487bea8c6ab9eb7c40d03cd1e74dc6 /lib/compilers/zig.js | |
parent | b8815fbdb20261634919d976310c13e945249250 (diff) | |
parent | a47efe6d65f86024f46be5ef96139bb2f67dca73 (diff) | |
download | compiler-explorer-b87322568ed7f73a8583cdce707f68f07a0995dd.tar.gz compiler-explorer-b87322568ed7f73a8583cdce707f68f07a0995dd.zip |
Merge branch 'master' into llvm
Diffstat (limited to 'lib/compilers/zig.js')
-rw-r--r-- | lib/compilers/zig.js | 29 |
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; |