Skip to content

Commit 5760e50

Browse files
authored
Merge pull request #380 from ManifoldFR/topic/gersemi
Change CMake listfile formatting to gersemi
2 parents dc5ae75 + 885ec59 commit 5760e50

19 files changed

+519
-329
lines changed

.gersemirc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
definitions: [./CMakeLists.txt,./cmake-module,./cmake-external,./bindings,./include]
2+
line_length: 80
3+
indent: 2
4+
warn_about_unknown_commands: false

.git-blame-ignore-revs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,6 @@
33

44
# pre-commit -a
55
f9b7356675024220eefda2344dd186acd612b027
6+
7+
# pre-commit -a
8+
377ea892ac50927d59239e6c57cf0f9477d340e4

.pre-commit-config.yaml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ ci:
22
autoupdate_branch: 'devel'
33
autofix_prs: false
44
autoupdate_schedule: quarterly
5+
submodules: true
56
repos:
67
- repo: https://github.com/pre-commit/mirrors-clang-format
78
rev: v19.1.7
@@ -16,7 +17,7 @@ repos:
1617
rev: 24.10.0
1718
hooks:
1819
- id: black
19-
- repo: https://github.com/cheshirekow/cmake-format-precommit
20-
rev: v0.6.13
20+
- repo: https://github.com/BlankSpruce/gersemi
21+
rev: 0.19.0
2122
hooks:
22-
- id: cmake-format
23+
- id: gersemi

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
1111

