diff --git a/pixi/run.benchmark.cmake b/pixi/run.benchmark.cmake index 643f55b..3224332 100644 --- a/pixi/run.benchmark.cmake +++ b/pixi/run.benchmark.cmake @@ -15,7 +15,10 @@ endif() set(EXAMPLES_BIN_DIR "${PROJECT_ROOT}/out/${CMAKE_BUILD_TYPE}") if(NOT EXISTS "${EXAMPLES_BIN_DIR}") - message(FATAL_ERROR "Examples binary directory not found: ${EXAMPLES_BIN_DIR}. Please build the project first.") + message( + FATAL_ERROR + "Examples binary directory not found: ${EXAMPLES_BIN_DIR}. Please build the project first." + ) endif() message(STATUS "Looking for benchmark executables in: ${EXAMPLES_BIN_DIR}") @@ -43,16 +46,13 @@ foreach(EXAMPLE_PATH ${EXAMPLE_FILES}) endif() # On Linux/macOS, check permissions or just try to run it. - + message(STATUS "-------------------------------------------------") message(STATUS "Running benchmark: ${FILENAME}") message(STATUS "-------------------------------------------------") - execute_process( - COMMAND "${EXAMPLE_PATH}" - WORKING_DIRECTORY "${PROJECT_ROOT}" - RESULT_VARIABLE EXIT_CODE - ) + execute_process(COMMAND "${EXAMPLE_PATH}" WORKING_DIRECTORY "${PROJECT_ROOT}" + RESULT_VARIABLE EXIT_CODE) if(NOT EXIT_CODE EQUAL 0) message(WARNING "Benchmark ${FILENAME} exited with error code: ${EXIT_CODE}") diff --git a/pixi/run.examples.cmake b/pixi/run.examples.cmake index 39d6308..2586c67 100644 --- a/pixi/run.examples.cmake +++ b/pixi/run.examples.cmake @@ -15,7 +15,10 @@ endif() set(EXAMPLES_BIN_DIR "${PROJECT_ROOT}/out/${CMAKE_BUILD_TYPE}") if(NOT EXISTS "${EXAMPLES_BIN_DIR}") - message(FATAL_ERROR "Examples binary directory not found: ${EXAMPLES_BIN_DIR}. Please build the project first.") + message( + FATAL_ERROR + "Examples binary directory not found: ${EXAMPLES_BIN_DIR}. Please build the project first." + ) endif() message(STATUS "Looking for example executables in: ${EXAMPLES_BIN_DIR}") @@ -43,16 +46,13 @@ foreach(EXAMPLE_PATH ${EXAMPLE_FILES}) endif() # On Linux/macOS, check permissions or just try to run it. - + message(STATUS "-------------------------------------------------") message(STATUS "Running example: ${FILENAME}") message(STATUS "-------------------------------------------------") - execute_process( - COMMAND "${EXAMPLE_PATH}" - WORKING_DIRECTORY "${PROJECT_ROOT}" - RESULT_VARIABLE EXIT_CODE - ) + execute_process(COMMAND "${EXAMPLE_PATH}" WORKING_DIRECTORY "${PROJECT_ROOT}" + RESULT_VARIABLE EXIT_CODE) if(NOT EXIT_CODE EQUAL 0) message(WARNING "Example ${FILENAME} exited with error code: ${EXIT_CODE}") diff --git a/pixi/run.unit.tests.cmake b/pixi/run.unit.tests.cmake index 36e995b..923df07 100644 --- a/pixi/run.unit.tests.cmake +++ b/pixi/run.unit.tests.cmake @@ -15,7 +15,10 @@ endif() set(EXAMPLES_BIN_DIR "${PROJECT_ROOT}/out/${CMAKE_BUILD_TYPE}") if(NOT EXISTS "${EXAMPLES_BIN_DIR}") - message(FATAL_ERROR "Examples binary directory not found: ${EXAMPLES_BIN_DIR}. Please build the project first.") + message( + FATAL_ERROR + "Examples binary directory not found: ${EXAMPLES_BIN_DIR}. Please build the project first." + ) endif() message(STATUS "Looking for unit test executables in: ${EXAMPLES_BIN_DIR}") @@ -43,16 +46,13 @@ foreach(EXAMPLE_PATH ${EXAMPLE_FILES}) endif() # On Linux/macOS, check permissions or just try to run it. - + message(STATUS "-------------------------------------------------") message(STATUS "Running unit_tests: ${FILENAME}") message(STATUS "-------------------------------------------------") - execute_process( - COMMAND "${EXAMPLE_PATH}" - WORKING_DIRECTORY "${PROJECT_ROOT}" - RESULT_VARIABLE EXIT_CODE - ) + execute_process(COMMAND "${EXAMPLE_PATH}" WORKING_DIRECTORY "${PROJECT_ROOT}" + RESULT_VARIABLE EXIT_CODE) if(NOT EXIT_CODE EQUAL 0) message(WARNING "Example ${FILENAME} exited with error code: ${EXIT_CODE}") diff --git a/scripts/cmake-format.sh b/scripts/cmake-format.sh new file mode 100644 index 0000000..d24c7b9 --- /dev/null +++ b/scripts/cmake-format.sh @@ -0,0 +1,15 @@ +#!/usr/bin/env bash +set -euo pipefail + +# Format all CMakeLists.txt and *.cmake files in the repo (excluding common build dirs) +REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" + +cd "$REPO_ROOT" + +find . \ + -path "./build" -prune -o \ + -path "./cmake-build-*" -prune -o \ + -path "./out" -prune -o \ + -path "./.git" -prune -o \ + \( -name "CMakeLists.txt" -o -name "*.cmake" \) -print0 \ +| xargs -0 cmake-format -i \ No newline at end of file