Craftr Standard Library

General Properties

Compiler implementations should consider the 'debug' option when handling the build parameters. More specifically, given a target uses a TargetBuilder, it is usually good practice to read the debug option like this:

debug = builder.get('debug', options.get_bool('debug'))

Platform Interface

All platform.xxx modules implement this interface.

platform.name

A string identifier of the platform. Currently implemented values are

  • 'win'
  • 'cygwin'
  • 'linux''
  • 'darwin'
platform.standard

A string identifier of the platform standard. Currently implemented values are

  • 'nt'
  • 'posix'
platform.obj(x)

Given a filename or list of filenames, replaces all suffixes with the appropriate suffix for compiled object files for the platform.

platform.bin(x)

Given a filename or list of filenames, replaces all suffixes with the appropriate suffix for binary executable files for the platform.

platform.dll(x)

Given a filename or list of filenames, replaces all suffixes with the appropriate suffix for shared library files for the platform.

platform.lib(x)

Given a filename or list of filenames, replaces all suffixes with the appropriate suffix for static library files for the platform.

platform.get_tool(name)

Given the name of a tool, returns an object that implements the respective tools interface. The returned object may already consider environment variables like CC and CXX. Possible values for name are

Name Description
'c' C Compiler (see C/C++ Compiler Interface)
'c++' C++ Compiler (see C/C++ Compiler Interface)
'asm' ASM Compiler (see C/C++ Compiler Interface)
'ld' Linker (usually the same as C compiler on Linux/Mac OS) (see Linker Interface)
'ar' Static libary generator (archiver) (see Archiver Interface)

C/C++ Compiler Interface

compiler.compile(sources, frameworks=(), target_name=None, **kwargs)
Target.meta output variables:
None  

Known Implementations

Linker Interface

Target.meta output variables:
'link_output' 'link_target' Absolute output filename Linker target filename (1)

(1) This is required because on Windows you can not passed the actuall DLL filename to the linker but you must pass to it the also generated .lib file which is what this 'link_target' value is pointing to. Other implementations like GCC/LLVM just fill in the same filename as in 'link_output'

Known Implementations

Archiver Interface

archiver.staticlib(output, inputs, target_name=None, **kwargs)
Target.meta output variables:
'staticlib_output' Absolute output filename

Known Implementations