1212
### Changed
1313
* Upgrade nanobind submodule to v2.5.0 ([#378](https://github.com/Simple-Robotics/proxsuite/pull/378))
14+
* Switch to gersemi for formatting ([#380](https://github.com/Simple-Robotics/proxsuite/pull/380))
1415

1516
## [0.7.1] - 2025-01-28
1617

CMakeLists.txt

Lines changed: 101 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -29,22 +29,24 @@ else()
2929
get_property(
3030
JRL_CMAKE_MODULES
3131
TARGET jrl-cmakemodules::jrl-cmakemodules
32-
PROPERTY INTERFACE_INCLUDE_DIRECTORIES)
32+
PROPERTY INTERFACE_INCLUDE_DIRECTORIES
33+
)
3334
message(STATUS "JRL cmakemodules found on system at ${JRL_CMAKE_MODULES}")
3435
elseif(${CMAKE_VERSION} VERSION_LESS "3.14.0")
3536
message(
3637
FATAL_ERROR
37-
"\nCan't find jrl-cmakemodules. Please either:\n"
38-
" - use git submodule: 'git submodule update --init'\n"
39-
" - or install https://github.com/jrl-umi3218/jrl-cmakemodules\n"
40-
" - or upgrade your CMake version to >= 3.14 to allow automatic fetching\n"
38+
"\nCan't find jrl-cmakemodules. Please either:\n"
39+
" - use git submodule: 'git submodule update --init'\n"
40+
" - or install https://github.com/jrl-umi3218/jrl-cmakemodules\n"
41+
" - or upgrade your CMake version to >= 3.14 to allow automatic fetching\n"
4142
)
4243
else()
4344
message(STATUS "JRL cmakemodules not found. Let's fetch it.")
4445
include(FetchContent)
4546
FetchContent_Declare(
4647
"jrl-cmakemodules"
47-
GIT_REPOSITORY "https://github.com/jrl-umi3218/jrl-cmakemodules.git")
48+
GIT_REPOSITORY "https://github.com/jrl-umi3218/jrl-cmakemodules.git"
49+
)
4850
FetchContent_MakeAvailable("jrl-cmakemodules")
4951
FetchContent_GetProperties("jrl-cmakemodules" SOURCE_DIR JRL_CMAKE_MODULES)
5052
endif()
@@ -76,51 +78,79 @@ if(POLICY CMP0177)
7678
set(CMAKE_POLICY_DEFAULT_CMP0177 NEW)
7779
endif()
7880
include(${JRL_CMAKE_MODULES}/base.cmake)
79-
compute_project_args(PROJECT_ARGS LANGUAGES CXX)
81+
COMPUTE_PROJECT_ARGS(PROJECT_ARGS LANGUAGES CXX)
8082
project(${PROJECT_NAME} ${PROJECT_ARGS})
8183

8284
include(${JRL_CMAKE_MODULES}/ide.cmake)
8385
include(${JRL_CMAKE_MODULES}/apple.cmake)
8486

8587
if(NOT ${CMAKE_VERSION} VERSION_GREATER "3.26.0" OR WIN32)
86-
set(CMAKE_MODULE_PATH ${JRL_CMAKE_MODULES}/find-external/OpenMP
87-
${CMAKE_MODULE_PATH})
88+
set(
89+
CMAKE_MODULE_PATH
90+
${JRL_CMAKE_MODULES}/find-external/OpenMP
91+
${CMAKE_MODULE_PATH}
92+
)
8893
endif()
8994
include(${JRL_CMAKE_MODULES}/julia.cmake)
9095
include(CMakeDependentOption)
9196

9297
# If needed, set CMake policy for APPLE systems
93-
apply_default_apple_configuration()
94-
set_default_cmake_build_type(Release)
98+
APPLY_DEFAULT_APPLE_CONFIGURATION()
99+
SET_DEFAULT_CMAKE_BUILD_TYPE(Release)
95100

96101
option(BUILD_PYTHON_INTERFACE "Build the Python bindings" OFF)
97102
option(INITIALIZE_EIGEN_WITH_NAN "Initialize Eigen objects with NAN values" OFF)
98-
option(CHECK_RUNTIME_MALLOC
99-
"Check if some memory allocations are performed at runtime" OFF)
103+
option(
104+
CHECK_RUNTIME_MALLOC
105+
"Check if some memory allocations are performed at runtime"
106+
OFF
107+
)
100108
option(SUFFIX_SO_VERSION "Suffix library name with its version" ON)
101109

102-
option(BUILD_WITH_VECTORIZATION_SUPPORT
103-
"Build the library with the support of modern SIMD instructions." ON)
104-
option(BUILD_BINDINGS_WITH_AVX2_SUPPORT "Build the bindings with AVX2 support."
105-
ON)
106-
option(BUILD_BINDINGS_WITH_AVX512_SUPPORT
107-
"Build the bindings with AVX512 support." ON)
110+
option(
111+
BUILD_WITH_VECTORIZATION_SUPPORT
112+
"Build the library with the support of modern SIMD instructions."
113+
ON
114+
)
115+
option(
116+
BUILD_BINDINGS_WITH_AVX2_SUPPORT
117+
"Build the bindings with AVX2 support."
118+
ON
119+
)
120+
option(
121+
BUILD_BINDINGS_WITH_AVX512_SUPPORT
122+
"Build the bindings with AVX512 support."
123+
ON
124+
)
108125
option(TEST_JULIA_INTERFACE "Run the julia examples as unittest" OFF)
109-
option(BUILD_WITH_OPENMP_SUPPORT "Build the library with the OpenMP support"
110-
OFF)
126+
option(
127+
BUILD_WITH_OPENMP_SUPPORT
128+
"Build the library with the OpenMP support"
129+
OFF
130+
)
111131
cmake_dependent_option(
112-
LINK_PYTHON_INTERFACE_TO_OPENMP "Link OpenMP to the Python interface" ON
113-
BUILD_WITH_OPENMP_SUPPORT OFF)
132+
LINK_PYTHON_INTERFACE_TO_OPENMP
133+
"Link OpenMP to the Python interface"
134+
ON
135+
BUILD_WITH_OPENMP_SUPPORT
136+
OFF
137+
)
114138

115139
if(BUILD_WITH_OPENMP_SUPPORT)
116140
find_package(OpenMP REQUIRED)
117141
separate_arguments(OpenMP_CXX_FLAGS UNIX_COMMAND "${OpenMP_CXX_FLAGS}")
118142
endif(BUILD_WITH_OPENMP_SUPPORT)
119143

120-
set(CMAKE_MODULE_PATH "${JRL_CMAKE_MODULES}/find-external/Julia"
121-
${CMAKE_MODULE_PATH})
122-
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake-external"
123-
${CMAKE_MODULE_PATH})
144+
set(
145+
CMAKE_MODULE_PATH
146+
"${JRL_CMAKE_MODULES}/find-external/Julia"
147+
${CMAKE_MODULE_PATH}
148+
)
149+
set(
150+
CMAKE_MODULE_PATH
151+
"${CMAKE_CURRENT_LIST_DIR}/cmake-external"
152+
${CMAKE_MODULE_PATH}
153+
)
124154

