From 14378de2632046e504dc1ce4ad4f00a6894613b8 Mon Sep 17 00:00:00 2001 From: Chris Thrasher Date: Fri, 1 Nov 2024 14:34:32 -0600 Subject: [PATCH] Upgrade to clang-format-17 --- .github/workflows/ci.yml | 7 +++++-- CMakeLists.txt | 2 +- cmake/Format.cmake | 4 ++-- src/CSFML/Graphics/ConvertRenderStates.hpp | 12 ++++++------ 4 files changed, 14 insertions(+), 11 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 55604fd1..c5f4a65f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -74,14 +74,17 @@ jobs: format: name: Formatting - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 steps: + - name: Install Clang Format + run: sudo apt-get install clang-format-17 + - name: Checkout Code uses: actions/checkout@v4 - name: Format Code - run: cmake -DCLANG_FORMAT_EXECUTABLE=clang-format-14 -P cmake/Format.cmake + run: cmake -DCLANG_FORMAT_EXECUTABLE=clang-format-17 -P cmake/Format.cmake - name: Check Formatting run: git diff --exit-code diff --git a/CMakeLists.txt b/CMakeLists.txt index e6a8ecae..6b1c5102 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -121,7 +121,7 @@ if(CSFML_BUILD_TEST_SUITE) add_subdirectory(test) endif() -csfml_set_option(CLANG_FORMAT_EXECUTABLE clang-format STRING "Override clang-format executable, requires version 14") +csfml_set_option(CLANG_FORMAT_EXECUTABLE clang-format STRING "Override clang-format executable, requires version 17") add_custom_target(format COMMAND ${CMAKE_COMMAND} -DCLANG_FORMAT_EXECUTABLE=${CLANG_FORMAT_EXECUTABLE} -P ./cmake/Format.cmake WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} VERBATIM) diff --git a/cmake/Format.cmake b/cmake/Format.cmake index 9fcc829c..1b8b3749 100644 --- a/cmake/Format.cmake +++ b/cmake/Format.cmake @@ -13,8 +13,8 @@ endif() execute_process(COMMAND ${CLANG_FORMAT_EXECUTABLE} --version OUTPUT_VARIABLE CLANG_FORMAT_VERSION) string(REGEX MATCH "clang-format version ([0-9]+)" CLANG_FORMAT_VERSION ${CLANG_FORMAT_VERSION}) unset(CLANG_FORMAT_VERSION) -if(NOT CMAKE_MATCH_1 EQUAL 14) - message(FATAL_ERROR "clang-format version ${CMAKE_MATCH_1} not supported. Must use version 14") +if(NOT CMAKE_MATCH_1 EQUAL 17) + message(FATAL_ERROR "clang-format version ${CMAKE_MATCH_1} not supported. Must use version 17") endif() # Run diff --git a/src/CSFML/Graphics/ConvertRenderStates.hpp b/src/CSFML/Graphics/ConvertRenderStates.hpp index b23138ad..dec9e8c0 100644 --- a/src/CSFML/Graphics/ConvertRenderStates.hpp +++ b/src/CSFML/Graphics/ConvertRenderStates.hpp @@ -44,12 +44,12 @@ return {}; sf::RenderStates renderStates; - renderStates.blendMode.colorSrcFactor = static_cast(states->blendMode.colorSrcFactor); - renderStates.blendMode.colorDstFactor = static_cast(states->blendMode.colorDstFactor); - renderStates.blendMode.colorEquation = static_cast(states->blendMode.colorEquation); - renderStates.blendMode.alphaSrcFactor = static_cast(states->blendMode.alphaSrcFactor); - renderStates.blendMode.alphaDstFactor = static_cast(states->blendMode.alphaDstFactor); - renderStates.blendMode.alphaEquation = static_cast(states->blendMode.alphaEquation); + renderStates.blendMode.colorSrcFactor = static_cast(states->blendMode.colorSrcFactor); + renderStates.blendMode.colorDstFactor = static_cast(states->blendMode.colorDstFactor); + renderStates.blendMode.colorEquation = static_cast(states->blendMode.colorEquation); + renderStates.blendMode.alphaSrcFactor = static_cast(states->blendMode.alphaSrcFactor); + renderStates.blendMode.alphaDstFactor = static_cast(states->blendMode.alphaDstFactor); + renderStates.blendMode.alphaEquation = static_cast(states->blendMode.alphaEquation); renderStates.stencilMode.stencilComparison = static_cast(states->stencilMode.stencilComparison); renderStates.stencilMode.stencilUpdateOperation = static_cast( states->stencilMode.stencilUpdateOperation);