diff options
author | RabsRincon <ruben@rinconblanco.es> | 2019-03-17 12:38:46 +0100 |
---|---|---|
committer | RabsRincon <ruben@rinconblanco.es> | 2019-03-17 12:38:46 +0100 |
commit | d414896bb4ecff2b1f45c2afc828e58652d1983c (patch) | |
tree | 033e87a6ee89eb0335b18745ff1c6fe6f6ab970b /lib/compilers | |
parent | 5c2072bcac08b5048a301381b362e79f22883a19 (diff) | |
download | compiler-explorer-d414896bb4ecff2b1f45c2afc828e58652d1983c.tar.gz compiler-explorer-d414896bb4ecff2b1f45c2afc828e58652d1983c.zip |
Fix newer Zig versions
- #1304 should be fixed by this commit,
but no way to test it outside beta (Can't test zig locally)
Diffstat (limited to 'lib/compilers')
-rw-r--r-- | lib/compilers/zig.js | 25 |
1 files changed, 11 insertions, 14 deletions
diff --git a/lib/compilers/zig.js b/lib/compilers/zig.js index 396676c77..e00bb0877 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 (Semver.gt(this.compiler.version, '0.3.0')) { + const outputDir = path.dirname(outputFilename); + options.push('--cache-dir', outputDir, + '--output-dir', outputDir, + '--name', this.filename(outputFilename)); } 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) { |