125155
message(STATUS "CMAKE_SYSTEM_PROCESSOR: ${CMAKE_SYSTEM_PROCESSOR}")
126156
if(INITIALIZE_EIGEN_WITH_NAN)
@@ -134,7 +164,7 @@ endif(CHECK_RUNTIME_MALLOC)
134164

135165
# set CXX standard
136166
if(DEFINED CMAKE_CXX_STANDARD)
137-
check_minimal_cxx_standard(14 ENFORCE)
167+
CHECK_MINIMAL_CXX_STANDARD(14 ENFORCE)
138168
else()
139169
set(CMAKE_CXX_STANDARD 17)
140170
endif()
@@ -147,14 +177,19 @@ if(MSVC)
147177
endif()
148178

149179
# Look for dependencies
150-
add_project_dependency(Eigen3 REQUIRED PKG_CONFIG_REQUIRES "eigen3 >= 3.0.5")
180+
ADD_PROJECT_DEPENDENCY(Eigen3 REQUIRED PKG_CONFIG_REQUIRES "eigen3 >= 3.0.5")
151181

152-
set(SIMDE_HINT_FAILURE
153-
"Set BUILD_WITH_VECTORIZATION_SUPPORT=OFF or install Simde on your system.\n If Simde is already installed, ensure that the CMake variable CMAKE_MODULE_PATH correctly points toward the location of FindSimde.cmake file."
182+
set(
183+
SIMDE_HINT_FAILURE
184+
"Set BUILD_WITH_VECTORIZATION_SUPPORT=OFF or install Simde on your system.\n If Simde is already installed, ensure that the CMake variable CMAKE_MODULE_PATH correctly points toward the location of FindSimde.cmake file."
154185
)
155186
if(BUILD_WITH_VECTORIZATION_SUPPORT)
156-
add_project_dependency(Simde REQUIRED FIND_EXTERNAL "Simde"
157-
PKG_CONFIG_REQUIRES "simde")
187+
ADD_PROJECT_DEPENDENCY(
188+
Simde
189+
REQUIRED
190+
FIND_EXTERNAL "Simde"
191+
PKG_CONFIG_REQUIRES "simde"
192+
)
158193
endif()
159194

160195
# Build the main library
@@ -165,29 +200,25 @@ if(MSVC)
165200
target_compile_options(proxsuite INTERFACE /permissive-)
166201
target_compile_options(proxsuite INTERFACE $<$<COMPILE_LANGUAGE:CXX>:/bigobj>)
167202
endif(MSVC)
168-
target_link_libraries(
169-
proxsuite
170-
PUBLIC
171-
INTERFACE Eigen3::Eigen)
203+
target_link_libraries(proxsuite PUBLIC INTERFACE Eigen3::Eigen)
172204
target_include_directories(
173-
proxsuite INTERFACE "$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/include>"
174-
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>")
205+
proxsuite
206+
INTERFACE
207+
"$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/include>"
208+
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>"
209+
)
175210
target_include_directories(
176-
proxsuite INTERFACE "$<BUILD_INTERFACE:${PROJECT_BINARY_DIR}/include>")
211+
proxsuite
212+
INTERFACE "$<BUILD_INTERFACE:${PROJECT_BINARY_DIR}/include>"
213+
)
177214
set(EXPORTED_TARGETS_LIST proxsuite)
178215

179-
add_header_group(${PROJECT_NAME}_HEADERS)
216+
ADD_HEADER_GROUP(${PROJECT_NAME}_HEADERS)
180217

