S2scompile

From STRIDE Wiki
Jump to navigation Jump to search

The SCL Compiler Utility

The s2scompile executable will compile a set of scl files (C/C++ source files with SCL Pragmas) and produce a .meta file for each (assuming that compilation is successful).[1]

All warnings and errors that occur during the compilation are written to the standard output device. The compilation for a particular file is considered successful if no errors occur. Otherwise it is unsuccessful. Unsuccessful compilations do not yield .meta files.

Options are validated and any incorrect options diagnosed will result in compilation process failure.

Syntax

   s2scompile [options] scl_file1 [scl_fileN]

Options

Option Description
--version Print version information.
--preprocess Do preprocessing only. Write preprocessed text file to the output.
--dependencies Do preprocessing only. Instead of the normal preprocessing output, generate in the preprocessing output file a list of dependency lines suitable for input to the UNIX make program.
--no_line_commands Same as –-preprocess except that line number information is removed from the preprocessed output files.
--c++ Enable compilation of c++.
--c Enable compilation of C (specifically C89). This is the default.
--include_directory=<dir>

--sys_include=<dir>
-I<dir>

Add dir to the end of the list of directories searched for #include.
--no_stdinc Do not search the standard system directories for header files. See Search Path for details.
--define_macro=<name>[(parameter-list)][=value]

-D<name>[(parameter-list)][=value]

Define macro <name> as value. If "=value" is omitted, define <name> as 1.
--undefine_macro=<name>

-U<name>

Remove predefined macro <name>.
--preinclude=<file> Include file at the beginning of compilation.

NOTE: To simplify the integration in existing build environments other standard compiler options (e.g. GCC -include<file>, MSVC /FI@<file>) with similar meaning are also recognized and processed the same way.

--compatibility=<string> Vendor compatibility mode. String can be "microsoft", "generic" or "gnu". Default is "generic". When "Microsoft" is set, the compiler supports a number of extensions to the C or C++ language that are compatible with the Microsoft family of compilers. "gnu" - instructs the compiler to support language extensions compatible with the Gnu family of compilers.
--no_warning Suppress all warnings in the compilation phase.
--macros Resolve macro (preprocessor define) constant value. Pass this flag only if you intend to do script based testing.
--documentation Extract doxygen style source documentation.
--output=<path>

-o<path>

Output file or directory. The default is the current directory.
--targ_big_endian Target uses a big endian by representation. The default is little endian.
--targ_plain_char_is_unsigned Target uses unsigned chars to represent “plain” char. The default is signed.
--targ_adaptive_enum Target has adaptive enums. The default is no adaptive enums.
--targ_pack_alignment=<align> Target struct pack alignment. The default is 16. Possible values are 1, 2, 4, 8 or 16.
--targ_sizeof_char=<size> Target platform size of char. Default is 1. Possible values are 1, 2, 4, 8, or 16.
--targ_alignof_char=<align> Target platform alignment of char. Default is 1. Possible values are 1, 2, 4, 8 or 16.
--targ_sizeof_short=<size> Default is 2.
--targ_alignof_short=<align> Default is 2.
--targ_sizeof_int=<size> Default is 4.
--targ_alignof_int=<align> Default is 4.
--targ_sizeof_long=<size> Default is 4.
--targ_alignof_long=<align> Default is 4.
--targ_sizeof_long_long=<size> Default is 8.
--targ_alignof_long_long=<align> Default is 8.
--targ_sizeof_float=<size> Default is 4.
--targ_alignof_float=<align> Default is 4.
--targ_sizeof_double=<size> Default is 8.
--targ_alignof_double=<align> Default is 8.
--targ_sizeof_long_double=<size> Default is 8
--targ_alignof_long_double=<align> Default is 8.
--targ_bool_int_kind=<typename> Default is "char".
--targ_wchar_t_int_kind=<typename> Default is "unsigned short".
--targ_size_t_int_kind=<typename> Default is "unsigned int".
--targ_ptrdiff_t_int_kind=<typename> Default is "int".
--options_file=<file> A file that contains command line options. The format is the same as the command line with the only addition that it could be split on multiple lines. A line starting with "#" or ";" symbol is ignored.

This option is necessary if the length of the command line string exceeds system limits. Otherwise it is provided only as a convenience.

NOTE: To simplify the integration in existing build environments other standard compiler options (e.g. ARM --via=<file>, GCC @<file>, MSVC @<file>) with similar meaning are also recognized and processed the same way.

Note: The standard Platform SDKs shipped with the Framework contain a set of options files with predefined target settings for several popular CPUs. Please consider using one of them instead of explicitly passing --targ_* options on the command line.

Search Path

s2scompile by default looks in several different places for headers. It looks for headers requested with #include <file> in:

$(STRIDE_DIR)/SDK/Runtime

Where $(STRIDE_DIR) is the location where the STRIDE packages are installed following recommended directory layout.

When microsoft mode is specified and $(INCLUDE) enviroment variable is defined (as a ";" separated path list) then all of its entries are looked in for headers requested with #include <file>.

When gnu mode is specified and $(CPATH) and/or $(C_INCLUDE_PATH) (or $(CPLUS_INCLUDE_PATH) for C++) enviroment variables are defined (as a ":" separated path list) then all of its entries are looked in for headers requested with #include <file>. In addition if $(TARGET_CPP) specifies the target GNU cpp (GCC preprocessor or a command line equivalent) it is queried and any given path by it is looked in.

You can add to this list, before any of the default places, by using the -I<dir> option.

You can prevent s2scompile from searching any of the default directories with the --no_stdinc option. -I options are not ignored as described above when --no_stdinc is in effect.

s2scompile looks for headers requested with #include "file" first in the directory containing the current file, then in the same places it would have looked for a header requested with angle brackets.

Examples

Refer to the Compiling section of the Build Tools Examples.

Notes

  1. .meta files are binary-format intermediate files suitable for input to the s2sbind utility.