Skip to content

Domain Flow Setup Guide

  • CMake 3.28+
  • C++20 compiler (GCC 10+, Clang 12+)
  • Ninja build system (optional but recommended)
  • System dependencies (installed via package manager)
Terminal window
# Ubuntu/Debian
sudo apt install cmake ninja-build g++
# Fedora/RHEL
sudo dnf install cmake ninja-build gcc-c++
# macOS (with Homebrew)
brew install cmake ninja
  • CMake 3.28+
  • Visual Studio 2022 with C++ development tools OR Ninja
  • vcpkg package manager
Terminal window
# Install vcpkg
git clone https://github.com/Microsoft/vcpkg.git
cd vcpkg
.\bootstrap-vcpkg.bat
# Set environment variable (PowerShell)
$env:VCPKG_ROOT = "C:\dev\vcpkg"
# Or set permanently via System Properties > Environment Variables
  • LLVM/MLIR 17+ built from source

Choose the template for your platform:

Linux (uses native system dependencies, no vcpkg)

Section titled “Linux (uses native system dependencies, no vcpkg)”
Terminal window
cp CMakeUserPresets.json.Linux.template CMakeUserPresets.json

Edit CMakeUserPresets.json to set your LLVM path:

{
"configurePresets": [
{
"name": "user-ninja-release",
"inherits": "Ninja-Release",
"environment": {
"LLVM_PROJECT_ROOT": "/home/yourname/dev/clones/llvm-project"
}
}
]
}
Terminal window
cp CMakeUserPresets.json.Windows.template CMakeUserPresets.json

Edit CMakeUserPresets.json to set your local paths:

{
"configurePresets": [
{
"name": "user-vs17-release",
"inherits": "VS17-Release",
"environment": {
"VCPKG_ROOT": "C:/dev/vcpkg",
"LLVM_PROJECT_ROOT": "C:/dev/clones/llvm-project"
},
"cacheVariables": {
"CMAKE_TOOLCHAIN_FILE": {
"type": "FILEPATH",
"value": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake"
}
}
}
]
}

Note: CMakeUserPresets.json is gitignored and won’t be committed. The platform-specific templates are checked in to preserve configuration knowledge.

Terminal window
# Configure (uses native system packages)
cmake --preset user-ninja-release
# Build
cmake --build build/Ninja-Release
# Run tests (if enabled)
ctest --test-dir build/Ninja-Release
Terminal window
# Configure (uses vcpkg for dependencies)
cmake --preset user-vs17-release
# Build
cmake --build build_msvc/VS17-Release
# Or use Ninja on Windows
cmake --preset user-ninja-release
cmake --build build/Ninja-Release

First, build LLVM/MLIR (Linux/macOS):

Terminal window
git clone https://github.com/llvm/llvm-project.git
cd llvm-project
mkdir build && cd build
cmake -G Ninja ../llvm \
-DLLVM_ENABLE_PROJECTS="mlir" \
-DCMAKE_BUILD_TYPE=Release \
-DLLVM_TARGETS_TO_BUILD="X86" \
-DLLVM_ENABLE_ASSERTIONS=ON
ninja

Windows (use build_msvc directory):

Terminal window
cd llvm-project
mkdir build_msvc
cd build_msvc
cmake -G "Visual Studio 17 2022" ..\llvm `
-DLLVM_ENABLE_PROJECTS="mlir" `
-DCMAKE_BUILD_TYPE=Release `
-DLLVM_TARGETS_TO_BUILD="X86"
cmake --build . --config Release

Then configure Domain Flow with MLIR:

Terminal window
# Ensure CMakeUserPresets.json has:
# "LLVM_PROJECT_ROOT": "/path/to/llvm-project"
# Configure with MLIR tools enabled
cmake --preset user-ninja-release -DDOMAINFLOW_MLIR_TOOLS=ON
# Build
cmake --build build/Ninja-Release

Instead of using CMakeUserPresets.json, you can set environment variables:

Terminal window
# Linux/macOS
export VCPKG_ROOT=/path/to/vcpkg
export LLVM_PROJECT_ROOT=/path/to/llvm-project
# Then use the base presets
cmake --preset Ninja-Release
# Windows (PowerShell)
$env:VCPKG_ROOT = "C:\path\to\vcpkg"
$env:LLVM_PROJECT_ROOT = "C:\path\to\llvm-project"
cmake --preset Ninja-Release

Control features with CMake options:

Terminal window
cmake --preset user-ninja-release \
-DDOMAINFLOW_BUILD_TESTING=ON \
-DDOMAINFLOW_TOOLS=ON \
-DDOMAINFLOW_DSE=ON \
-DDOMAINFLOW_MLIR_TOOLS=OFF
OptionDefaultDescription
DOMAINFLOW_BUILD_TESTINGBUILD_TESTING (root) / OFF (subproject)Build and register tests
DOMAINFLOW_TOOLSOFFBuild dfg/rdg tools
DOMAINFLOW_POLYHEDRALONBuild polyhedral tools
DOMAINFLOW_MLIR_TOOLSOFFBuild MLIR integration (requires LLVM)
DOMAINFLOW_DSEOFFBuild design space exploration tools
DOMAINFLOW_VISUALIZATIONOFFBuild visualization tools
DOMAINFLOW_MATPLOT_TOOLSOFFBuild matplotlib integration
DOMAINFLOW_DATABASE_TOOLSOFFBuild database tools

”Could not find toolchain file: /scripts/buildsystems/vcpkg.cmake”

Section titled “”Could not find toolchain file: /scripts/buildsystems/vcpkg.cmake””

This happens when CMake cache has stale vcpkg configuration:

Terminal window
# Clean the build directory
rm -rf build/user-ninja-release
# Reconfigure
cmake --preset user-ninja-release

“CMake was unable to find a build program corresponding to Ninja”

Section titled ““CMake was unable to find a build program corresponding to Ninja””

Install Ninja:

Terminal window
# Ubuntu/Debian
sudo apt install ninja-build
# Fedora/RHEL
sudo dnf install ninja-build
# macOS
brew install ninja

Ensure VCPKG_ROOT environment variable is set:

Terminal window
echo $env:VCPKG_ROOT # Should print vcpkg path

If building with DOMAINFLOW_MLIR_TOOLS=ON:

  1. Verify LLVM_PROJECT_ROOT is set in CMakeUserPresets.json
  2. Ensure LLVM/MLIR is built
  3. Pass -DMLIR_DIR explicitly if needed

If you see “preset not found”, ensure you’ve created CMakeUserPresets.json from the appropriate platform template.

The warnings in index_space.hpp about overflow conversions are expected and harmless. They occur when using double::infinity() with integer types for sentinel values.

  • Use Ninja-Debug or Ninja-Release presets (or user variants)
  • Ensure CMake 3.31+ is installed via system package manager or from source
  • Use VS17-Debug or VS17-Release presets for Visual Studio
  • Or use Ninja-Debug/Ninja-Release with Ninja generator
  • Install Visual Studio 2022 with C++ development tools
  • Use Ninja-Debug or Ninja-Release presets
  • Install CMake via Homebrew: brew install cmake
  • Ensure Xcode Command Line Tools are installed