Domain Flow Setup Guide
Quick Start
Section titled “Quick Start”1. Install Prerequisites
Section titled “1. Install Prerequisites”Linux/macOS
Section titled “Linux/macOS”- CMake 3.28+
- C++20 compiler (GCC 10+, Clang 12+)
- Ninja build system (optional but recommended)
- System dependencies (installed via package manager)
# Ubuntu/Debiansudo apt install cmake ninja-build g++
# Fedora/RHELsudo dnf install cmake ninja-build gcc-c++
# macOS (with Homebrew)brew install cmake ninjaWindows
Section titled “Windows”- CMake 3.28+
- Visual Studio 2022 with C++ development tools OR Ninja
- vcpkg package manager
# Install vcpkggit clone https://github.com/Microsoft/vcpkg.gitcd vcpkg.\bootstrap-vcpkg.bat
# Set environment variable (PowerShell)$env:VCPKG_ROOT = "C:\dev\vcpkg"# Or set permanently via System Properties > Environment VariablesOptional (for MLIR tools, all platforms)
Section titled “Optional (for MLIR tools, all platforms)”- LLVM/MLIR 17+ built from source
2. Configure CMake User Presets
Section titled “2. Configure CMake User Presets”Choose the template for your platform:
Linux (uses native system dependencies, no vcpkg)
Section titled “Linux (uses native system dependencies, no vcpkg)”cp CMakeUserPresets.json.Linux.template CMakeUserPresets.jsonEdit 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" } } ]}Windows (uses vcpkg for dependencies)
Section titled “Windows (uses vcpkg for dependencies)”cp CMakeUserPresets.json.Windows.template CMakeUserPresets.jsonEdit 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.
3. Configure and Build
Section titled “3. Configure and Build”Linux - Basic Build (no MLIR)
Section titled “Linux - Basic Build (no MLIR)”# Configure (uses native system packages)cmake --preset user-ninja-release
# Buildcmake --build build/Ninja-Release
# Run tests (if enabled)ctest --test-dir build/Ninja-ReleaseWindows - Basic Build (with vcpkg)
Section titled “Windows - Basic Build (with vcpkg)”# Configure (uses vcpkg for dependencies)cmake --preset user-vs17-release
# Buildcmake --build build_msvc/VS17-Release
# Or use Ninja on Windowscmake --preset user-ninja-releasecmake --build build/Ninja-ReleaseAll Platforms - With MLIR Tools
Section titled “All Platforms - With MLIR Tools”First, build LLVM/MLIR (Linux/macOS):
git clone https://github.com/llvm/llvm-project.gitcd llvm-projectmkdir build && cd build
cmake -G Ninja ../llvm \ -DLLVM_ENABLE_PROJECTS="mlir" \ -DCMAKE_BUILD_TYPE=Release \ -DLLVM_TARGETS_TO_BUILD="X86" \ -DLLVM_ENABLE_ASSERTIONS=ON
ninjaWindows (use build_msvc directory):
cd llvm-projectmkdir build_msvccd 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 ReleaseThen configure Domain Flow with MLIR:
# Ensure CMakeUserPresets.json has:# "LLVM_PROJECT_ROOT": "/path/to/llvm-project"
# Configure with MLIR tools enabledcmake --preset user-ninja-release -DDOMAINFLOW_MLIR_TOOLS=ON
# Buildcmake --build build/Ninja-ReleaseAlternative: Environment Variables
Section titled “Alternative: Environment Variables”Instead of using CMakeUserPresets.json, you can set environment variables:
# Linux/macOSexport VCPKG_ROOT=/path/to/vcpkgexport LLVM_PROJECT_ROOT=/path/to/llvm-project
# Then use the base presetscmake --preset Ninja-Release
# Windows (PowerShell)$env:VCPKG_ROOT = "C:\path\to\vcpkg"$env:LLVM_PROJECT_ROOT = "C:\path\to\llvm-project"
cmake --preset Ninja-ReleaseBuild Options
Section titled “Build Options”Control features with CMake options:
cmake --preset user-ninja-release \ -DDOMAINFLOW_BUILD_TESTING=ON \ -DDOMAINFLOW_TOOLS=ON \ -DDOMAINFLOW_DSE=ON \ -DDOMAINFLOW_MLIR_TOOLS=OFFAvailable Options
Section titled “Available Options”| Option | Default | Description |
|---|---|---|
DOMAINFLOW_BUILD_TESTING | BUILD_TESTING (root) / OFF (subproject) | Build and register tests |
DOMAINFLOW_TOOLS | OFF | Build dfg/rdg tools |
DOMAINFLOW_POLYHEDRAL | ON | Build polyhedral tools |
DOMAINFLOW_MLIR_TOOLS | OFF | Build MLIR integration (requires LLVM) |
DOMAINFLOW_DSE | OFF | Build design space exploration tools |
DOMAINFLOW_VISUALIZATION | OFF | Build visualization tools |
DOMAINFLOW_MATPLOT_TOOLS | OFF | Build matplotlib integration |
DOMAINFLOW_DATABASE_TOOLS | OFF | Build database tools |
Troubleshooting
Section titled “Troubleshooting””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:
# Clean the build directoryrm -rf build/user-ninja-release
# Reconfigurecmake --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:
# Ubuntu/Debiansudo apt install ninja-build
# Fedora/RHELsudo dnf install ninja-build
# macOSbrew install ninjavcpkg not found (Windows only)
Section titled “vcpkg not found (Windows only)”Ensure VCPKG_ROOT environment variable is set:
echo $env:VCPKG_ROOT # Should print vcpkg pathMLIR not found
Section titled “MLIR not found”If building with DOMAINFLOW_MLIR_TOOLS=ON:
- Verify
LLVM_PROJECT_ROOTis set in CMakeUserPresets.json - Ensure LLVM/MLIR is built
- Pass
-DMLIR_DIRexplicitly if needed
Preset not found
Section titled “Preset not found”If you see “preset not found”, ensure you’ve created CMakeUserPresets.json from the appropriate platform template.
Compiler warnings about overflow
Section titled “Compiler warnings about overflow”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.
Platform-Specific Notes
Section titled “Platform-Specific Notes”- Use
Ninja-DebugorNinja-Releasepresets (or user variants) - Ensure CMake 3.31+ is installed via system package manager or from source
Windows
Section titled “Windows”- Use
VS17-DebugorVS17-Releasepresets for Visual Studio - Or use
Ninja-Debug/Ninja-Releasewith Ninja generator - Install Visual Studio 2022 with C++ development tools
- Use
Ninja-DebugorNinja-Releasepresets - Install CMake via Homebrew:
brew install cmake - Ensure Xcode Command Line Tools are installed