BuildingWithCMake

Element Green

Building FluidSynth with CMake

Note: the former auto-tools based build system is deprecated.

What is CMake?

CMake is a cross platform build system, that can be used to replace the old auto-tools, providing a nice building environment and advanced features. Some of these features are:

  • Out of sources build: CMake allows you to build your software into a directory different to the source tree. You can safely delete the build directory and all its contents once you are done.
  • Multiple generators: classic makefiles can be generated for Unix and MinGW, but also Visual Studio, XCode and Eclipse CDT projects among other types.
  • Graphic front-ends for configuration and build options.

More information and documentation is available at the CMake project site

CMake is free software. You can get the sources and pre-compiled packages for Linux and other systems.

You need CMake 2.6 or later to build FluidSynth.

Requirements

Some other libraries can be optionally included at build time, providing additional functionality.

Common Tips

Get the FluidSynth sources somewhere.

Execute CMake from the build directory, providing the source directory location and optionally, the build options. There are several ways.

  • From a command line shell:

    $ pwd
    fluidsynth-x.y.z
    $ mkdir build
    $ cd build
    $ cmake ..
    

The last command (cmake ..) can be modified by adding options. Common modifications include e g:

  • -DLIB_SUFFIX= - make sure we don't put anything in /lib64, this is needed on 64 bit Debian/Ubuntu platforms
  • -DCMAKE_INSTALL_PREFIX=/usr - this will overwrite instead of override an existing [FluidSynth] installation
  • -Denable-ladspa=1 - ladspa is disabled by default, this will enable that functionality
  • -DCMAKE_BUILD_TYPE=debug - if you want to help out and find bugs, this will make it easier to debug (but much worse performance)

Valid values for boolean (enable-xxxx) options: 1, 0, yes, no, on, off.

  • There are also several alternative CMake front-ends, if you don't want to use the command line interface:
    • ncurses based program, for Linux and Unix: ccmake
    • GUI, Qt4 based program, multiplatform: cmake-gui
    • GUI, Windows native program: CMakeSetup.exe

Here is a screenshot of cmake-gui configuring FluidSynth for Visual Studio 9 2008. You need to tell the program where is the source code and where you want the build directory. The program will prompt you which generator to run, you fill some options, and press two buttons:

  • Configure: checks the libraries corresponding to your selections. You can press this button several times after changing options (minimum twice), until you get your best configuration results.
  • Generate: once the configuration is successful and you are satisfied, it creates the project files.

configuring FluidSynth with CMake GUI in Windows

Finally, execute the build command. If you generated a project file, use your IDE to build it. If you used the Makefiles generator (the default in Linux and other Unix systems) then execute make, gmake or mingw32-make.

There are many targets available. To see a complete list of them, type:

$ make help

The build process usually hides the compiler command lines, to show them:

$ make VERBOSE=1

There is a "clean" target, but not a "distclean" one. You should use a build directory different to the source tree. In this case, the "distclean" target would be equivalent to simply removing the build directory.

To compile the developer documentation you need Doxygen installed. Use this command from the root build directory:

$ make doxygen

Building on Linux

If your distribution already have a packaged [FluidSynth], sometimes you can grab the build dependencies automatically by running a command such as

sudo apt-get build-dep fluidsynth --no-install-recommends

(This would work under Debian/Ubuntu)

  • Note that after (un)installation (with "sudo make install" or "sudo make uninstall") you might need to run "sudo ldconfig" or you'll end up with a new executable calling the old library!

Building on Windows

Get the requirements from gtk.org, for instance:

Unpack all required ZIPs (see above) to the same directory, a name without spaces, for instance C:\freesw. Add C:\freesw\bin to the system PATH. To verify: Start button -> Command Prompt

C:\> pkg-config --list-all
gio-2.0               GIO - glib I/O library
gmodule-2.0           GModule - Dynamic module loader for GLib
glib-2.0              GLib - C Utility Library
gmodule-no-export-2.0 GModule - Dynamic module loader for GLib
gthread-2.0           GThread - Thread support for GLib
gobject-2.0           GObject - GLib Type, Object, Parameter and Signal Library

Obtain dsound.h and copy it to C:\freesw\include. Either install the Microsoft DirectX SDK or alternatively try Google Code Search to locate a copy of the header file. Some users have mentioned that the header contained in Wine might work.

For instance, this is the layout of the directory with the dependencies installed:

C:\freesw\
├───bin
├───include
│   └───glib-2.0
│       ├───gio
│       ├───glib
│       └───gobject
├───lib
│   └───glib-2.0
│       └───include
├───manifest
├───pkgconfig
├───share
│   ├───aclocal
(...)

CMake 2.8 is available from CMake official site. Let the installer to add CMake to the system path, and create a desktop shortcut icon.

Building with MinGW on Windows

Note: For simplicity you can unzip the dependencies above directly into your MinGW installation directory.

Get MinGW, for convenience you can use the TDM Bundle installer (use at your own risk).

Run CMake, opening the desktop icon shortcut.

  • Select "MinGW Makefiles".
  • Select the directory containing FluidSynth sources, and another directory for building (e.g. ./build).

Start mingw32-make on the command line to build the project:

>cd
fluidsynth-x.y.z
>cd build
>mingw32-make.exe

Building with VisualStudio on Windows

