S2scompile: Difference between revisions

From STRIDE Wiki
Jump to navigation Jump to search
Line 146: Line 146:
</pre>
</pre>


Where $(STRIDE_DIR) is the location where the STRIDE packages are installed following [[Installation#Installed_Directories_and_Files|recomended directory layout]].
Where $(STRIDE_DIR) is the location where the STRIDE packages are installed following [[Framework_Installation#Directories_and_Files|recomended directory layout]].


When <i>microsoft</i> 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 <tt>#include <file></tt>.
When <i>microsoft</i> 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 <tt>#include <file></tt>.

Revision as of 17:39, 18 February 2010

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)][=def]

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

Define macro <name> as def. if "=def" is omitted, define <name> as 1.
--accept_zero_length_array Accept zero length arrays declared in structs
--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.
--documentation Extract source documentation using doxygen. The tool will search for implementation files (c/cpp) corresponding to header files with the same basename in the same directory.
--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=<align> Default is "char".
--targ_wchar_t_int_kind=<align> Default is "unsigned short".
--targ_size_t_int_kind=<align> Default is "unsigned int".
--targ_ptrdiff_t_int_kind=<align> 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 "#" 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.

Search Path

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

$(STRIDE_DIR)/SDK/Runtime
$(STRIDE_DIR)/SDK/GRS

Where $(STRIDE_DIR) is the location where the STRIDE packages are installed following recomended 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 gcc mode is specified and $(C_INCLUDE_PATH) (or $(CPLUS_INCLUDE_PATH) in C++) enviroment variable is defined (as a ":" separated path list) then all of its entries are looked in for headers requested with #include <file>. In addition if GNU cpp (GCC preprocessor) is accessible then 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.

s2compile 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.

Examples of target settings of several popular CPUs are shown in Sample Stride Target Settings.

Notes

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