Skip to content

Add CMakePresets.json for better IDE and build system integration#6806

Merged
hkaiser merged 6 commits intoSTEllAR-GROUP:masterfrom
Adityabaskati-weeb:add-cmake-presets
Jan 1, 2026
Merged

Add CMakePresets.json for better IDE and build system integration#6806
hkaiser merged 6 commits intoSTEllAR-GROUP:masterfrom
Adityabaskati-weeb:add-cmake-presets

Conversation

@Adityabaskati-weeb
Copy link
Contributor

What does this PR do?

Adds a CMakePresets.json file to provide pre-defined build configurations for HPX.

Key Benefits:

  • Easier Onboarding: New users can quickly get started with common HPX configurations
  • IDE Integration: Works seamlessly with IDEs like VS Code, CLion, and Visual Studio
  • Reproducible Builds: Ensures consistent builds across different environments
  • Documentation: Serves as living documentation of common build configurations

Included Presets:

  • release: Optimized release build
  • debug: Debug build with debug symbols and stack traces
  • minimal: Minimal build with essential features
  • full: Full build with all features (tests, examples, docs)
  • mpi: MPI-enabled build
  • sanitizers: Builds with various sanitizers (ASan, TSan, UBSan)
  • coverage: Code coverage build

Usage:

# Configure with a preset
cmake --preset=debug

# Build using a preset
cmake --build --preset=debug

# Run tests
ctest --preset=debug


Requirements:
CMake 3.19 or later (HPX already requires 3.18+)

@StellarBot
Copy link

Can one of the admins verify this patch?

Copy link
Contributor Author

@Adityabaskati-weeb Adityabaskati-weeb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here some changes in code you can review it:

{
  "version": 3,
  "cmakeMinimumRequired": {
    "major": 3,
    "minor": 19,
    "patch": 0
  },
  "configurePresets": [
    {
      "name": "base",
      "hidden": true,
      "generator": "Ninja",
      "binaryDir": "${sourceDir}/cmake-build-${presetName}",
      "cacheVariables": {
        "CMAKE_BUILD_TYPE": "Release",
        "HPX_WITH_MALLOC": "tcmalloc",
        "HPX_WITH_NETWORKING": "ON",
        "HPX_WITH_PARCELPORT_TCP": "ON"
      }
    },
    {
      "name": "release",
      "displayName": "Release build with optimizations",
      "inherits": "base",
      "cacheVariables": {
        "CMAKE_BUILD_TYPE": "Release",
        "CMAKE_CXX_FLAGS": "-O3 -DNDEBUG"
      }
    },
    {
      "name": "debug",
      "displayName": "Debug build with debug symbols",
      "inherits": "base",
      "cacheVariables": {
        "CMAKE_BUILD_TYPE": "Debug",
        "HPX_WITH_DEBUGGING": "ON",
        "HPX_WITH_LOGGING": "ON",
        "HPX_WITH_STACKOVERFLOW_DETECTION": "ON",
        "HPX_WITH_THREAD_BACKTRACE_ON_SUSPENSION": "ON"
      }
    },
    {
      "name": "relwithdebinfo",
      "displayName": "Release with debug info",
      "inherits": "base",
      "cacheVariables": {
        "CMAKE_BUILD_TYPE": "RelWithDebInfo"
      }
    },
    {
      "name": "minimal",
      "displayName": "Minimal build with essential features",
      "inherits": "base",
      "cacheVariables": {
        "HPX_WITH_EXAMPLES": "OFF",
        "HPX_WITH_TESTS": "OFF",
        "HPX_WITH_DOCUMENTATION": "OFF",
        "HPX_WITH_TOOLS": "OFF",
        "HPX_WITH_PARCELPORT_MPI": "OFF",
        "HPX_WITH_PARCELPORT_TCP": "ON"
      }
    },
    {
      "name": "full",
      "displayName": "Full build with all features",
      "inherits": "base",
      "cacheVariables": {
        "HPX_WITH_EXAMPLES": "ON",
        "HPX_WITH_TESTS": "ON",
        "HPX_WITH_DOCUMENTATION": "ON",
        "HPX_WITH_TOOLS": "ON",
        "HPX_WITH_ASYNC_MPI": "ON",
        "HPX_WITH_PARCELPORT_MPI": "AUTO",
        "HPX_WITH_PARCELPORT_TCP": "ON",
        "HPX_WITH_PARCELPORT_LCI": "AUTO",
        "HPX_WITH_APEX": "AUTO"
      }
    },
    {
      "name": "mpi",
      "displayName": "MPI-enabled build",
      "inherits": "release",
      "cacheVariables": {
        "HPX_WITH_PARCELPORT_MPI": "ON",
        "MPI_CXX_COMPILER": "mpicxx"
      }
    },
    {
      "name": "asan",
      "displayName": "Address Sanitizer build",
      "inherits": "debug",
      "cacheVariables": {
        "CMAKE_CXX_FLAGS": "-fsanitize=address -fno-omit-frame-pointer"
      }
    },
    {
      "name": "tsan",
      "displayName": "Thread Sanitizer build",
      "inherits": "debug",
      "cacheVariables": {
        "HPX_WITH_SANITIZERS": "thread",
        "HPX_WITH_COMPILER_SANITIZERS": "thread"
      }
    },
    {
      "name": "ubsan",
      "displayName": "Undefined Behavior Sanitizer build",
      "inherits": "debug",
      "cacheVariables": {
        "HPX_WITH_SANITIZERS": "undefined",
        "HPX_WITH_COMPILER_SANITIZERS": "undefined"
      }
    }
  ],
  "buildPresets": [
    {
      "name": "default",
      "configurePreset": "release",
      "configuration": "Release"
    },
    {
      "name": "debug",
      "configurePreset": "debug",
      "configuration": "Debug"
    },
    {
      "name": "relwithdebinfo",
      "configurePreset": "relwithdebinfo",
      "configuration": "RelWithDebInfo"
    }
  ],
  "testPresets": [
    {
      "name": "default",
      "configurePreset": "debug",
      "configuration": "Debug",
      "output": {"outputOnFailure": true}
    },
    {
      "name": "release",
      "configurePreset": "release",
      "configuration": "Release",
      "output": {"outputOnFailure": true}
    }
  ]
}

@Pansysk75
Copy link
Member

@Adityabaskati-weeb Would it be possible to make those changes in-code? It will be easier to review. Thanks!

@Adityabaskati-weeb
Copy link
Contributor Author

@Adityabaskati-weeb Would it be possible to make those changes in-code? It will be easier to review. Thanks!

ohk

@Pansysk75
Copy link
Member

Pansysk75 commented Dec 2, 2025

@Adityabaskati-weeb Hi, if I may make a suggestion, let's keep this pull request limited to the CMakeUserPresets.json, keeping it as simple as we can.
If you have any suggestions for other parts of the CMake configuration, let's discuss that separately.

Changed HPX_WITH_PARCELPORT_MPI to STRING to allow auto-detection when empty. Fixed invalid flags and structure in CMakePresets.json.

Signed-off-by: Hartmut Kaiser <hartmut.kaiser@gmail.com>
Reformatted CMakeLists.txt to satisfy cmake-format. Disabled MPI in configure_test_combinations job in CircleCI.
- This rolls back the changes related to the MPI configuration

Signed-off-by: Hartmut Kaiser <hartmut.kaiser@gmail.com>
@hkaiser hkaiser merged commit b07530a into STEllAR-GROUP:master Jan 1, 2026
72 of 74 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants