rleh / scons-build-tools

Collection of SCons based build tools. Please open issues in the modm repo.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

SCons Tool Collection

The SCons tools are grouped by prefixing the tool name.

Note: The group prefixes should ideally be folders. Unfortunately this is not supported by SCons for all target platforms.

Group 'compiler'

Compiler named compiler_hosted_* compile for the host operating system, all others are cross-compiler. The cross-compilers follow the GCC naming schema:

arch_(vendor_)(os_)(abi_)gcc

Available tools:

  • compiler_hosted_gcc
  • compiler_hosted_gcc_coverage
  • compiler_hosted_llvm
  • compiler_hosted_llvm_sanitizer
  • compiler_arm_none_eabi_gcc
  • compiler_sparc_rtems_gcc
  • compiler_or1k_aac_rtems_gcc
  • compiler_or32_aac_elf_gcc

Build flags

The standard Unix build flags like CCFLAGS are split into several environment variables. With this the cross compiler can set several options while allowing the user to change other parts.

The following environment variables are available:

Options for C and C++ (CCFLAGS):

  • CCFLAGS_target
  • CCFLAGS_optimize
  • CCFLAGS_debug
  • CCFLAGS_warning
  • CCFLAGS_other

Options for C++ (CXXFLAGS)

  • CXXFLAGS_language
  • CXXFLAGS_dialect
  • CXXFLAGS_warning
  • CXXFLAGS_other

Options for C (CFLAGS)

  • CFLAGS_language
  • CFLAGS_dialect
  • CFLAGS_warning
  • CFLAGS_other

Options for the linker (LINKFLAGS)

  • LINKFLAGS_target
  • LINKFLAGS_other

Typically *_target, *_dialect and *_warning are set by the cross compilers, while the others variables can be freely changed by the user. It is also possible to overwrite the definitions from the cross-compiler by explicitly specifying the value.

Example:

env = Environment(toolpath=[...],
                  tools=['compiler_hosted_gcc'],
                  CXXFLAGS_language=['-std=c++11', '-pedantic'])
...
or
...
env['CXXFLAGS_language'] = ['-std=c++11', '-pedantic']

Group 'settings'

The setting tools configure the environment.

Available tools:

  • setttings_buildpath
  • setttings_gcc_default_internal
  • setttings_gcc_optionsfile

The setttings_gcc_default_internal tool is not intended to be used by the user but is loaded by the GCC based compilers to define a common set of options.

If the setttings_gcc_optionsfile tool is loaded the GCC command line options are passed in a temporary file to avoid problems with over-long command line arguments (especially under Windows).

With setttings_buildpath it is possible to perform out-of-source builds. The tool must be loaded after the compiler because it alters the emitters for object files and libraries. The build folder can be specified by setting the BUILDPATH and BASEPATH environment variables.

Group 'utils'

Tools in this folder add helper functions for writing SConstruct files.

Available tools:

  • utils_common
  • utils_buildformat
  • utils_buildsize
  • utils_gcc_version

The utils_buildformat tool defines COMSTR* variables for the standard tools generating a cleaner command line output. The actual command line options can be show by using scons verbose=1.

utils_buildsize is useful for embedded devices. It shows an overview of the used Flash (ROM) and RAM areas. The user need to specify sizes for Flash and RAM.

Example:

env = Environment(toolpath=[...],
                  tools=['compiler_sparc_rtems_gcc', 'utils_buildsize'],
                  DEVICE_SIZE={
                      'name' : 'Nexys 3',
                      'flash': 16777216,
                      'ram'  : 16777216
                  },)
...

With the utils_gcc_version tool it is possible to detect the used GCC version. Has to be loaded after the compiler. It is loaded by default from all GCC based compilers.

Group 'tools'

Tools from the 'tools' folder generate additional files.

Available tools:

License

The SCons tools are licensed under the Mozilla Public License v2.0 unless otherwise noted.

About

Collection of SCons based build tools. Please open issues in the modm repo.

License:Mozilla Public License 2.0


Languages

Language:Python 100.0%