Skip to content

Commit

Permalink
Try gersemi automatic CMake formatter
Browse files Browse the repository at this point in the history
This is the result of running the gersemi CMake automatic formatter
(https://github.com/BlankSpruce/gersemi) on our CMake files with
the following settings:

gersemi -i  --indent 2 -l 120 --no-warn-about-unknown-commands
  • Loading branch information
starseeker committed Oct 3, 2024
1 parent beb8a94 commit ef4b2a9
Show file tree
Hide file tree
Showing 617 changed files with 12,440 additions and 11,246 deletions.
1,552 changes: 844 additions & 708 deletions CMakeLists.txt

Large diffs are not rendered by default.

85 changes: 51 additions & 34 deletions bench/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,79 +2,96 @@ add_subdirectory(ref)

add_definitions(-DCONSOLE)

BRLCAD_ADDEXEC(pixcmp pixcmp.c libbu)
set(BARK_SOURCES
benchmark.c
compute.c
run.c
clean.c
)
BRLCAD_ADDEXEC(bark "${BARK_SOURCES}" libbu NO_STRICT NO_INSTALL TEST_USESDATA)
brlcad_addexec(pixcmp pixcmp.c libbu)
set(BARK_SOURCES benchmark.c compute.c run.c clean.c)
brlcad_addexec(bark "${BARK_SOURCES}" libbu NO_STRICT NO_INSTALL TEST_USESDATA)

if (BUILD_TESTING)
if(BUILD_TESTING)
configure_file(run.sh "${CMAKE_CURRENT_BINARY_DIR}/benchmark" COPYONLY)
install(PROGRAMS "${CMAKE_CURRENT_BINARY_DIR}/benchmark" DESTINATION ${BIN_DIR})
endif (BUILD_TESTING)
DISTCLEAN("${CMAKE_CURRENT_BINARY_DIR}/benchmark")
endif(BUILD_TESTING)
distclean("${CMAKE_CURRENT_BINARY_DIR}/benchmark")

if (BUILD_TESTING)
if(BUILD_TESTING)
# TODO - with CMake 3.20, add_custom_command supports generator expressions in
# OUTPUT, so once we can require that version we should look at retiring this
# use of CMAKE_CFG_INTDIR
add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/benchmark-${CMAKE_CFG_INTDIR}-done
COMMAND "${CMAKE_COMMAND}" -E copy_if_different ${CMAKE_CURRENT_SOURCE_DIR}/run.sh $<TARGET_FILE_DIR:bark>/benchmark
COMMAND "${CMAKE_COMMAND}" -E touch ${CMAKE_CURRENT_BINARY_DIR}/benchmark-${CMAKE_CFG_INTDIR}-done
COMMAND "${CMAKE_COMMAND}" -E touch ${CMAKE_CURRENT_BINARY_DIR}/benchmark-${CMAKE_CFG_INTDIR}-done
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/run.sh
)
)
add_custom_target(benchmark_cp ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/benchmark-${CMAKE_CFG_INTDIR}-done)
set_target_properties(benchmark_cp PROPERTIES FOLDER "Benchmark")
endif (BUILD_TESTING)
DISTCLEAN(${CMAKE_BINARY_DIR}/${BIN_DIR}/benchmark)
endif(BUILD_TESTING)
distclean(${CMAKE_BINARY_DIR}/${BIN_DIR}/benchmark)

file(WRITE "${CMAKE_BINARY_DIR}/CMakeTmp/benchmsg.cmake" "message(\"---\")\n")
file(APPEND "${CMAKE_BINARY_DIR}/CMakeTmp/benchmsg.cmake" "message(\"Run 'make benchmark-clean' in the bench directory to delete the logic\")\n")
file(APPEND "${CMAKE_BINARY_DIR}/CMakeTmp/benchmsg.cmake" "message(\"and image files generated during the benchmark analysis.\")\n")
file(WRITE "${CMAKE_BINARY_DIR}/CMakeTmp/benchmsg.cmake" "message(\"---\")\n")
file(
APPEND
"${CMAKE_BINARY_DIR}/CMakeTmp/benchmsg.cmake"
"message(\"Run 'make benchmark-clean' in the bench directory to delete the logic\")\n"
)
file(
APPEND
"${CMAKE_BINARY_DIR}/CMakeTmp/benchmsg.cmake"
"message(\"and image files generated during the benchmark analysis.\")\n"
)

