This project uses CMake with vcpkg as the package manager. The build system is designed to automatically detect vcpkg and work with standard CMake commands.
- CMake (version 3.20 or higher)
- vcpkg package manager
- C++ compiler (MSVC, GCC, or Clang)
- Ninja build system (optional but recommended)
The CMake configuration will automatically detect vcpkg if:
- The
VCPKG_ROOTenvironment variable is set, or - vcpkg is installed in one of these locations:
${PROJECT_DIR}/vcpkg/C:/vcpkg/orE:/vcpkg/(Windows)$HOME/vcpkg/or/opt/vcpkg/(Linux/macOS)
Windows (Command Prompt):
set VCPKG_ROOT=E:\vcpkgWindows (PowerShell):
$env:VCPKG_ROOT = "E:\vcpkg"Linux/macOS:
export VCPKG_ROOT=/path/to/vcpkgTo make it permanent, add the above line to your .bashrc or .zshrc.
List available presets:
cmake --list-presetsConfigure with a preset:
cmake --preset debug
# or
cmake --preset release
# or
cmake --preset vs2022Build:
cmake --build --preset debug
# or
cmake --build --preset releaseConfigure:
# Debug build
cmake -B build-debug -DCMAKE_BUILD_TYPE=Debug
# Release build
cmake -B build-release -DCMAKE_BUILD_TYPE=ReleaseBuild:
cmake --build build-debug
# or
cmake --build build-releaseIf vcpkg is not autodetected, you can specify the toolchain file manually:
cmake -B build-debug -DCMAKE_TOOLCHAIN_FILE=/path/to/vcpkg/scripts/buildsystems/vcpkg.cmakeThe following CMake options control which examples are built:
BUILD_QT_EXAMPLES(default: ON) - Build Qt-based examplesBUILD_VTK_EXAMPLES(default: OFF) - Build VTK visualization examplesBUILD_EIGEN_EXAMPLES(default: ON) - Build Eigen linear algebra examplesBUILD_MIXED_LANG_EXAMPLES(default: OFF) - Build mixed-language examples
Example:
cmake -B build-debug -DBUILD_VTK_EXAMPLES=ON -DBUILD_QT_EXAMPLES=OFFAll executables are built to the bin/ directory in the project root.
vcpkg not found:
- Set the
VCPKG_ROOTenvironment variable - Or use
-DCMAKE_TOOLCHAIN_FILE=/path/to/vcpkg/scripts/buildsystems/vcpkg.cmake
Missing dependencies:
cd /path/to/vcpkg
./vcpkg installThis will install all dependencies listed in vcpkg.json.
The old build scripts (cpp-build.cmd, config_debug_build.cmd, etc.) are kept for backward compatibility but are no longer needed with the modernized build system.