Version 2 (modified by shy, 15 years ago) (diff)


Building sv8 tools

This page shows how to build libmpc using cmake with the command line. The examples are from a Linux system, but cmake can be used on Windows to generate msvc project files. You may feel more comfortable using the cmake GUI.

Getting the sources

First, you need the sources. You can browse musepack svn for a complete view.
libmpc needs libcuefile for reading .cue files to import chapters information. This is the same libcuefile as in cuetools, but we made it a standalone library for our use.
Also libreplaygain is needed to build the mpcgain application.
So, here we go :

$ mkdir musepack
$ cd musepack
$ svn export libmpc
$ svn export libcuefile
$ svn export libreplaygain

You now got the sources



Move to the libcuefile directory :

$ cd libcuefile

Generate makefiles :

$ cmake -G "Unix Makefiles"

If you want to build other project files (ex : msvc), check the available generators on your system using the cmake help command (at the end of the output) :

$ cmake --help
cmake version 2.6-patch 2


The following generators are available on this platform:
  Unix Makefiles              = Generates standard UNIX makefiles.
  CodeBlocks - Unix Makefiles = Generates CodeBlocks project files.
  Eclipse CDT4 - Unix Makefiles
                              = Generates Eclipse CDT 4.0 project files.
  KDevelop3                   = Generates KDevelop 3 project files.
  KDevelop3 - Unix Makefiles  = Generates KDevelop 3 project files.

Now we are ready to build :

$ make


There may be a make install command, but the current CMakeLists.txt doesn't properly install the lib (the include dir is not installed). Contributions welcome !



Compiling libreplaygain is as easy as libcuefile :

$ cd ../libreplaygain
$ cmake -G "Unix Makefiles"
$ make


I fear make install doesn't install the include file.



Cmake needs to know where to find the two libs above and their includes. It will probably guess correctly for most of them, but the following values need to be known : CUEFILE_INCLUDE_DIR, CUEFILE_LIBRARY, REPLAY_GAIN_INCLUDE_DIR and REPLAY_GAIN_LIBRARY.
You can check this :

$ cd ../libmpc
$ cmake -L
-- The C compiler identification is GNU
-- Check for working C compiler: /usr/bin/gcc
-- Check for working C compiler: /usr/bin/gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check if the system is big endian
-- Searching 16 bit integer
-- Looking for sys/types.h
-- Looking for sys/types.h - found
-- 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
CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
    linked by target "mpcgain" in directory /your/path/musepack/libmpc/mpcgain

-- Configuring incomplete, errors occurred!
-- Cache values

As you can see, REPLAY_GAIN_LIBRARY:FILEPATH was not found on my system. So we tell it where to find it :

$ cmake -DREPLAY_GAIN_LIBRARY:FILEPATH=/your/path/musepack/libreplaygain/src/

And we are now ready to build :

$ make

All the built executables are found in their respective directories. Note that libmpcdec is not built as a shared library here. Use the autotools build system to build it as a shared library, or provide a patch to build it as static on the Windows platform and shared on other platforms.


Guess what ?