Add godbolt-minimal CMake preset for browser-based compiler environments#7063
Merged
hkaiser merged 1 commit intoTheHPXProject:masterfrom Mar 20, 2026
Merged
Conversation
|
Can one of the admins verify this patch? |
Signed-off-by: shivansh023023 <singhshivansh023@gmail.com>
fe6cd7b to
e2c080f
Compare
Contributor
|
FWIW, |
GitMasterJatin
added a commit
to GitMasterJatin/hpx
that referenced
this pull request
Apr 3, 2026
The existing godbolt-minimal preset (added in TheHPXProject#7063) is missing several flags required for a correct Compiler Explorer integration: 1. Add HPX_WITH_DISTRIBUTED_RUNTIME=OFF: HPX_WITH_NETWORKING=OFF alone does not disable the distributed runtime -- AGAS, actions, and the parcelset infrastructure are still compiled, wasting ~30% build time and producing libraries that CE will never use. 2. Add HPX_WITH_CXX_STANDARD=20: pins the C++ standard explicitly so builds are deterministic across GCC/Clang versions. Uses HPX's own cache variable (not CMAKE_CXX_STANDARD, which HPX rejects unless HPX_USE_CMAKE_CXX_STANDARD is also set). 3. Add HPX_WITH_TOOLS=OFF: CE only needs libraries and headers; building HPX tools adds unnecessary build time. 4. Improve description: document the produced static libraries (libhpx_wrap.a, libhpx_init.a, libhpx.a, libhpx_core.a) and the required -Wl,-wrap=main linker flag for non-CMake consumers. 5. Reorder cache variables to group related flags logically: standard -> linking -> runtime -> dependencies -> build targets.
GitMasterJatin
added a commit
to GitMasterJatin/hpx
that referenced
this pull request
Apr 8, 2026
Add a GitHub Actions workflow that builds HPX using the same flags as the godbolt-minimal CMake preset and verifies the expected static libraries (libhpx_wrap.a, libhpx_init.a, libhpx.a, libhpx_core.a) are produced. The godbolt-minimal preset was added in TheHPXProject#7063 but is not validated in CI, meaning regressions (broken flags, missing libraries) could go undetected. This workflow catches those issues on every PR. The workflow: 1. Configures with the exact flags from the godbolt-minimal preset 2. Builds the project 3. Asserts that all four static libraries exist in the build tree
2 tasks
GitMasterJatin
added a commit
to GitMasterJatin/hpx
that referenced
this pull request
Apr 10, 2026
Add a GitHub Actions workflow that builds HPX using the same flags as the godbolt-minimal CMake preset, installs it to a local prefix, then builds and runs a minimal external hello-world program against that installation as a crash-and-burn smoke test. The godbolt-minimal preset was added in TheHPXProject#7063 but is not validated in CI, meaning regressions (broken flags, missing libraries, broken CMake export config, link-order issues) could go undetected. This workflow catches those issues on every PR. The workflow: 1. Configures with the exact flags from the godbolt-minimal preset 2. Builds the project 3. Installs HPX to a local prefix 4. Builds a minimal external project via find_package(HPX REQUIRED) 5. Runs the resulting hello-world binary as a smoke test Signed-off-by: GitMasterJatin <jatinnsharmaa7@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes # — N/A (new feature)
Proposed Changes
godbolt-minimalconfigure preset to CMakePresets.json with 8 cache variables optimized for browser-based sandboxed environments (Compiler Explorer / Godbolt):HPX_WITH_MALLOC=system,HPX_WITH_NETWORKING=OFF,HPX_WITH_TESTS=OFF,HPX_WITH_EXAMPLES=OFF,HPX_WITH_DOCUMENTATION=OFF,HPX_WITH_STATIC_LINKING=ON,HPX_WITH_FETCH_ASIO=ON,CMAKE_BUILD_TYPE=Release.godbolt-minimalbuild preset.cmake --preset godbolt-minimal) that produces the minimal static HPX libraries required for integration with Compiler Explorer.Any background context you want to provide?
As part of the GSoC 2026 effort to integrate HPX into Compiler Explorer, we identified a specific combination of CMake flags required to produce a minimal, single-node static build suitable for sandboxed web execution. This preset encodes the exact configuration that was verified locally against HPX 2.0.0 with GCC 13.3.0 (C++20), producing all 12 expected static libraries (
libhpx_wrap.a,libhpx.a,libhpx_init.a,libhpx_core.a, etc.) and the criticalhpx/hpx_main.hppheader.Key design decisions:
HPX_WITH_MALLOC=system— Removes the tcmalloc/jemalloc dependency to reduce binary size and avoid allocator collisions in the Godbolt sandbox.HPX_WITH_NETWORKING=OFF— Godbolt is single-node; all parcelport code (MPI, LCI, libfabric, GASNet) is unnecessary.HPX_WITH_STATIC_LINKING=ON— Required by Compiler Explorer's Conan-based per-compiler binary distribution pipeline.HPX_WITH_FETCH_ASIO=ON— Auto-fetches Asio, removing one external dependency for sandboxed builders.HPX_WITH_DISTRIBUTED_RUNTIME=OFFwas deliberately NOT set to avoid theHPX_WITH_APEXconflict;HPX_WITH_NETWORKING=OFFalready disables all parcelports.This preset follows the existing conventions in CMakePresets.json (schema v4, Ninja generator, kebab-case naming,
${sourceDir}/build/<name>binary directory pattern).Checklist
HPX_WITH_TESTS=OFFin this configuration. The preset was verified by a successful local build producing all expected artifacts.I have fixed a bug and have added a regression test.— N/AI have added a test using random numbers— N/A