Zaber Launcher Tutorials
Zaber Motion Library
Sample Projects
Virtual DeviceDropdown icon
About3D Viewer
AccountDropdown icon
Sign InSign Up
Zaber Motion LibraryGetting Started
How-to Guides
Communication
Controlling multiple devicesFinding the right serial port nameImproving performance of X-USBDC (FTDI)Interaction with Zaber LauncherTCP/IP (network) communication
Library Features
Arbitrary unit conversionsError handlingEventsG-CodeNon-blocking (simultaneous) axis movementSaving and loading stateSending arbitrary commands
Device Features
Device I/OLockstepOscilloscopePosition Velocity Time (PVT)PVT Sequence GenerationSettingsStreamed movementTriggersWarning flags
Product-Specific APIs
MicroscopeProcess controllerVirtual devices
Advanced
Building a Standalone Application with MATLAB CompilerBuilding the C++ Library from Source CodeCustom transportsDevice databaseLoggingMATLAB Migration GuidePackaging Your Program with PyinstallerThread safety
API ReferenceSupportBinary Protocol (Legacy)
© 2026 Zaber Technologies Inc.

Building the C++ Library from Source Code

Before you begin, please select your operating system below.

We strongly recommend using the installer from the tutorial unless you are familiar with CMake and the build tools of your platform.

Use your distributions package manager to install GCC and CMake.

  • GCC should be version 11 or higher.
  • CMake should be version 3.22 or higher.

Verify the installed versions in your terminal:

g++ --version
# example output:
# gcc (GCC) 11.4.0
# Copyright (C) 2021 Free Software Foundation, Inc.
# This is free software; see the source for copying conditions.  There is NO
# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

cmake --version
# example output:
# cmake version 3.22.1
# CMake suite maintained and supported by Kitware (kitware.com/cmake).

Use the homebrew package manager to install clang (llvm) and CMake.

  • llvm should be version 14.0.0 or higher.
  • CMake should be version 3.19 or higher.
brew install --with-toolchain llvm
brew install cmake

Verify the installed versions in your terminal:

llvm-gcc --version
# example output:
# Apple clang version 14.0.3 (clang-1403.0.22.14.1)
# Target: arm64-apple-darwin22.5.0
# Thread model: posix
# InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

cmake --version
# example output:
# cmake version 3.19.2
# CMake suite maintained and supported by Kitware (kitware.com/cmake).

Ensure that you have Microsoft Visual Studio installed. Install CMake. When installing CMake please ensure that you select the "Add to system path" option.

  • Visual Studio edition should be 2022 or later.
  • CMake should be version 3.15 or higher.

Verify the installed versions in your command prompt:

cmake --version
# example output:
# cmake version 3.15.0
# CMake suite maintained and supported by Kitware (kitware.com/cmake).

Download the Zaber Motion Library (ZML) source package. Please note that the source package contains prebuilt Go shared library required by ZML. If you decide to checkout the source code from the Git repository, you will need to install the Go toolchain build the shared library yourself.

Then open a command prompt and enter in the following commands. You will need to specify the system architecture when calling cmake, for most systems this is 64bit (x64). Note that if you wish to install the library (last step below) this command prompt must be started with admininstrator privileges.

# In the same directory as your unzipped source directory

# This path will change depending on the version of Visual Studio you have installed
call "C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\Tools\VsMSBuildCmd.bat"

cd ZaberMotionCppSource/cpp
mkdir build
cd build
cmake -G "Visual Studio 17 2022" -A x64 ../ -DZML_ARCH=x64
msbuild "Zaber Motion Library.sln" /p:Configuration=Release
devenv "Zaber Motion Library.sln" /build Release /project INSTALL  # Will require administrator privileges

The install step will place the libraries in C:\Program Files\Zaber Motion Library\.

For PowerShell, the commands are the same expect initializing the Visual Studio environment.

# This path will change depending on the version of Visual Studio you have installed
& 'C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\Tools\Launch-VsDevShell.ps1'

MinGW

While it is possible to build the library using MinGW compiler, we do not support this use case. Please take the following instructions without any warranty.

In order to build the library the MinGW distribution must support dynamic linking (-ldl). This is true of w64devkit but not of some other distributions. You may need to install some additional packages. Use the following commands to generate and build the project.

cmake -G "MinGW Makefiles" ../ -DZML_ARCH=x64
make

You may need to change some of the source/generated files to achieve a working configuration.

Then use CMake to build and install the source in your terminal. You will need to specify the system architecture when calling cmake, for most systems this is 64bit (x64).

# In the same directory as your unzipped source directory
cd ZaberMotionCppSource/cpp
mkdir build && cd build
cmake ../ -DZML_ARCH=x64
make
make install  # This may require root privileges