Skip to content

About the buildsystem

Tom M edited this page Jan 5, 2017 · 4 revisions

This page describes the way I planned to set up the cmake build system. (Primarily as a reminder for myself, since being unexperienced in handling bigger projects with cmake. Improvement proposals welcome.)

General Structure

ANMP provides several features, that support additional audio formats or playback methods. The Features depend on one or more 3rd party libraries. A Feature is usually named after the main library or program that provides this feature.

Listed below are the cmake variables used throughout the project to handle finding and compiling against those 3rd party libraries. They are grouped by 3 stages that decide whether all dependencies of a feature were met so that it can be used ultimately.

So let <FEATURE> be the name of the functionality provided by ANMP, e.g. ALSA, JACK, PORTAUDIO, VGMSTREAM, LAZYUSF, CUE, GME, etc.

And let <LIBNAME> be the name of some library a certain feature depends on, e.g. ALSA, JACK, PORTAUDIO, VGMSTREAM, LIBSAMPLERATE, LIBCUE, LAZYUSF, LIBGME, etc.

  1. User options, deciding on the functionality being built
  • ENABLE_<FEATURE> : whether the user wants to turn off or turn on using a functionality provided by the given library or program (defaults to TRUE)
  1. Locating dependent libraries necessary to support <FEATURE> (only set by user if not found automatically)
  • <LIBNAME>_LIBRARIES : path(s) to libraries for itself and all its depending libraries
  • <LIBNAME>_INCLUDE_DIRS : path(s) to directories where to find include files for
  • <LIBNAME>_DEFINITIONS : preprocessor definitions and compiler flags needed by
  • <LIBNAME>_FOUND : set to true if 's include dirs and libraries were found
  1. Have we found all libraries at that point so we can support <FEATURE>?
  • USE_<FEATURE> : set to true if all libraries depending on a functionality were found

Example1: Want to use Jack for audio playback?

  • Feature for that is called JACK (because it's the name of the main program to support that functionality)
  • To be able to use JACK we need a few libraries:

Of course jack itself depends on a few libraries, but here we dont care since they will be managed by the pkgconfig script shipped with jack.

Example2: Want to be able to play USF files?

  • Feature for that is called LAZYUSF (because it's the name of the main library to support that format)
  • Feature LAZYUSF depends on several libraries:
    • pthreads,
    • libm (i.e. standard C math lib),
    • psflib (lib for reading psf-like files), and
    • lazyusf itself

As of Nov. 2016, lazyusf doesnt provide pkgconfig script, so we have to handle its depending libraries (i.e. pthreads and libm) on our own.