Skip to content

Compile

Stéphane Letz edited this page Sep 2, 2024 · 1 revision

Compiling using make or cmake

Once your project has been generated (see Building steps), the default is to compile all the targets that are included in the project. Thus, typing make will build the faust compiler, the OSC static library and the HTTP static library when these 3 components are included in your project.

Single targets always supported

Single targets are available use make or cmake. These targets are:

  • faust: to build the faust compiler
  • osc: to build the OSC library
  • http: to build the HTTP library

Single targets that require a project configuration

  • staticlib: to build libfaust library in static mode. Requires to call make configstatic first.
  • dynamiclib: to build libfaust library in dynamic mode. Requires to call make configdynamic first.
  • oscdynamic: to build OSC library in dynamic mode. Requires to call make configoscdynamic first.
  • httpdynamic: to build HTTP library in dynamic mode. Requires to call make confighttpdynamic first.

Targets excluded from all

  • wasmlib: to build libfaust as a Web Assembly library.

These targets require the emcc compiler to be available from your path.

Platform specific targets

  • ioslib: to build libfaust library in static mode for iOS.

Getting help with make

$ make help

Invoking targets from cmake

The general form to invoke a target using cmake commands is the following:

$ cmake --build <project dir> [--target target] [-- native project options]

The default cmake target is all. For example the following command builds all the targets included in your project:

$ cmake --build faustdir

Cmake takes care of the generator you used and thus, provides an universal way to build your project from the command line whether it's Makefile based or IDE based (e.g. Xcode or Visual Studio)

The following sequence creates and build a project using Visual Studio on Windows in release mode :

$ cd your_build_folder
$ cmake -C ../backends/backends.cmake .. -G "Visual Studio 14 2015 Win64"
$ cmake --build . --config Release

For more details and options, you should refer to the cmake documentation.

The install and uninstall targets

Your project will always include an install target, which always installs all the components included in the project.

There is no uninstall target at cmake level (not supported by cmake). It is provided by the Makefile only and is based on the install_manifest.txt file that is generated by the install target in faustdir.

Note that cmake ensures that all the targets of your project are up-to-date before installing and thus may compile some or all of the targets. It can be annoying if you invoke sudo make install: the object files will then be property of the superuser and you can then have errors during later compilation due to write rights issues on object files. Thus it is recommended to make sure that all your targets are up-to-date by running make before running sudo make install.

Troubleshooting

If you get error when building, you may have to cleanup all intermediate files generated by cmake. In the build folder, you can use git clean -fdx to cleanup all non-git files. Then go back in the root folder to restart compilation.

Clone this wiki locally