build: Add more cmake presets #30871

pull sipa wants to merge 1 commits into bitcoin:master from sipa:202409_cmake_presets changing 2 files +64 −10
  1. sipa commented at 2:32 pm on September 11, 2024: member

    Add three more cmake presets to the project-wide CMakePresets.json file:

    • dev-mode: enables all features and dependencies
    • libfuzzer: builds for fuzzing with libfuzzer and the typical sanitizers (but not the optional ones that require suppressions) enabled.
    • libfuzzer-nosan: builds for fuzzing with libfuzzer and no (other) sanitizers

    … and then uses these in some documentation.

  2. DrahtBot commented at 2:32 pm on September 11, 2024: contributor

    The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

    Code Coverage

    For detailed information about the code coverage, see the test coverage report.

    Reviews

    See the guideline for information on the review process.

    Type Reviewers
    ACK ryanofsky, TheCharlatan
    Concept ACK ismaelsadeeq
    Stale ACK maflcko

    If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update.

  3. sipa force-pushed on Sep 11, 2024
  4. ismaelsadeeq commented at 2:39 pm on September 11, 2024: member
    Concept ACK
  5. in doc/fuzzing.md:10 in a5ad693db5 outdated
     6@@ -7,11 +7,7 @@ To quickly get started fuzzing Bitcoin Core using [libFuzzer](https://llvm.org/d
     7 ```sh
     8 $ git clone https://github.com/bitcoin/bitcoin
     9 $ cd bitcoin/
    10-$ cmake -B build_fuzz \
    11-   -DCMAKE_C_COMPILER="clang" \
    12-   -DCMAKE_CXX_COMPILER="clang++" \
    13-   -DBUILD_FOR_FUZZING=ON \
    14-   -DSANITIZERS=undefined,address,fuzzer
    15+$ cmake --preset=libfuzzer
    


    instagibbs commented at 2:41 pm on September 11, 2024:
    -nosan option imo is worth noting directly here since it’s slightly less clear what I could remove to make things faster

    sipa commented at 3:04 pm on September 11, 2024:
    Done.
  6. sipa force-pushed on Sep 11, 2024
  7. DrahtBot added the label CI failed on Sep 11, 2024
  8. fanquake commented at 3:34 pm on September 11, 2024: member

    And then uses these … in CI.

    I’m not sure about doing this. At least, not if it’s going to use the same presets as the “general” dev presets. Then we’ve spread the CI config into 2 different places, made it harder to change the CI (as that might break/make the preset less useful for devs), and opened ourselves up to changes in the presets (silently) breaking the CI. i.e devs decide they no-longer want BUILD_GUI_TESTS in the preset, that gets removed, and the CI silently stops running the GUI tests. I think if we want to use presets in the CI, they should encapsulate all config, and exist under /ci/.

  9. in CMakePresets.json:92 in de5ed6bf51 outdated
    87+        "WITH_MINIUPNPC": "ON",
    88+        "WITH_MULTIPROCESS": "ON",
    89+        "WITH_NATPMP": "ON",
    90+        "WITH_QRENCODE": "ON",
    91+        "WITH_SQLITE": "ON",
    92+        "WITH_USDT": "ON",
    


    fanquake commented at 3:36 pm on September 11, 2024:

    “WITH_USDT”: “ON”,

    Something to keep in mind with a generic “dev mode”, is that this wont work for all devs. i.e WITH_USDT=ON will always fail to configure for devs building on macOS, trying to use this preset.


    sipa commented at 3:47 pm on September 11, 2024:
    @fanquake That’s deliberate; the goal is enabling everything by default in this preset, so that one cannot accidentally miss a dependency/feature. If you’re knowingly on an environment where one or more things don’t work they can be disabled explicitly with -DWITH_USDT=OFF still together with the preset.
  10. hebasto commented at 3:40 pm on September 11, 2024: member

    I think if we want to use presets in the CI, they should encapsulate all config, and exist under /ci/.

    From https://cmake.org/cmake/help/latest/manual/cmake-presets.7.html:

    CMakePresets.json and CMakeUserPresets.json live in the project’s root directory.

  11. maflcko commented at 3:44 pm on September 11, 2024: member
    The CI fails, because the ci/test/03_test_script.sh script does not set the build dir, but uses cd to navigate to it and set it implicitly. With a preset build dir, this will fail. A fix would have to make the ci build dir explicit, or remove the preset build dir.
  12. sipa force-pushed on Sep 11, 2024
  13. fanquake commented at 3:50 pm on September 11, 2024: member

    From https://cmake.org/cmake/help/latest/manual/cmake-presets.7.html: CMakePresets.json and CMakeUserPresets.json live in the project’s root directory.

    Ok? We can put files where ever we want and just include them. i.e:

    0  "include": [
    1    "ci/ci_presets.json"
    2  ],
    
  14. sipa commented at 3:50 pm on September 11, 2024: member
    @fanquake I’ve dropped the CI changes, as they’re not really the main thing I want to achieve here. I do think there is value in reducing duplication of some groups of settings, but that can be discussed separately (or perhaps after our cmake presets have had some evolution and considered more stable - I assume these aren’t the only ones we’ll be adding).
  15. hebasto commented at 3:54 pm on September 11, 2024: member

    From https://cmake.org/cmake/help/latest/manual/cmake-presets.7.html: CMakePresets.json and CMakeUserPresets.json live in the project’s root directory.

    Ok? We can put files where ever we want and just include them. i.e:

    0  "include": [
    1    "ci/ci_presets.json"
    2  ],
    

    Which in turn requires CMake >= 3.23.

  16. maflcko commented at 4:48 pm on September 11, 2024: member

    review ACK 1171871f63261e0c06d34baf216a54bfa747d75f

    Seems fine to add recommended presets for common stuff like development or fuzzing.

    Nit: Add build: prefix to pull request title and remove “CI” mention from the pull request description?

  17. DrahtBot requested review from ismaelsadeeq on Sep 11, 2024
  18. build: add more CMake presets (dev-mode, libfuzzer, libfuzzer-nosan) f15e817811
  19. sipa force-pushed on Sep 11, 2024
  20. sipa commented at 4:53 pm on September 11, 2024: member

    Nit: Add build: prefix to pull request title and remove “CI” mention from the pull request description?

    Done.

  21. DrahtBot renamed this:
    Add more cmake presets
    build: Add more cmake presets
    on Sep 11, 2024
  22. ryanofsky approved
  23. ryanofsky commented at 5:08 pm on September 11, 2024: contributor

    Code review ACK f15e817811e328423ea489870ead089128a6ef8c. This change is much needed to simplify my command line.

    Could consider the name “all” or “enable-all” for the preset, and “build_all” for the directory name, but current “dev-mode” and “build_dev_mode” also seems ok.

  24. DrahtBot requested review from maflcko on Sep 11, 2024
  25. sipa commented at 5:14 pm on September 11, 2024: member
    @ryanofsky I picked the name to match the same thing in libsecp256k1, but I’m okay with “enable-all” or “all” as well.
  26. TheCharlatan approved
  27. TheCharlatan commented at 9:30 pm on September 11, 2024: contributor
    ACK f15e817811e328423ea489870ead089128a6ef8c
  28. fanquake merged this on Sep 12, 2024
  29. fanquake closed this on Sep 12, 2024


github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2024-09-29 01:12 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me