Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cmake presets #10457

Merged
merged 2 commits into from
Sep 19, 2023
Merged

Cmake presets #10457

merged 2 commits into from
Sep 19, 2023

Conversation

cmcfarlen
Copy link
Contributor

CMakePresets.json will let you configure the project with a known set of options. This can be useful for reproducing builds and should give us more outside control over CI pipeline builds.

To configure with a preset just use the --preset option to cmake and provide the name. For example, to build autests:

cmake . --preset autest
cmake --build --preset autest

You can provide a CMakeUserPresets.json file to add additional presets. This file is not to be checked in, and is included in .gitignore. Here is an example:

{
  "version": 2,
  "cmakeMinimumRequired": {
    "major": 3,
    "minor": 20,
    "patch": 0
  },
  "configurePresets": [
    {
      "name": "my-dev",
      "displayName": "my development",
      "description": "My Development Presets",
      "inherits": ["dev"],
      "cacheVariables": {
        "CMAKE_INSTALL_PREFIX": "/opt/ats-cmake",
        "jemalloc_ROOT": "/opt/homebrew"
      }
    }
  ]
}

This is like the dev preset, but changes the install prefix and the jemalloc root.

This is just to get us started. As we get closer to using cmake, I'm sure we will expand this.

@cmcfarlen
Copy link
Contributor Author

[approve ci autest]

@bryancall bryancall added the CMake work related to CMakes scripts or issues label Sep 18, 2023
@bryancall bryancall added this to the 10.0.0 milestone Sep 18, 2023
@bryancall bryancall requested a review from bneradt September 18, 2023 22:03
Copy link
Contributor

@bneradt bneradt left a comment

Choose a reason for hiding this comment

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

Look great.

I suggest adding CMAKE_COMPILE_WARNING_AS_ERROR to more configurations. Devs find it annoying if they use one of these locally and find in CI that they had some warnings they missed because they weren't treated as errors.

@cmcfarlen
Copy link
Contributor Author

Look great.

I suggest adding CMAKE_COMPILE_WARNING_AS_ERROR to more configurations. Devs find it annoying if they use one of these locally and find in CI that they had some warnings they missed because they weren't treated as errors.

With the inheritance, every preset should have this set to ON. The top level ones are default and ci

@cmcfarlen cmcfarlen requested a review from bneradt September 18, 2023 22:38
@bneradt
Copy link
Contributor

bneradt commented Sep 18, 2023

Look great.
I suggest adding CMAKE_COMPILE_WARNING_AS_ERROR to more configurations. Devs find it annoying if they use one of these locally and find in CI that they had some warnings they missed because they weren't treated as errors.

With the inheritance, every preset should have this set to ON. The top level ones are default and ci

Ah, great. Thanks.

"binaryDir": "${sourceDir}/cmake-build-${presetName}",
"generator": "Ninja",
"cacheVariables": {
"CMAKE_EXPORT_COMPILE_COMMANDS": "ON",
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice.

@cmcfarlen cmcfarlen merged commit fb1b3a1 into apache:master Sep 19, 2023
@cmcfarlen cmcfarlen deleted the cmake-presets branch September 19, 2023 00:33
cmcfarlen pushed a commit to cmcfarlen/trafficserver that referenced this pull request Jun 3, 2024
* asf/master: (30 commits)
  add conveinience function to lookup name->IntType* (apache#10474)
  cmake: bigobj subdir has executables, not plugins (apache#10481)
  cmake: compile jsonrpc_protocol with -fPIC (apache#10478)
  Make sure new metrics are always considered (apache#10445)
  Refactor and rename restart metrics (apache#10472)
  Fix the SNI and HOST parsing properly (apache#10480)
  slice/Data.h: CID 1508924: Uninitialized scalar field (apache#10470)
  CID 1508882: initialize pointer (apache#10469)
  CID-1512726: Mute coverity, use explicit check for iterator use past end (apache#10467)
  Fix Coverity issue in inliner plugin. (apache#10442)
  Set the proper variable when find_package fails to find the package (apache#10468)
  CID1508860: double lock confusion (apache#10443)
  Stop using functions that are unavailable on the latest quiche (apache#10447)
  Add allow-plain server ports attribute (apache#9574)
  [Fuzzing] move build.sh in trafficserver (apache#10466)
  Some sort of "fix" to mute coverity. (apache#10451)
  CID-1512733: Fix coverity issue (apache#10452)
  Fix cmake autooptions (apache#10456)
  Cmake presets (apache#10457)
  This fixes CID 1518257 (apache#10404)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CMake work related to CMakes scripts or issues
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants