2016-11-03 08:06:33 -04:00
|
|
|
#
|
|
|
|
# Custom targets
|
|
|
|
#
|
|
|
|
|
|
|
|
# Target: uninstall {{{
|
|
|
|
|
|
|
|
configure_file(
|
|
|
|
${PROJECT_SOURCE_DIR}/cmake/templates/uninstall.cmake.in
|
2016-11-19 00:22:44 -05:00
|
|
|
${PROJECT_BINARY_DIR}/cmake/uninstall.cmake
|
2017-01-25 17:28:25 -05:00
|
|
|
ESCAPE_QUOTES @ONLY)
|
2016-11-03 08:06:33 -04:00
|
|
|
|
2017-01-25 17:28:25 -05:00
|
|
|
add_custom_target(uninstall
|
|
|
|
COMMAND ${CMAKE_COMMAND} -P ${PROJECT_BINARY_DIR}/cmake/uninstall.cmake)
|
2016-11-03 08:06:33 -04:00
|
|
|
|
|
|
|
# }}}
|
2018-05-01 11:49:22 -04:00
|
|
|
|
|
|
|
# folders where the clang tools should operate
|
|
|
|
set(CLANG_SEARCH_PATHS ${PROJECT_SOURCE_DIR}/src ${PROJECT_SOURCE_DIR}/include ${PROJECT_SOURCE_DIR}/tests)
|
|
|
|
|
2022-09-27 17:42:29 -04:00
|
|
|
# Runs clang-format on all source files
|
|
|
|
add_custom_target(
|
|
|
|
clangformat
|
|
|
|
COMMAND ${PROJECT_SOURCE_DIR}/common/file-runner.py
|
|
|
|
--dirs ${CLANG_SEARCH_PATHS}
|
|
|
|
-- clang-format -style=file -i --verbose
|
|
|
|
)
|
|
|
|
|
|
|
|
# Dry-runs clang-format on all source files
|
|
|
|
# Useful for CI since it will exit with an error code
|
|
|
|
add_custom_target(
|
|
|
|
clangformat-dryrun
|
|
|
|
COMMAND ${PROJECT_SOURCE_DIR}/common/file-runner.py
|
|
|
|
--dirs ${CLANG_SEARCH_PATHS}
|
|
|
|
-- clang-format -style=file --dry-run -Werror --verbose
|
|
|
|
)
|
2016-11-03 08:06:33 -04:00
|
|
|
|
2016-11-25 05:49:37 -05:00
|
|
|
# Target: codecheck (clang-tidy) {{{
|
2016-11-03 08:06:33 -04:00
|
|
|
|
2016-11-25 05:49:37 -05:00
|
|
|
add_custom_target(codecheck)
|
2017-01-25 17:28:25 -05:00
|
|
|
add_custom_command(TARGET codecheck
|
|
|
|
COMMAND ${PROJECT_SOURCE_DIR}/common/clang-tidy.sh
|
2018-05-01 11:49:22 -04:00
|
|
|
${PROJECT_BINARY_DIR} ${CLANG_SEARCH_PATHS})
|
2016-11-03 08:06:33 -04:00
|
|
|
|
|
|
|
# }}}
|
2016-11-25 05:49:37 -05:00
|
|
|
# Target: codecheck-fix (clang-tidy + clang-format) {{{
|
|
|
|
|
|
|
|
add_custom_target(codecheck-fix)
|
2017-01-25 17:28:25 -05:00
|
|
|
add_custom_command(TARGET codecheck-fix
|
|
|
|
COMMAND ${PROJECT_SOURCE_DIR}/common/clang-tidy.sh
|
2018-05-01 11:49:22 -04:00
|
|
|
${PROJECT_BINARY_DIR} -fix ${CLANG_SEARCH_PATHS})
|
2016-11-03 08:06:33 -04:00
|
|
|
|
|
|
|
# }}}
|
2016-12-13 23:07:42 -05:00
|
|
|
|
|
|
|
# Target: memcheck (valgrind) {{{
|
|
|
|
|
|
|
|
add_custom_target(memcheck)
|
2017-01-25 17:28:25 -05:00
|
|
|
add_custom_command(TARGET memcheck
|
|
|
|
COMMAND valgrind
|
2016-12-14 09:11:37 -05:00
|
|
|
--leak-check=summary
|
|
|
|
--suppressions=${PROJECT_SOURCE_DIR}/.valgrind-suppressions
|
2017-01-25 17:28:25 -05:00
|
|
|
${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_BINDIR}/${PROJECT_NAME}
|
|
|
|
example --config=${PROJECT_SOURCE_DIR}/doc/config)
|
2016-12-14 09:11:37 -05:00
|
|
|
|
|
|
|
add_custom_target(memcheck-full)
|
2017-01-25 17:28:25 -05:00
|
|
|
add_custom_command(TARGET memcheck-full
|
|
|
|
COMMAND valgrind
|
2016-12-14 09:11:37 -05:00
|
|
|
--leak-check=full
|
2016-12-13 23:07:42 -05:00
|
|
|
--track-origins=yes
|
2016-12-14 09:11:37 -05:00
|
|
|
--track-fds=yes
|
2016-12-13 23:07:42 -05:00
|
|
|
--suppressions=${PROJECT_SOURCE_DIR}/.valgrind-suppressions
|
2017-01-25 17:28:25 -05:00
|
|
|
${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_BINDIR}/${PROJECT_NAME}
|
|
|
|
example --config=${PROJECT_SOURCE_DIR}/doc/config)
|
2016-12-13 23:07:42 -05:00
|
|
|
|
|
|
|
# }}}
|