From 941b834f3ba15eba9bfa80eb370077ec9c845efd Mon Sep 17 00:00:00 2001 From: Tim Foley Date: Tue, 25 Jul 2017 16:21:23 -0700 Subject: Add a `-o` option to command-line `slangc` Fixes #11 - This adds a `-o` command-line option for specifying an output file. - The code tries to be a bit smart, to glean an output format from a file extension, and also to associate multiple `-o` options with multiple `-entry` options if needed. - There is a restriction that all the output files need to agree on the code generation target. This is reasonable for now, but might be something to lift eventualy - There is a restriction that only one output file is allowed per entry point - Together with the previous item this means you can't output both a `.spv` and a `.spv.asm` in one pass, even though both should be possible - There is currently a restriction that output paths only apply to entry points - This means there is no way to output reflection JSON to a file with `-o` (but that is mostly just a debugging feature for now) - This also means we don't support any "container" formats that can encapsulate multiple compiled entry points --- source/slang/diagnostic-defs.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'source/slang/diagnostic-defs.h') diff --git a/source/slang/diagnostic-defs.h b/source/slang/diagnostic-defs.h index 32385bd24..f0033b65b 100644 --- a/source/slang/diagnostic-defs.h +++ b/source/slang/diagnostic-defs.h @@ -49,6 +49,18 @@ DIAGNOSTIC( 2, Error, unsupportedCompilerMode, "unsupported compiler mode.") DIAGNOSTIC( 4, Error, cannotWriteOutputFile, "cannot write output file '$0'.") DIAGNOSTIC( 5, Error, failedToLoadDynamicLibrary, "failed to load dynamic library '$0'") +DIAGNOSTIC( 6, Error, tooManyOutputPathsSpecified, + "$0 output paths specified, but only $1 entry points given") + +DIAGNOSTIC( 6, Error, noOutputPathSpecifiedForEntryPoint, + "no output path specified for entry point '$0' (the '-o' option for an entry point must precede the corresponding '-entry')") + +DIAGNOSTIC( 6, Error, outputPathsImplyDifferentFormats, + "the output paths '$0' and '$1' require different code-generation targets") + +DIAGNOSTIC( 6, Error, cannotDeduceOutputFormatFromPath, + "cannot deduce an output format from the output path '$0'") + // // 1xxxx - Lexical anaylsis // -- cgit v1.2.3