SCons is also a multiplatform build system written in Python, with its configuration files also written in the same language. It also includes support for Microsoft Visual Studio among other features.
SCons parses the SConstruct
files, and by default it does not propagate the environment into the build system. This is to avoid build issues caused by environment differences. This is a complication for Yocto, as it configures the environment with the cross-compilation toolchain settings.
SCons does not define a standard way to support cross-compilation, so every project will implement it differently. For a simple example as the hello world program, we can just initialize the CC
and PATH
variables from the external environment as follows:
import os env = Environment(CC = os.environ['CC'], ENV = {'PATH': os.environ['PATH']}) env.Program("helloworld", "helloworld.c")