CMAKEFILES(
cmakefiles(
CMakeLists.txt
lgt.sh
run.sh
try.sh
viewdiff.sh
)
)

if(SH_EXEC AND TARGET m35.g AND BUILD_TESTING)
# CTest enabled short run of the benchmark suite
BRLCAD_ADD_TEST(NAME benchmark COMMAND ${SH_EXEC} "$<TARGET_FILE_DIR:bark>/benchmark" run TIMEFRAME=1)
brlcad_add_test(NAME benchmark COMMAND ${SH_EXEC} "$<TARGET_FILE_DIR:bark>/benchmark" run TIMEFRAME=1)
set_tests_properties(benchmark PROPERTIES LABELS "Benchmark")
add_custom_target(benchmark-check
add_custom_target(
benchmark-check
COMMAND ${CMAKE_CTEST_COMMAND} -L Benchmark --output-on-failure
DEPENDS rt pixcmp BENCHMARK_PIX_cp PIX_LOG_cp benchmark_cp
)
add_dependencies(benchmark-check bldg391.g m35.g moss.g sphflake.g star.g world.g)
)
add_dependencies(
benchmark-check
bldg391.g
m35.g
moss.g
sphflake.g
star.g
world.g
)
set_target_properties(benchmark-check PROPERTIES FOLDER "Benchmark")
if(TARGET check)
add_dependencies(check benchmark-check)
endif(TARGET check)

# Full run of the benchmark suite
add_custom_target(benchmark
add_custom_target(
benchmark
COMMAND ${SH_EXEC} $<TARGET_FILE_DIR:bark>/benchmark run
COMMAND ${CMAKE_COMMAND} -P "${CMAKE_BINARY_DIR}/CMakeTmp/benchmsg.cmake"
DEPENDS rt pixcmp BENCHMARK_PIX_cp PIX_LOG_cp benchmark_cp
)
add_dependencies(benchmark bldg391.g m35.g moss.g sphflake.g star.g world.g)
)
add_dependencies(
benchmark
bldg391.g
m35.g
moss.g
sphflake.g
star.g
world.g
)
set_target_properties(benchmark PROPERTIES FOLDER "Benchmark")

# benchmark cleanup targets
add_custom_target(benchmark-clean
${SH_EXEC} ${CMAKE_BINARY_DIR}/bin/benchmark clean
)
add_custom_target(benchmark-clean ${SH_EXEC} ${CMAKE_BINARY_DIR}/bin/benchmark clean)
set_target_properties(benchmark-clean PROPERTIES FOLDER "Benchmark")
add_custom_target(benchmark-clobber
${SH_EXEC} ${CMAKE_BINARY_DIR}/bin/benchmark clobber
)
add_custom_target(benchmark-clobber ${SH_EXEC} ${CMAKE_BINARY_DIR}/bin/benchmark clobber)
set_target_properties(benchmark-clobber PROPERTIES FOLDER "Benchmark")
endif(SH_EXEC AND TARGET m35.g AND BUILD_TESTING)

Expand Down
21 changes: 11 additions & 10 deletions bench/ref/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,28 +1,29 @@
set(BENCHMARK_PIX
set(
BENCHMARK_PIX
bldg391.pix
m35.pix
moss.pix
sphflake.pix
star.pix
world.pix
)
)


set(PIX_LOG
set(
PIX_LOG
bldg391.log
m35.log
moss.log
sphflake.log
star.log
world.log
)
)

BRLCAD_ADDDATA(BENCHMARK_PIX pix)
BRLCAD_ADDDATA(PIX_LOG pix)
brlcad_adddata(BENCHMARK_PIX pix)
brlcad_adddata(PIX_LOG pix)

CMAKEFILES(${BENCHMARK_PIX})
CMAKEFILES(${PIX_LOG})
CMAKEFILES(CMakeLists.txt)
cmakefiles(${BENCHMARK_PIX})
cmakefiles(${PIX_LOG})
cmakefiles(CMakeLists.txt)

# Local Variables:
# tab-width: 8
Expand Down
Loading

0 comments on commit ef4b2a9

Please sign in to comment.