Skip to content

Compiler and libraries

Raphaël Londeix edited this page Jun 2, 2013 · 3 revisions

From a generic point of view, compilers transform source code into executables and libraries, with possibly intermediate files, link stages and dependency on internal/external libraires.

Abstract compiler API

Creating a compiler

The constructor of any specific compiler (we'll see about that soon) support at least the following arguments (see specific compiler documentation for others):

  • defines: Additional definitions (defaults to []).
  • library_directories: Additional library directories (defaults to []).
  • include_directories: Additional include directories (defaults to []).
  • position_independent_code: Should the generated code by relocatable (defaults to False).
  • standard: The standard of the language to use (defaults to None).
  • target_architecture: The target architecture (defaults to platform.ARCHITECTURE).
  • enable_warnings: Enable basic compiler warnings (defaults to True).
  • use_build_type_flags: Check env var BUILD_TYPE and add flags accordingly' (defaults to True, see specific compiler for default flags).
  • hidden_visibility: Hide symbols that are not explicitly exported (defaults to True).
  • stdlib: Change the standard library (defaults to True):
    • True: Use the default standard library.
    • False: Do not use any standard library.
    • <str>: Specify the standard library by its name.
  • static_libstd: Link statically with the standard library (defaults to False).
  • force_architecture: Always specify the target architecture (defaults to True).
  • additional_link_flags: Additional link flags indexed by compiler name (defaults to {}). Note: This one is a last chance hack, ask me for more support :))
  • generate_source_dependencies_for_makefile: Add rules for makefile includes when possible (defaults to True when the project generator is generators.Makefile)
Clone this wiki locally