Skip to content

Latest commit

 

History

History
72 lines (45 loc) · 2.58 KB

File metadata and controls

72 lines (45 loc) · 2.58 KB

CMake Presets System

The CMake Presets System in CPPython provides a sophisticated three-tier architecture for managing CMake configurations across different build scenarios, dependency providers, and user customizations.

Architecture Overview

The preset system is designed around three distinct layers:

User CMakePresets.json
    ↓ (includes)
CPPython Presets (.cppython/cppython.json)
    ↓ (includes)
Provider Presets (.cppython/providers/*.json)

Each layer serves a specific purpose and maintains clear separation of concerns.

Provider Preset Layer

The provider layer contains presets generated by dependency management tools like Conan or vcpkg. These presets include tool-specific configurations and are completely managed by CPPython.

Structure

Each provider generates 4 configure presets:

{provider}-base

Hidden preset containing common configuration shared by all other presets. Includes toolchain files and top-level includes.

{provider}-default

Hidden preset inheriting from base. No specific build type set, making it suitable for multi-config generators.

{provider}-release

Hidden preset inheriting from base with CMAKE_BUILD_TYPE=Release for single-config generators.

{provider}-debug

Hidden preset inheriting from base with CMAKE_BUILD_TYPE=Debug for single-config generators.

CPPython Preset Layer

The CPPython layer standardizes provider configurations and creates both configure and build presets. This layer serves as the primary interface between provider-specific settings and user configurations.

Configure Presets

The CPPython layer generates 3 configure presets:

default

Public preset inheriting from {provider}-default. Designed for multi-config generators.

release

Public preset inheriting from {provider}-release. Optimized for single-config Release builds.

debug

Public preset inheriting from {provider}-debug. Optimized for single-config Debug builds.

Build Presets

The CPPython layer generates 4 build presets to handle both single-config and multi-config generators:

multi-release

Uses the default configure preset with configuration: "Release". For multi-config generators.

multi-debug

Uses the default configure preset with configuration: "Debug". For multi-config generators.

release

Uses the release configure preset with configuration: "Release". For single-config generators.

debug

Uses the debug configure preset with configuration: "Debug". For single-config generators.