There are several ways of integrating the AOO library into your own projects.
You can copy the source code into your project, e.g. as a git submodule or subtree, and then simply include it in your CMake project:
project(my_project)
# assuming that `deps` contains the `aoo` source code
add_subdirectory(deps/aoo EXCLUDE_FROM_ALL)
add_executable(my_project main.cpp)
target_link_libraries(my_project PRIVATE Aoo::aoo)If BUILD_SHARED_LIBRARIES or AOO_BUILD_SHARED_LIBRARIES is set to ON,
aoo will be built as a shared library. Otherwise it is built as a static library.
See Build instructions for the most important options. The default configuration should be fine for most projects.
If the aoo library is installed (locally or system-wide), you can import to your CMake project with find_package():
project(my_project)
find_package(Aoo REQUIRED)
add_executable(my_project main.cpp)
target_link_libraries(my_project PRIVATE Aoo::aoo)The CMake package honors the BUILD_SHARED_LIBS variable.
In addition, you can force the shared or static library by setting AOO_SHARED_LIBS to ON resp. OFF before calling find_library(Aoo).
Typically, the AooConfig.cmake file is located at <aoo_install_prefix>/lib/cmake/aoo.
NOTE: If aoo has been installed in a non-standard location, you need to add the install prefix to the CMAKE_PREFIX_PATH:
list(APPEND CMAKE_PREFIX_PATH "<aoo_install_prefix>")If you build and install aoo yourself, make sure that AOO_INSTALL_CMAKE_CONFIG_MODULE is set to ON (= default).
By default, aoo also provides a pkg-config file (aoo.pc).
This allows aoo to be used with other build systems via pkg-config.
Here is a simple example Makefile:
CC = gcc
CFLAGS = -g -Wall `pkg-config --cflags aoo`
LDFLAGS = `pkg-config --libs aoo`
all: my_project
main.o: main.c
$(CC) -c main.c $(CFLAGS)
my_project: main.o
$(CC) -o my_project main.o $(LDFLAGS)Typically, the aoo.pc file is located at <aoo_install_prefix>/lib/pkgconfig.
NOTE: If aoo has been installed in a non-standard location, you need to add the relevant path to the PKG_CONFIG_PATH environment variable, e.g.:
export PKG_CONFIG_PATH="${PKG_CONFIG_PATH}:<aoo_install_prefix>/lib/pkconfig"If you build and install aoo yourself, make sure that AOO_INSTALL_PKG_CONFIG_MODULE is set to ON (= default).
If you cannot use any of the methods above, you have to manually link with the aoo library and its dependencies.
With the shared library you only need to link with aoo itself.
With the static library you also need to link to some dependencies:
Linux/macOS: -lpthread
Windows (Msys2): -lpthread -lws2_32 -lssp
Windows (MSVC): ws2_32.lib
NOTE: If aoo has been built with a non-standard configuration, you need to add the appropriate preprocessor defines to your compiler flags. This is particularly important if aoo has been built with a different sample size (AOO_SAMPLE_SIZE)!
If aoo has been built with Opus support and you want to use the codec/aoo_opus.h header, you need to make sure that the opus_multistream.h header can be found by adding the appropriate include directory.
With the static library you also need to manually link with the opus library!
-
Install CMake 1
-
Install Git 2
-
Get the AOO source code: http://git.iem.at/cm/aoo/
HTTPS:
git clone https://git.iem.at/cm/aoo.gitSSH:
git clone git@git.iem.at:cm/aoo.git -
Fetch submodules:
git submodule update --init
Opus[^Opus] is a high quality low latency audio codec.
If you want to build AOO with integrated Opus support there are two options:
a. Use local Opus library (= default)
-
Make sure that
AOO_LOCAL_OPUSCMake variable isON(= default). -
Now Opus will be included in the project and you can configure it as needed.
NOTE: by default Opus will be built as a static library. If
BUILD_SHARED_LIBSorAOO_BUILD_SHARED_LIBRARYisON, both AOO and Opus will be built as shared libraries.
b. Link with the system opus library
-
Install Opus:
macOS (homebrew):
brew install opusWindows (Msys2):
pacman -S mingw32/mingw-w64-i686-opus(32 bit) resp.pacman -S mingw64/mingw-w64-x86_64-opus(64 bit)Linux (apt):
sudo apt-get install libopus-dev -
Set the
AOO_LOCAL_OPUSCMake variable toOFF(see below)
Follow these instructions if you want to build the Pd external.
-
Install Pure Data.
Windows/macOS: http://msp.ucsd.edu/software.html
Linux:
sudo apt-get install pure-data-dev -
The
AOO_BUILD_PD_EXTERNALCMake variable must beON. -
Make sure that
PD_INCLUDE_DIRpoints to the Pdsrcorincludedirectory. -
Windows: make sure that
PD_BIN_DIRpoints to the Pdbindirectory. -
Set
PD_INSTALL_DIRto the desired installation path (if you're not happy with the default).
NOTE: If you only want to build and install the Pd external,
set AOO_INSTALL_LIBRARY to OFF to prevent the aoo library from being installed as well.
-
Clone the SuperCollider source code from https://github.com/supercollider/supercollider.
-
The
AOO_BUILD_SC_EXTENSIONCMake variable must beON. -
Set
SC_INCLUDE_DIRto thesupercolliderfolder (which should contain the subfolderscommonandinclude) -
Set
SC_INSTALL_DIRto the desired installation path (if you're not happy with the default). -
Set
SC_SUPERNOVAtoONif you want to also build the Supernova version.
PortAudio is required for the example programs (AOO_BUILD_EXAMPLES=ON).
By default, the local portaudio in deps/portaudio will be used. If for some reason you want to use the system portaudio library, you can set AOO_LOCAL_PORTAUDIO to OFF.
Doxygen is required for building the API documentation (AOO_BUILD_DOCUMENTATION=ON).
By default, the minimum macOS deployment target is OSX 10.13. You may choose a higher version by setting the CMAKE_OSX_DEPLOYMENT_TARGET CMake variable.
-
In the "aoo" folder create a subfolder named "build".
-
Navigate to
buildand executecmake .. <options>. Available options are listed below. -
Build the project with
cmake --build . -
Install the project with
cmake --build . --target install/strip
CMake options are set with the following syntax:
cmake .. -D<name1>=<value1> -D<name2>=<value2> etc.
HINT: setting options is much more convenient with a graphical UI like cmake-gui or ccmake.
These are the most important project options:
-
CMAKE_BUILD_TYPE(STRING) - Choose one of the following build types: "Release", "RelMinSize", "RelWithDebInfo", "Debug". Default: "Release". -
CMAKE_INSTALL_PREFIX(PATH) - Where to install the AOO C/C++ library. -
AOO_BUILD_SHARED_LIBRARY(BOOL) - Build shared AOO library. (Default =OFF) -
AOO_BUILD_DOCUMENTATION(BOOL) - Build the API documentation. (Default =OFF) -
AOO_BUILD_EXAMPLES(BOOL) - Build the example programs. (Default =OFF) -
AOO_BUILD_PD_EXTERNAL(BOOL) - Build the Pd external. (Default =OFF)
AOO_BUILD_SC_EXTENSION(BOOL) - Build the SuperCollider extension. (Default =OFF)
-
AOO_BUILD_SERVER(BOOL) - Build theaooserverprogram. (Default =OFF) -
AOO_BUILD_TESTS(BOOL) - Build the test suite. (Default =OFF) -
AOO_USE_OPUS(BOOL) - Enable/disable built-in Opus support -
AOO_LOG_LEVEL(STRING) - Choose one of the following log levels: "None", "Error", "Warning", "Verbose", "Debug". Default: "Warning". -
AOO_NET(BOOL) - Build with integrated networking support (AooClientandAooServer). Disable it if you don't need it and want to reduce code size. NOTE: This option is required for the Pd external andaooserverprogram. (Default =ON) -
AOO_STATIC_RUNTIME(BOOL) - Linux and MinGW only: Link all binaries with static versions oflibgccandlibstdc++and - on MinGW - alsolibpthread. This makres sure that the resulting binaries are portable across systems. (MingGW: default =ON, Linux: default =OFF) -
AOO_NATIVE(BOOL) - optimize for this particular machine. NB: the resulting binaries are not portable and might not run on other machines! (Default =OFF) -
CMAKE_INSTALL_LIBRARY(BOOL) - Install theaoolibrary. (Default =ON) -
CMAKE_INSTALL_CMAKE_CONFIG_MODULE(BOOL) - Install CMake config module, see 1.2 CMake package. (Default =ON) -
CMAKE_INSTALL_CMAKE_CONFIG_MODULE(BOOL) - Install pkg-config module, see 1.3 pkg-config. (Default =ON)
cmake-gui resp. ccmake will show all available options. Alternatively, run cmake . -LH from the build folder.