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

Enforce standard cmake formatting with cmake-format #710

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions .cmake-format.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# A python-style configuration file for cmake-format
# See their documentation for more information:
# https://cmake-format.readthedocs.io/en/latest/configuration.html
#
# For info on how to run cmake-format, see CONTRIBUTING.md

# ------------------------------------------------
# Options affecting comment reflow and formatting.
# ------------------------------------------------
with section("markup"):

# If comment markup is enabled, don't reflow any comment block which matches
# this (regex) pattern. Default is `None` (disabled).
#
# An empty regex is used to match all comments, and disable comment reflow
literal_comment_pattern = ''
23 changes: 19 additions & 4 deletions .github/workflows/compilation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,21 @@ jobs:
run: |
fdfind . -e .c -e .h -X clang-format-${{ env.clang-format-version }} --dry-run --Werror

cmake-formatting-check:
name: CMake Formatting Check
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- name: Install cmake-format and fd-find
run: |
sudo apt-get update
sudo apt-get -y install cmake-format fd-find
- name: Check cmake-format
run: |
fdfind . -e cmake . -X cmake-format '{}' --in-place --config-files .cmake-format.py
fdfind CMakeLists.txt . -X cmake-format '{}' --in-place --config-files .cmake-format.py
git --no-pager diff --exit-code

# Run unittests on modern-ish versions of gcc and clang.
# -----------------------------------------------------------------------------------------------
unittest:
Expand Down Expand Up @@ -75,7 +90,7 @@ jobs:
# Build windows package, release artifact (MSVC)
# -----------------------------------------------------------------------------------------------
build_msvc:
needs: [unittest, formatting-check]
needs: [unittest, formatting-check, cmake-formatting-check]

name: Build windows-amd64 (MSVC)
runs-on: windows-latest
Expand Down Expand Up @@ -157,7 +172,7 @@ jobs:
# Build ubuntu package, release artifact
# -----------------------------------------------------------------------------------------------
build_ubuntu:
needs: [unittest, formatting-check]
needs: [unittest, formatting-check, cmake-formatting-check]

name: Build ubuntu-latest
runs-on: ubuntu-latest
Expand Down Expand Up @@ -237,7 +252,7 @@ jobs:
# Build macos package, release artifact
# -----------------------------------------------------------------------------------------------
build_macos-arm:
needs: [unittest, formatting-check]
needs: [unittest, formatting-check, cmake-formatting-check]

name: Build macos-14
runs-on: macos-14
Expand Down Expand Up @@ -297,7 +312,7 @@ jobs:
# Build windows package, release artifact (mingw-w64)
# -----------------------------------------------------------------------------------------------
build_windows:
needs: [unittest, formatting-check]
needs: [unittest, formatting-check, cmake-formatting-check]

name: Build windows-amd64 (mingw-w64)
runs-on: ubuntu-latest
Expand Down
Loading
Loading