Skip to content

Latest commit

 

History

History
113 lines (85 loc) · 4.5 KB

File metadata and controls

113 lines (85 loc) · 4.5 KB

Building

Option 1 : Devcontainer build environment

This is the preferred option for development on WSL2 or native linux desktop. This method is self contained, provides a predictable build environment (through a dynamically built container) and pre-configured set of VSCode extensions defined in the devcontainer definition file.

  1. Install VSCode
  2. Install the DevContainer extension
  3. Install docker (inside wsl2 or native linux). Make sure the current user is part of the docker group.
    • On Ubuntu, this would be: sudo apt install docker.io
  4. Install docker buildx.
    • On Ubuntu, this would be: sudo apt install docker-buildx
  5. Open the MXL source code folder using VSCode.
    • In wsl2 this can be done by launching code <mxl_directory>
    • NOTE: If not running under WSL2, remove the 2 mount points defined in the devcontainer.json you intend to use for development.
    • For example, if you intend to use the Ubuntu 24.04 devcontainer, edit the .devcontainer/ubuntu24/devcontainer.json file and remove the content of the "mounts" array. These mount points are only needed for X/WAYLAND support in WSL2. Their presence will prevent the devcontainer to load correctly when running on a native Linux system.
  6. VSCode will detect that this folder contains a devcontainer definition. It will prompt you with a dialog "Reopen in dev container". Click this dialog. If the dialog does not appear, you can invoke the command: CTRL-SHIFT-P -> Dev Containers : Reopen in container

Option 2: CMake with presets

Note: the following instructions apply to Ubuntu 22.04.

  1. Install all apt packages specified in the Dockerfile
  2. Install vcpkg as done in the Dockerfile
  3. Create a build directory and invoke cmake with a build preset. the list of available presets is:
  "Linux-GCC-Debug"
  "Linux-GCC-Release"
  "Linux-GCC-AddressSanitizer"
  "Linux-GCC-ThreadSanitizer"
  "Linux-GCC-UBSanitizer"
  "Linux-Clang-Debug"
  "Linux-Clang-Release"
  "Linux-Clang-AddressSanitizer"
  "Linux-Clang-UBSanitizer"
  "Darwin-Clang-Debug"
  "Darwin-Clang-Release"
  "Darwin-Clang-AddressSanitizer"
  "Darwin-Clang-UBSanitizer"

For example:

# Generate the build files using the Linux-Clang-Debug preset
mkdir build
cd build
cmake .. --preset Linux-Clang-Debug

# Build everything
cmake --build Linux-Clang-Debug --target all

Static build notes

By default, the CMake presets build MXL as shared libraries. To build MXL as static libraries instead, use the CMake option -DBUILD_SHARED_LIBS=OFF.

For example:

mkdir build
cd build
cmake .. --preset Linux-GCC-Debug -DBUILD_SHARED_LIBS=OFF
cmake --build build/Linux-GCC-Debug --target all

PIC is enabled by default and can be disabled with -DMXL_ENABLE_PIC=OFF.

macOS notes

  1. Install the Homebrew package manager
  2. Install doxygen and ccache through brew: brew install doxygen ccache
  3. Install the GStreamer runtime and developement packages according to these instructions

ARM notes

The MXL project is configured to require the armv8.5-a architecture on ARM CPUs. Most modern ARM CPUs meet this requirement. Notable exceptions are the Raspberry Pis. For example, the Pi 5 CPU has an architecture level armv8.2-a whereas the Pi 4 Model B is at level armv8.0-a. To properly target these CPUs, pass the architecture type as an additional argument to cmake : -DMXL_TARGET_ARCH=<archname>.

For example, for the Raspberry Pi 5:

mkdir build
cd build
cmake .. --preset Linux-GCC-Debug -DMXL_TARGET_ARCH=armv8.2a
cmake --build build/Linux-GCC-Debug --target all

Using with CMake

The MXL provides a CMake package configuration file that allows for easy integration into your project. If it is installed in a non-default location, you may need to specify its root path using CMAKE_PREFIX_PATH:

cmake -DCMAKE_PREFIX_PATH=/home/username/mxl-sdk ..

Basic usage

Below is a minimal example of how to use the MXL in your project:

cmake_minimum_required(VERSION 3.20)
project(mxl-test LANGUAGES CXX)
find_package(mxl CONFIG REQUIRED)
add_executable(mxl-test main.cpp)
target_link_libraries(mxl-test PRIVATE mxl::mxl)