You can get Visual Studio Express 2010, from Microsoft. Note: the ISO image (VS2010Express1.iso) contains all VS2010 products, but only MS Visual C is needed. You don't need special options, just the defaults. DirectX SDK is already included in this product.

Run CMake, opening the desktop icon shortcut.

  • Select "Visual Studio 10".
  • Select the directory containing FluidSynth sources, and another directory for building.

This is the report for the first Configure run

Check for working C compiler using: Visual Studio 10
Check for working C compiler using: Visual Studio 10 -- works
Detecting C compiler ABI info
Detecting C compiler ABI info - done
Checking whether system has ANSI C header files
Looking for include files StandardHeadersExist
Looking for include files StandardHeadersExist - not found.
ANSI C header files - not found
Looking for include files HAVE_UNISTD_H
Looking for include files HAVE_UNISTD_H - not found.
Looking for DIR in sys/stat.h;sys/types.h;dirent.h
Looking for DIR in sys/stat.h;sys/types.h;dirent.h - not found.
Looking for string.h
Looking for string.h - found
Looking for stdlib.h
Looking for stdlib.h - found
Looking for stdio.h
Looking for stdio.h - found
Looking for math.h
Looking for math.h - found
Looking for errno.h
Looking for errno.h - found
Looking for stdarg.h
Looking for stdarg.h - found
Looking for memory.h
Looking for memory.h - found
Looking for sys/mman.h
Looking for sys/mman.h - not found
Looking for sys/types.h
Looking for sys/types.h - found
Looking for sys/time.h
Looking for sys/time.h - not found
Looking for sys/stat.h
Looking for sys/stat.h - found
Looking for sys/ioctl.h
Looking for sys/ioctl.h - not found
Looking for fcntl.h
Looking for fcntl.h - found
Looking for sys/socket.h
Looking for sys/socket.h - not found
Looking for netinet/in.h
Looking for netinet/in.h - not found
Looking for netinet/tcp.h
Looking for netinet/tcp.h - not found
Looking for arpa/inet.h
Looking for arpa/inet.h - not found
Looking for limits.h
Looking for limits.h - found
Looking for pthread.h
Looking for pthread.h - not found
Looking for signal.h
Looking for signal.h - found
Performing Test _have_inline
Performing Test _have_inline - Failed
Performing Test _have___inline__
Performing Test _have___inline__ - Failed
Performing Test _have___inline
Performing Test _have___inline - Success
Performing Test _have_vla
Performing Test _have_vla - Failed
Check if the system is big endian
Searching 16 bit integer
Looking for stdint.h
Looking for stdint.h - found
Looking for stddef.h
Looking for stddef.h - found
Check size of unsigned short
Check size of unsigned short - done
Using unsigned short
Check if the system is big endian - little endian
Looking for windows.h
Looking for windows.h - found
Looking for io.h
Looking for io.h - found
Looking for dsound.h
Looking for dsound.h - found
Looking for include files HAVE_MMSYSTEM_H
Looking for include files HAVE_MMSYSTEM_H - found
checking for modules 'glib-2.0>=2.6.5;gthread-2.0>=2.6.5'
  found glib-2.0, version 2.24.0
  found gthread-2.0, version 2.24.0
checking for module 'sndfile>=1.0.0'
  package 'sndfile>=1.0.0' not found
checking for module 'libpulse-simple>=0.9.8'
  package 'libpulse-simple>=0.9.8' not found
checking for module 'alsa>=0.9.1'
  package 'alsa>=0.9.1' not found
checking for module 'portaudio-2.0>=19'
  package 'portaudio-2.0>=19' not found
checking for module 'jack'
  package 'jack' not found
Could NOT find READLINE  (missing:  READLINE_INCLUDE_DIR READLINE_LIBRARIES)
checking for module 'lash-1.0>=0.3'
  package 'lash-1.0>=0.3' not found
checking for module 'dbus-1>=1.0.0'
  package 'dbus-1>=1.0.0' not found
Could NOT find Doxygen  (missing:  DOXYGEN_EXECUTABLE)

**************************************************************
Summary:
libsndfile:            no (raw audio file rendering only)
D-Bus:                 no
PulseAudio:            no
JACK:                  no
ALSA:                  no
PortAudio:             no
OSS:                   no
MidiShare:             no
CoreAudio:             no
CoreMIDI:              no
Windows:               yes
LADSPA support:        no
LASH support:          no
LADCCA support:        no
OS/2 DART support:     no
Audio to file driver:  yes
Readline:              no
Samples type=float:    no (using double)
Profiling:             no
Debug:                 no
Trap on FPE (debug):   no
Check FPE (debug):     no
**************************************************************

Configuring done

Press the "Configure" button again, and then "Generate".

Go to the build directory, and double click the file FluidSynth.sln, and build the solution.

Building on OS X

Get all requirements with Homebrew:

brew install fluidsynth pkg-config

Install XCode, "DevSDK.pkg" and "CoreAudioSDK.pkg" packages from your Leopard/Snow Leopard Install DVD.

Run CMake from your Applications:

  • Select "Unix Makefiles".
  • Select the directory containing FluidSynth sources, and another directory for building (e.g. ./build).

Start make on the command line to build the project:

>cd
fluidsynth-x.y.z
>cd build
>make.exe

Related

Wiki: BuildingFluidSynth
Wiki: Documentation
Wiki: Download
Wiki: FluidSynth

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks