Using the Slice Compiler
Common Options
Ice provides a Slice compiler for each language mapping. The compilers share a similar command-line syntax:
slice2<name> [options] file...
Regardless of which compiler you use, a number of command-line options are common to the compilers for any language mapping:
-h, --help
Displays a help message.-v, --version
Displays the compiler version.-DNAME
Defines the preprocessor symbolNAME
.-DNAME=DEF
Defines the preprocessor symbolNAME
with the valueDEF
.
Each compiler always predefines the__<compiler name in upper case>__
macro when compiling Slice file. For example, slice2cpp predefines__SLICE2CPP__
.-UNAME
Undefines the preprocessor symbolNAME
.-IDIR
Add the directoryDIR
to the search path for#include
directives.--output-dir
DIR
Place the generated files into directoryDIR
, which must already exist.-d, --debug
Print debug information showing the operation of the Slice parser.
--depend
Print dependency information in Makefile format to standard output by default, or to the file specified by the--depend-file
option.
--depend-xml
Print dependency information in XML format to standard output by default, or to the file specified by the--depend-file
option.
--depend-json
Print dependency information in JSON format to standard output by default, or to the file specified by the--depend-file
option.
--depend-file FILE
Directs dependency information to the specified file. The output format depends on whether--depend
,--depend-xml
, or--depend-json
is specified.--validate
Checks the provided command-line options for correctness, and does not generate any code.
The Slice compilers permit you to compile more than a single source file, so you can compile several Slice definitions at once, for example:
slice2cpp -I. file1.ice file2.ice file3.ice
The Slice Compiler for JavaScript
The Slice-to-JavaScript compiler (slice2js
) offers the following command-line options in addition to the standard options:
--stdout
Print generated code to standard output.--typescript
Generate TypeScript declaration file.--depend-json
Print dependency information in JSON format to standard output by default, or to the file specified by the--depend-file
option. No code is generated when this option is specified. The output consists of the complete list of Slice files that the input Slice files depend on through direct or indirect inclusion.