Skip to content

Commit

Permalink
Upgrade to clang-format-17
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisThrasher committed Nov 1, 2024
1 parent 1fa7f3c commit 14378de
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 11 deletions.
7 changes: 5 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions cmake/Format.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 6 additions & 6 deletions src/CSFML/Graphics/ConvertRenderStates.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,12 @@
return {};

sf::RenderStates renderStates;
renderStates.blendMode.colorSrcFactor = static_cast<sf::BlendMode::Factor>(states->blendMode.colorSrcFactor);
renderStates.blendMode.colorDstFactor = static_cast<sf::BlendMode::Factor>(states->blendMode.colorDstFactor);
renderStates.blendMode.colorEquation = static_cast<sf::BlendMode::Equation>(states->blendMode.colorEquation);
renderStates.blendMode.alphaSrcFactor = static_cast<sf::BlendMode::Factor>(states->blendMode.alphaSrcFactor);
renderStates.blendMode.alphaDstFactor = static_cast<sf::BlendMode::Factor>(states->blendMode.alphaDstFactor);
renderStates.blendMode.alphaEquation = static_cast<sf::BlendMode::Equation>(states->blendMode.alphaEquation);
renderStates.blendMode.colorSrcFactor = static_cast<sf::BlendMode::Factor>(states->blendMode.colorSrcFactor);
renderStates.blendMode.colorDstFactor = static_cast<sf::BlendMode::Factor>(states->blendMode.colorDstFactor);
renderStates.blendMode.colorEquation = static_cast<sf::BlendMode::Equation>(states->blendMode.colorEquation);
renderStates.blendMode.alphaSrcFactor = static_cast<sf::BlendMode::Factor>(states->blendMode.alphaSrcFactor);
renderStates.blendMode.alphaDstFactor = static_cast<sf::BlendMode::Factor>(states->blendMode.alphaDstFactor);
renderStates.blendMode.alphaEquation = static_cast<sf::BlendMode::Equation>(states->blendMode.alphaEquation);
renderStates.stencilMode.stencilComparison = static_cast<sf::StencilComparison>(states->stencilMode.stencilComparison);
renderStates.stencilMode.stencilUpdateOperation = static_cast<sf::StencilUpdateOperation>(
states->stencilMode.stencilUpdateOperation);
Expand Down

0 comments on commit 14378de

Please sign in to comment.