-
Notifications
You must be signed in to change notification settings - Fork 322
Backends
The faust compiler can produce various languages on output. Support for these languages is provided using backends
that may or may not be embedded into the compiler or into the faust libraries. This is intended to simplify the compilation process: some backends (like LLVM) proved to be a bit complex to compile, some others are not supported by all compilers (like the interpreter backend). In addition, selecting only the set of backends to be used, can reduce significantly the size of the resulting binary.
The backends selection is described using backends files
which are actually cmake files that simply populate the cmake cache. These files are located in the backends
folder. They consist in a matrix where each line corresponds to a language support and where the columns select (or discard) the corresponding backend for each binary output i.e.:
- the faust compiler,
- the libfaust static library,
- the libfaust dynamic library,
- the libfaust wasm library
For example, the following selects the cpp backend for the compiler and the faust static and dynamic libraries and discards the interpreter backend.
set ( CPP_BACKEND COMPILER STATIC DYNAMIC CACHE STRING "Include CPP backend" FORCE )
set ( INTERP_BACKEND OFF CACHE STRING "Include INTERPRETER backend" FORCE )
A BACKENDS
option is provided to select a backend file using make
e.g.:
$ make BACKENDS=backends.cmake
By default the selected backends are taken from backends.cmake
Note that make always looks for the backend files in the backends
folder.
You can get similar results using direct cmake invocation:
$ cd faustdir
$ cmake -C ../backends/backends.cmake ..
The -C file
option instructs cmake to populate the cache using the file given as argument.
Note that once the backends have been selected, they won't change unless you specify another backend file.
On output of the project generation, cmake prints a list of all the backends that will be compiled for each component. Below you have an example of this output:
-- In target faust: include C backend
-- In target faust: include CPP backend
-- In target faust: include OCPP backend
-- In target faust: include WASM backend
-- In target staticlib: include C backend
-- In target staticlib: include CPP backend
-- In target staticlib: include OCPP backend
-- In target staticlib: include WASM backend
-- In target staticlib: include LLVM backend
-- In target wasmlib: include WASM backend
Note also that the command faust -v
prints the list of embedded backends only e.g.:
FAUST Version 2.57.7
Embedded backends:
DSP to C
DSP to C++
DSP to Cmajor
DSP to CSharp
DSP to DLang
DSP to Java
DSP to JAX
DSP to Julia
DSP to old C++
DSP to Rust
DSP to WebAssembly (wast/wasm)
Copyright (C) 2002-2023, GRAME - Centre National de Creation Musicale. All rights reserved.
-
make cmake BACKENDS=interp.cmake TARGETS=interp.cmake
allows to build the libfaust library only with the Interp backend only