181218
if(BUILD_WITH_VECTORIZATION_SUPPORT)
182219
add_library(proxsuite-vectorized INTERFACE)
183-
target_link_libraries(
184-
proxsuite-vectorized
185-
PUBLIC
186-
INTERFACE proxsuite)
187-
target_link_libraries(
188-
proxsuite-vectorized
189-
PUBLIC
190-
INTERFACE simde)
220+
target_link_libraries(proxsuite-vectorized PUBLIC INTERFACE proxsuite)
221+
target_link_libraries(proxsuite-vectorized PUBLIC INTERFACE simde)
191222
target_compile_definitions(proxsuite-vectorized INTERFACE PROXSUITE_VECTORIZE)
192223
list(APPEND EXPORTED_TARGETS_LIST proxsuite-vectorized)
193224
endif()
@@ -202,7 +233,9 @@ if(BUILD_TESTING OR BUILD_PYTHON_INTERFACE)
202233
if(NOT EXISTS ${cereal})
203234
execute_process(
204235
COMMAND ${GIT_EXECUTABLE} submodule update --init ${cereal_dir}
205-
WORKING_DIRECTORY ${cereal_dir} COMMAND_ERROR_IS_FATAL ANY)
236+
WORKING_DIRECTORY ${cereal_dir}
237+
COMMAND_ERROR_IS_FATAL ANY
238+
)
206239
endif()
207240
endif()
208241
endif()
@@ -213,7 +246,8 @@ if(NOT PROXSUITE_AS_SUBPROJECT)
213246
EXPORT ${TARGETS_EXPORT_NAME}
214247
LIBRARY DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR}
215248
ARCHIVE DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR}
216-
RUNTIME DESTINATION ${CMAKE_INSTALL_FULL_BINDIR})
249+
RUNTIME DESTINATION ${CMAKE_INSTALL_FULL_BINDIR}
250+
)
217251
endif(NOT PROXSUITE_AS_SUBPROJECT)
218252

219253
add_subdirectory(bindings)
@@ -230,26 +264,33 @@ install(FILES package.xml DESTINATION share/${PROJECT_NAME})
230264
file(
231265
WRITE
232266
${CMAKE_CURRENT_BINARY_DIR}/share/ament_index/resource_index/packages/${PROJECT_NAME}
233-
"")
267+
""
268+
)
234269
install(
235270
FILES
236271
${CMAKE_CURRENT_BINARY_DIR}/share/ament_index/resource_index/packages/${PROJECT_NAME}
237-
DESTINATION share/ament_index/resource_index/packages)
272+
DESTINATION share/ament_index/resource_index/packages
273+
)
238274
file(
239275
WRITE
240276
${CMAKE_CURRENT_BINARY_DIR}/share/${PROJECT_NAME}/hook/ament_prefix_path.dsv
241-
"prepend-non-duplicate;AMENT_PREFIX_PATH;")
277+
"prepend-non-duplicate;AMENT_PREFIX_PATH;"
278+
)
242279
install(
243280
FILES
244281
${CMAKE_CURRENT_BINARY_DIR}/share/${PROJECT_NAME}/hook/ament_prefix_path.dsv
245-
DESTINATION share/${PROJECT_NAME}/hook)
282+
DESTINATION share/${PROJECT_NAME}/hook
283+
)
246284
if(BUILD_PYTHON_INTERFACE)
247-
file(WRITE
248-
${CMAKE_CURRENT_BINARY_DIR}/share/${PROJECT_NAME}/hook/python_path.dsv
249-
"prepend-non-duplicate;PYTHONPATH;${PYTHON_SITELIB}")
285+
file(
286+
WRITE
287+
${CMAKE_CURRENT_BINARY_DIR}/share/${PROJECT_NAME}/hook/python_path.dsv
288+
"prepend-non-duplicate;PYTHONPATH;${PYTHON_SITELIB}"
289+
)
250290
install(
251291
FILES ${CMAKE_CURRENT_BINARY_DIR}/share/${PROJECT_NAME}/hook/python_path.dsv
252-
DESTINATION share/${PROJECT_NAME}/hook)
292+
DESTINATION share/${PROJECT_NAME}/hook
293+
)
253294
endif(BUILD_PYTHON_INTERFACE)
254295

255-
setup_project_finalize()
296+
SETUP_PROJECT_FINALIZE()

0 commit comments

Comments
 (0)