From c485dbf7bbfbdab8cfa5afda604f135179dcb026 Mon Sep 17 00:00:00 2001 From: Abdessattar Sassi <457645+abdes@users.noreply.github.com> Date: Mon, 21 Oct 2024 16:51:41 +0400 Subject: [PATCH] style: fix formatting / eol issues --- .clangd.in | 2 +- .commitlintrc.json | 2 +- .devcontainer/devcontainer.json | 2 +- .vscode/extensions.json | 2 +- .vscode/settings.json | 10 +-- CMakeLists.txt | 52 ++++++++-------- CMakePresets.json | 2 +- cmake/AsapInstall.cmake | 89 +++++++++++--------------- cmake/AsapTargets.cmake | 90 +++++++++++++-------------- cmake/BuildHelpers.cmake | 3 +- cmake/CodeCoverage.cmake | 3 - cmake/CompileDefinitions.cmake | 31 ++++----- cmake/CompileOptions.cmake | 7 ++- cmake/ComponentInstall.cmake | 3 +- cmake/DoxGeneration.cmake | 54 +++++++++------- cmake/FasterBuild.cmake | 20 ++---- cmake/FindSphinx.cmake | 7 +-- cmake/GetGitRevisionDescription.cmake | 42 ++++--------- cmake/GoogleSanitizers.cmake | 31 ++++----- cmake/LogHelpers.cmake | 11 +--- cmake/SphinxGeneration.cmake | 32 ++++------ cmake/TestTargets.cmake | 9 ++- doc/getting-started/devenv.rst | 2 +- doc/getting-started/index.rst | 1 - doc/license.rst | 1 - doxygen/footer.html | 2 +- doxygen/header.html | 2 +- tools/version-info/CMakeLists.txt | 23 +++---- 28 files changed, 237 insertions(+), 298 deletions(-) diff --git a/.clangd.in b/.clangd.in index e9c49631..946b4437 100644 --- a/.clangd.in +++ b/.clangd.in @@ -1,5 +1,5 @@ # We need to configure the location of the compilation database in this file -# and not in vscode `.settings` until we have a way to get the cmake build +# and not in vscode `.settings` until we have a way to get the cmake build # directory or preset name as a subsititution variable. # # See https://github.com/clangd/vscode-clangd/issues/48 diff --git a/.commitlintrc.json b/.commitlintrc.json index b34b410b..0df1d253 100644 --- a/.commitlintrc.json +++ b/.commitlintrc.json @@ -2,4 +2,4 @@ "extends": [ "@commitlint/config-conventional" ] -} \ No newline at end of file +} diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 836ae1a8..a0d30fe0 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -69,4 +69,4 @@ "enable_husky": "npx husky install < /dev/null", "update_python_modules": "pip --disable-pip-version-check --no-cache-dir install -r requirements.txt" } -} \ No newline at end of file +} diff --git a/.vscode/extensions.json b/.vscode/extensions.json index 71234101..d4c8a6d7 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -19,4 +19,4 @@ "cheshirekow.cmake-format", "editorconfig.editorconfig" ] -} \ No newline at end of file +} diff --git a/.vscode/settings.json b/.vscode/settings.json index ae392489..be03ab8f 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -129,7 +129,7 @@ // One tab = 2 spaces "editor.tabSize": 2, // Controls whether a list of suggestions is provided based on the text in the document - "editor.wordBasedSuggestions": true, + "editor.wordBasedSuggestions": "matchingDocuments", // There is no need to confirm when deleting files "explorer.confirmDelete": false, // No confirmation is required when moving files @@ -150,8 +150,6 @@ "search.smartCase": true, // The integrated terminal defaults to PowerShell "terminal.integrated.defaultProfile.windows": "PowerShell", - // Enable visual ringing tone for integrated terminal - "terminal.integrated.enableBell": true, // Integrated terminal code: zh_CN.UTF-8 "terminal.integrated.env.windows": { "LC_ALL": "en_US.UTF-8" @@ -293,4 +291,8 @@ "files.exclude": { "**/.sphinx": true }, -} \ No newline at end of file + "accessibility.signals.terminalBell": { + "sound": "on" + }, + "terminal.integrated.enableVisualBell": true, +} diff --git a/CMakeLists.txt b/CMakeLists.txt index 9987198a..f9816757 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -18,8 +18,7 @@ cmake_minimum_required(VERSION 3.14) set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") # But if this project is not the master project, prioritize the master project # cmake include dir if it exists. -if(NOT CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR - AND EXISTS "${CMAKE_SOURCE_DIR}/cmake") +if(NOT CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR AND EXISTS "${CMAKE_SOURCE_DIR}/cmake") list(PREPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake") endif() # Include the log helpers module early so we can use early for logging the @@ -43,7 +42,7 @@ if(NOT GIT_SHA1) endif() # Meta information about the project -# cmake-format: off +# gersemi: off set(META_PROJECT_NAME "asap") set(META_PROJECT_DESCRIPTION "Instantly start with a fully loaded CMake project") set(META_AUTHOR_ORGANIZATION "The Authors") @@ -56,7 +55,7 @@ set(META_VERSION_PATCH "0") set(META_VERSION_REVISION "${GIT_REV}") set(META_VERSION "${META_VERSION_MAJOR}.${META_VERSION_MINOR}.${META_VERSION_PATCH}") set(META_NAME_VERSION "${META_PROJECT_NAME} v${META_VERSION} (${META_VERSION_REVISION})") -# cmake-format: on +# gersemi: on string(MAKE_C_IDENTIFIER ${META_PROJECT_NAME} META_PROJECT_ID) string(TOUPPER ${META_PROJECT_ID} META_PROJECT_ID) @@ -134,7 +133,8 @@ project( VERSION ${META_VERSION} DESCRIPTION ${META_PROJECT_DESCRIPTION} HOMEPAGE_URL ${META_GITHUB_REPO} - LANGUAGES C CXX) + LANGUAGES C CXX +) # Set output directories set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) @@ -161,9 +161,7 @@ include(cmake/FasterBuild.cmake) # ------------------------------------------------------------------------------ # Generate version-header -configure_file( - templates/version.h.in - ${CMAKE_CURRENT_BINARY_DIR}/include/${META_PROJECT_ID_LOWER}/version.h) +configure_file(templates/version.h.in ${CMAKE_CURRENT_BINARY_DIR}/include/${META_PROJECT_ID_LOWER}/version.h) # Generate a clangd configuration file that points to the compilation database # in the cmake build directory. We need to do this as the build directory is @@ -178,15 +176,15 @@ configure_file(.clangd.in ${CMAKE_SOURCE_DIR}/.clangd @ONLY) if(ASAP_BUILD_DOCS) if(ASAP_WITH_DOXYGEN) - # Doxygen - set(DOXYGEN_BUILD_DIR "${CMAKE_BINARY_DIR}/dox") - include(DoxGeneration) + # Doxygen + set(DOXYGEN_BUILD_DIR "${CMAKE_BINARY_DIR}/dox") + include(DoxGeneration) endif() if(ASAP_WITH_SPHINX) - # Sphinx/breathe/exhale - set(SPHINX_BUILD_DIR "${CMAKE_BINARY_DIR}/sphinx") - include(SphinxGeneration) + # Sphinx/breathe/exhale + set(SPHINX_BUILD_DIR "${CMAKE_BINARY_DIR}/sphinx") + include(SphinxGeneration) endif() endif() @@ -201,7 +199,9 @@ if(ASAP_BUILD_TESTS) include(CodeCoverage) # Enable this target when the project has test cases asap_add_code_coverage_all_targets() - include(Valgrind) + if(ASAP_WITH_VALGRIND) + include(Valgrind) + endif() cpmaddpackage( NAME @@ -212,7 +212,8 @@ if(ASAP_BUILD_TESTS) google/googletest OPTIONS "gtest_force_shared_crt ON" - "INSTALL_GTEST OFF") + "INSTALL_GTEST OFF" + ) include(GoogleTest) endif() @@ -245,14 +246,13 @@ include(AsapInstall) # optimization. For some projects you may want to set a default build type so # that you do not have to remember to set it. if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) - message( - STATUS "Setting build type to 'RelWithDebInfo' as none was specified.") - set(CMAKE_BUILD_TYPE - RelWithDebInfo - CACHE STRING "Choose the type of build." FORCE) + message(STATUS "Setting build type to 'RelWithDebInfo' as none was specified.") + set(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "Choose the type of build." FORCE) # Set the possible values of build type for cmake-gui - set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" - "MinSizeRel" "RelWithDebInfo") + set_property( + CACHE CMAKE_BUILD_TYPE + PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo" + ) endif() # ------------------------------------------------------------------------------ @@ -265,7 +265,7 @@ endif() # Set runtime path set(CMAKE_SKIP_BUILD_RPATH FALSE) # Add absolute path to all dependencies for - # BUILD +# BUILD set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE) set(CMAKE_INSTALL_RPATH_USE_LINK_PATH FALSE) @@ -290,8 +290,8 @@ add_subdirectory(tools/version-info) if(${META_PROJECT_ID}_IS_MASTER_PROJECT) if(ASAP_WITH_CLANG_TIDY) - include(ClangTidy) - asap_create_clang_tidy_targets() + include(ClangTidy) + asap_create_clang_tidy_targets() endif() if(ASAP_WITH_CLANG_FORMAT) diff --git a/CMakePresets.json b/CMakePresets.json index 41338796..ad228162 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -434,4 +434,4 @@ "configurePreset": "dev-gcc" } ] -} \ No newline at end of file +} diff --git a/cmake/AsapInstall.cmake b/cmake/AsapInstall.cmake index ae7caaa9..b5fafdf7 100644 --- a/cmake/AsapInstall.cmake +++ b/cmake/AsapInstall.cmake @@ -1,17 +1,14 @@ # Determine if this is built as a subproject or if it is the master project. if(NOT DEFINED ${META_PROJECT_ID}_INSTALL) - option(${META_PROJECT_ID}_INSTALL - "Generate the install target for this project." - ${${META_PROJECT_ID}_IS_MASTER_PROJECT}) + option(${META_PROJECT_ID}_INSTALL "Generate the install target for this project." ${${META_PROJECT_ID}_IS_MASTER_PROJECT}) endif() macro(_setup_install_dirs) message(STATUS "Using CMAKE_INSTALL_PREFIX: ${CMAKE_INSTALL_PREFIX}") # Check for system dir install set(_system_dir_install FALSE) - if("${CMAKE_INSTALL_PREFIX}" STREQUAL "/usr" OR "${CMAKE_INSTALL_PREFIX}" - STREQUAL "/usr/local") + if("${CMAKE_INSTALL_PREFIX}" STREQUAL "/usr" OR "${CMAKE_INSTALL_PREFIX}" STREQUAL "/usr/local") set(_system_dir_install TRUE) endif() @@ -20,34 +17,34 @@ macro(_setup_install_dirs) # Installation paths include(GNUInstallDirs) # Install into the system (/usr/bin or /usr/local/bin) - set(ASAP_INSTALL_LIB "${CMAKE_INSTALL_LIBDIR}") # /usr/[local]/lib - set(ASAP_INSTALL_SHARED "${ASAP_INSTALL_LIB}") # /usr/[local]/lib - set(ASAP_INSTALL_CMAKE "${CMAKE_INSTALL_DATAROOTDIR}/cmake/${META_PROJECT_NAME}") # /usr/[local]/share/cmake/ - set(ASAP_INSTALL_PKGCONFIG "${CMAKE_INSTALL_DATAROOTDIR}/pkgconfig") # /usr/[local]/share/pkgconfig - set(ASAP_INSTALL_EXAMPLES "${CMAKE_INSTALL_DATAROOTDIR}/${META_PROJECT_NAME}/examples") # /usr/[local]/share//examples - set(ASAP_INSTALL_DATA "${CMAKE_INSTALL_DATAROOTDIR}/${META_PROJECT_NAME}") # /usr/[local]/share/ - set(ASAP_INSTALL_BIN "${CMAKE_INSTALL_BINDIR}") # /usr/[local]/bin - set(ASAP_INSTALL_INCLUDE "${CMAKE_INSTALL_INCLUDEDIR}") # /usr/[local]/include - set(ASAP_INSTALL_DOC "${CMAKE_INSTALL_DOCDIR}") # /usr/[local]/share/doc/ - set(ASAP_INSTALL_SHORTCUTS "${CMAKE_INSTALL_DATAROOTDIR}/applications") # /usr/[local]/share/applications - set(ASAP_INSTALL_ICONS "${CMAKE_INSTALL_DATAROOTDIR}/pixmaps") # /usr/[local]/share/pixmaps - set(ASAP_INSTALL_INIT "/etc/init") # /etc/init (upstart init scripts) - set(ASAP_INSTALL_MISC "${CMAKE_INSTALL_DATAROOTDIR}/${META_PROJECT_NAME}") # /etc/init (upstart init scripts) + set(ASAP_INSTALL_LIB "${CMAKE_INSTALL_LIBDIR}") # /usr/[local]/lib + set(ASAP_INSTALL_SHARED "${ASAP_INSTALL_LIB}") # /usr/[local]/lib + set(ASAP_INSTALL_CMAKE "${CMAKE_INSTALL_DATAROOTDIR}/cmake/${META_PROJECT_NAME}") # /usr/[local]/share/cmake/ + set(ASAP_INSTALL_PKGCONFIG "${CMAKE_INSTALL_DATAROOTDIR}/pkgconfig") # /usr/[local]/share/pkgconfig + set(ASAP_INSTALL_EXAMPLES "${CMAKE_INSTALL_DATAROOTDIR}/${META_PROJECT_NAME}/examples") # /usr/[local]/share//examples + set(ASAP_INSTALL_DATA "${CMAKE_INSTALL_DATAROOTDIR}/${META_PROJECT_NAME}") # /usr/[local]/share/ + set(ASAP_INSTALL_BIN "${CMAKE_INSTALL_BINDIR}") # /usr/[local]/bin + set(ASAP_INSTALL_INCLUDE "${CMAKE_INSTALL_INCLUDEDIR}") # /usr/[local]/include + set(ASAP_INSTALL_DOC "${CMAKE_INSTALL_DOCDIR}") # /usr/[local]/share/doc/ + set(ASAP_INSTALL_SHORTCUTS "${CMAKE_INSTALL_DATAROOTDIR}/applications") # /usr/[local]/share/applications + set(ASAP_INSTALL_ICONS "${CMAKE_INSTALL_DATAROOTDIR}/pixmaps") # /usr/[local]/share/pixmaps + set(ASAP_INSTALL_INIT "/etc/init") # /etc/init (upstart init scripts) + set(ASAP_INSTALL_MISC "${CMAKE_INSTALL_DATAROOTDIR}/${META_PROJECT_NAME}") # /etc/init (upstart init scripts) else() # Install into local directory - set(ASAP_INSTALL_LIB "${CMAKE_INSTALL_PREFIX}/lib") # ./lib - set(ASAP_INSTALL_SHARED "${ASAP_INSTALL_LIB}") # ./lib - set(ASAP_INSTALL_CMAKE "${CMAKE_INSTALL_PREFIX}/share/cmake/${META_PROJECT_NAME}") # ./share/cmake/ - set(ASAP_INSTALL_PKGCONFIG "${CMAKE_INSTALL_PREFIX}/share/pkgconfig") # ./share/pkgconfig - set(ASAP_INSTALL_EXAMPLES "${CMAKE_INSTALL_PREFIX}/examples") # ./examples - set(ASAP_INSTALL_DATA "${CMAKE_INSTALL_PREFIX}") # ./ - set(ASAP_INSTALL_BIN "${CMAKE_INSTALL_PREFIX}/bin") # ./bin - set(ASAP_INSTALL_INCLUDE "${CMAKE_INSTALL_PREFIX}/include") # ./include - set(ASAP_INSTALL_DOC "${CMAKE_INSTALL_PREFIX}/doc") # ./doc - set(ASAP_INSTALL_SHORTCUTS "${CMAKE_INSTALL_PREFIX}/shortcuts") # ./shortcuts - set(ASAP_INSTALL_ICONS "${CMAKE_INSTALL_PREFIX}/icons") # ./icons - set(ASAP_INSTALL_INIT "${CMAKE_INSTALL_PREFIX}/init") # ./init - set(ASAP_INSTALL_MISC "${CMAKE_INSTALL_PREFIX}") # ./ + set(ASAP_INSTALL_LIB "${CMAKE_INSTALL_PREFIX}/lib") # ./lib + set(ASAP_INSTALL_SHARED "${ASAP_INSTALL_LIB}") # ./lib + set(ASAP_INSTALL_CMAKE "${CMAKE_INSTALL_PREFIX}/share/cmake/${META_PROJECT_NAME}") # ./share/cmake/ + set(ASAP_INSTALL_PKGCONFIG "${CMAKE_INSTALL_PREFIX}/share/pkgconfig") # ./share/pkgconfig + set(ASAP_INSTALL_EXAMPLES "${CMAKE_INSTALL_PREFIX}/examples") # ./examples + set(ASAP_INSTALL_DATA "${CMAKE_INSTALL_PREFIX}") # ./ + set(ASAP_INSTALL_BIN "${CMAKE_INSTALL_PREFIX}/bin") # ./bin + set(ASAP_INSTALL_INCLUDE "${CMAKE_INSTALL_PREFIX}/include") # ./include + set(ASAP_INSTALL_DOC "${CMAKE_INSTALL_PREFIX}/doc") # ./doc + set(ASAP_INSTALL_SHORTCUTS "${CMAKE_INSTALL_PREFIX}/shortcuts") # ./shortcuts + set(ASAP_INSTALL_ICONS "${CMAKE_INSTALL_PREFIX}/icons") # ./icons + set(ASAP_INSTALL_INIT "${CMAKE_INSTALL_PREFIX}/init") # ./init + set(ASAP_INSTALL_MISC "${CMAKE_INSTALL_PREFIX}") # ./ endif() # cmake-format: on endmacro() @@ -70,39 +67,23 @@ if(${META_PROJECT_ID}_INSTALL) set(docs "${META_PROJECT_NAME}_docs") # Install the project meta files - install( - FILES AUTHORS - DESTINATION ${ASAP_INSTALL_MISC} - COMPONENT ${meta}) - install( - FILES LICENSE - DESTINATION ${ASAP_INSTALL_MISC} - COMPONENT ${meta}) - install( - FILES README.md - DESTINATION ${ASAP_INSTALL_MISC} - COMPONENT ${meta}) + install(FILES AUTHORS DESTINATION ${ASAP_INSTALL_MISC} COMPONENT ${meta}) + install(FILES LICENSE DESTINATION ${ASAP_INSTALL_MISC} COMPONENT ${meta}) + install(FILES README.md DESTINATION ${ASAP_INSTALL_MISC} COMPONENT ${meta}) # Install generated header files install( DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/include/${META_PROJECT_ID_LOWER} DESTINATION ${ASAP_INSTALL_INCLUDE} - COMPONENT ${dev}) + COMPONENT ${dev} + ) # Install master docs string(MAKE_C_IDENTIFIER ${META_PROJECT_NAME} project_id) string(TOLOWER ${project_id} project_id) set(master_sphinx_target ${project_id}_master) - install( - DIRECTORY ${SPHINX_BUILD_DIR}/${master_sphinx_target} - DESTINATION ${ASAP_INSTALL_DOC} - COMPONENT ${docs} - OPTIONAL) + install(DIRECTORY ${SPHINX_BUILD_DIR}/${master_sphinx_target} DESTINATION ${ASAP_INSTALL_DOC} COMPONENT ${docs} OPTIONAL) # Install data - install( - DIRECTORY ${PROJECT_SOURCE_DIR}/data - DESTINATION ${ASAP_INSTALL_DATA} - COMPONENT ${data} - OPTIONAL) + install(DIRECTORY ${PROJECT_SOURCE_DIR}/data DESTINATION ${ASAP_INSTALL_DATA} COMPONENT ${data} OPTIONAL) endif() diff --git a/cmake/AsapTargets.cmake b/cmake/AsapTargets.cmake index a96fd3cb..2c5de6f7 100644 --- a/cmake/AsapTargets.cmake +++ b/cmake/AsapTargets.cmake @@ -16,54 +16,49 @@ include(CompileOptions) macro(asap_declare_module) set(options) - set(oneValueArgs - MODULE_NAME - DESCRIPTION - GITHUB_REPO - AUTHOR_MAINTAINER - VERSION_MAJOR - VERSION_MINOR - VERSION_PATCH) + set( + oneValueArgs + MODULE_NAME + DESCRIPTION + GITHUB_REPO + AUTHOR_MAINTAINER + VERSION_MAJOR + VERSION_MINOR + VERSION_PATCH + ) set(multiValueArgs) - cmake_parse_arguments(x "${options}" "${oneValueArgs}" "${multiValueArgs}" - ${ARGN}) + cmake_parse_arguments(x "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) if(NOT DEFINED x_MODULE_NAME) message(FATAL_ERROR "Module name is required.") return() endif() - if(NOT - (DEFINED x_VERSION_MAJOR - AND DEFINED x_VERSION_MINOR - AND DEFINED x_VERSION_PATCH)) - message( - FATAL_ERROR - "PLease specify all of VERSION_MAJOR VERSION_MINOR VERSION_PATCH for the module." - ) + if(NOT (DEFINED x_VERSION_MAJOR AND DEFINED x_VERSION_MINOR AND DEFINED x_VERSION_PATCH)) + message(FATAL_ERROR "PLease specify all of VERSION_MAJOR VERSION_MINOR VERSION_PATCH for the module.") return() endif() # cmake-format: off - set(META_MODULE_NAME "${x_MODULE_NAME}") - set(META_MODULE_DESCRIPTION "${x_DESCRIPTION}") - set(META_MODULE_GITHUB_REPO "${x_GITHUB_REPO}") - set(META_MODULE_AUTHOR_MAINTAINER "${x_AUTHOR_MAINTAINER}") - set(META_MODULE_VERSION_MAJOR "${x_VERSION_MAJOR}") - set(META_MODULE_VERSION_MINOR "${x_VERSION_MINOR}") - set(META_MODULE_VERSION_PATCH "${x_VERSION_PATCH}") - set(META_MODULE_VERSION "${META_MODULE_VERSION_MAJOR}.${META_MODULE_VERSION_MINOR}.${META_MODULE_VERSION_PATCH}") - set(META_MODULE_NAME_VERSION "${META_MODULE_PROJECT_NAME} v${META_MODULE_VERSION}") + set(META_MODULE_NAME "${x_MODULE_NAME}") + set(META_MODULE_DESCRIPTION "${x_DESCRIPTION}") + set(META_MODULE_GITHUB_REPO "${x_GITHUB_REPO}") + set(META_MODULE_AUTHOR_MAINTAINER "${x_AUTHOR_MAINTAINER}") + set(META_MODULE_VERSION_MAJOR "${x_VERSION_MAJOR}") + set(META_MODULE_VERSION_MINOR "${x_VERSION_MINOR}") + set(META_MODULE_VERSION_PATCH "${x_VERSION_PATCH}") + set(META_MODULE_VERSION "${META_MODULE_VERSION_MAJOR}.${META_MODULE_VERSION_MINOR}.${META_MODULE_VERSION_PATCH}") + set(META_MODULE_NAME_VERSION "${META_MODULE_PROJECT_NAME} v${META_MODULE_VERSION}") # cmake-format: on # Check if the module has been pushed on top of the hierarchy stack if(NOT ASAP_LOG_PROJECT_HIERARCHY MATCHES "(${META_MODULE_NAME})") message( AUTHOR_WARNING - "Can't find module `${META_MODULE_NAME}` on the hierarchy stack. " - "Please make sure it has been pushed with asap_push_module().") + "Can't find module `${META_MODULE_NAME}` on the hierarchy stack. " + "Please make sure it has been pushed with asap_push_module()." + ) endif() - endmacro() # ------------------------------------------------------------------------------ @@ -76,28 +71,27 @@ function(_module_cmake_config_files) ${CMAKE_CURRENT_SOURCE_DIR}/config.cmake.in "${CMAKE_CURRENT_BINARY_DIR}/${MODULE_TARGET_NAME}Config.cmake" INSTALL_DESTINATION "${ASAP_INSTALL_CMAKE}/${META_MODULE_NAME}" - PATH_VARS META_MODULE_VERSION MODULE_TARGET_NAME) + PATH_VARS META_MODULE_VERSION MODULE_TARGET_NAME + ) # generate the version file for the config file write_basic_package_version_file( "${CMAKE_CURRENT_BINARY_DIR}/${MODULE_TARGET_NAME}ConfigVersion.cmake" VERSION "${META_MODULE_VERSION}" - COMPATIBILITY AnyNewerVersion) + COMPATIBILITY AnyNewerVersion + ) endfunction() function(_module_pkgconfig_files) set(MODULE_PKGCONFIG_FILE ${MODULE_TARGET_NAME}.pc) get_target_property(type ${MODULE_TARGET_NAME} TYPE) if(NOT ${type} STREQUAL "INTERFACE_LIBRARY") - get_target_property(TARGET_DEBUG_POSTFIX ${MODULE_TARGET_NAME} - DEBUG_POSTFIX) + get_target_property(TARGET_DEBUG_POSTFIX ${MODULE_TARGET_NAME} DEBUG_POSTFIX) set(MODULE_LINK_LIBS "-l${MODULE_TARGET_NAME}${TARGET_DEBUG_POSTFIX}") endif() - configure_file(config.pc.in - ${CMAKE_CURRENT_BINARY_DIR}/${MODULE_PKGCONFIG_FILE} @ONLY) + configure_file(config.pc.in ${CMAKE_CURRENT_BINARY_DIR}/${MODULE_PKGCONFIG_FILE} @ONLY) if(${META_PROJECT_ID}_INSTALL) - install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${MODULE_PKGCONFIG_FILE} - DESTINATION ${ASAP_INSTALL_PKGCONFIG}) + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${MODULE_PKGCONFIG_FILE} DESTINATION ${ASAP_INSTALL_PKGCONFIG}) endif() endfunction() @@ -135,7 +129,8 @@ function(asap_add_library target) # Contrarily to swift default, we enable exceptions and RTTI for all targets swift_add_library("${target}" EXCEPTIONS RTTI ${warning_flag} - ${x_UNPARSED_ARGUMENTS}) + ${x_UNPARSED_ARGUMENTS} + ) # We can refer to this target either with its standalone target name or with a # project scoped name (::) which we will alias to the target @@ -152,12 +147,14 @@ function(asap_add_library target) set_target_properties( ${target} - PROPERTIES FOLDER "Libraries" - VERSION ${META_MODULE_VERSION} - SOVERSION ${META_MODULE_VERSION_MAJOR} - DEBUG_POSTFIX "d" - CXX_VISIBILITY_PRESET hidden - VISIBILITY_INLINES_HIDDEN YES) + PROPERTIES + FOLDER "Libraries" + VERSION ${META_MODULE_VERSION} + SOVERSION ${META_MODULE_VERSION_MAJOR} + DEBUG_POSTFIX "d" + CXX_VISIBILITY_PRESET hidden + VISIBILITY_INLINES_HIDDEN YES + ) endif() endfunction() @@ -176,7 +173,8 @@ function(asap_add_executable target) # Contrarily to swift default, we enable exceptions and RTTI for all targets swift_add_executable("${target}" EXCEPTIONS RTTI ${warning_flag} - ${x_UNPARSED_ARGUMENTS}) + ${x_UNPARSED_ARGUMENTS} + ) # Set some common private compiler defines asap_set_compile_definitions(${target} CONTRACTS ${x_CONTRACTS}) # Set common compiler options diff --git a/cmake/BuildHelpers.cmake b/cmake/BuildHelpers.cmake index 77ff436d..abcd7c5e 100644 --- a/cmake/BuildHelpers.cmake +++ b/cmake/BuildHelpers.cmake @@ -18,6 +18,5 @@ function(asap_generate_export_headers target include_dir) set(TEMPLATE_INCLUDE_DIR "${include_dir}") # Create API export headers - generate_export_header(${target} EXPORT_FILE_NAME ${export_file} - EXPORT_MACRO_NAME ${TEMPLATE_TARGET_ID}_API) + generate_export_header(${target} EXPORT_FILE_NAME ${export_file} EXPORT_MACRO_NAME ${TEMPLATE_TARGET_ID}_API) endfunction() diff --git a/cmake/CodeCoverage.cmake b/cmake/CodeCoverage.cmake index 18b40f83..43a22cd7 100644 --- a/cmake/CodeCoverage.cmake +++ b/cmake/CodeCoverage.cmake @@ -8,7 +8,6 @@ # Code coverage only works with clang/gcc. # if("${CMAKE_C_COMPILER_ID}" MATCHES "(Apple)?[Cc]lang|GNU") - include(common/CodeCoverage) function(asap_add_code_coverage) @@ -28,7 +27,6 @@ if("${CMAKE_C_COMPILER_ID}" MATCHES "(Apple)?[Cc]lang|GNU") endif() add_code_coverage_all_targets(EXCLUDE ${STANDARD_EXCLUDES} ${ARGV}) endfunction() - else() function(target_code_coverage) # empty @@ -41,5 +39,4 @@ else() function(asap_add_code_coverage_all_targets) # empty endfunction() - endif() diff --git a/cmake/CompileDefinitions.cmake b/cmake/CompileDefinitions.cmake index 0087236d..5bc65430 100644 --- a/cmake/CompileDefinitions.cmake +++ b/cmake/CompileDefinitions.cmake @@ -67,11 +67,9 @@ function(asap_set_compile_definitions target) list(APPEND all_definitions "$<$:ASAP_IS_DEBUG_BUILD>") if(MSVC) - list(APPEND all_definitions "NOMINMAX" "WIN32_LEAN_AND_MEAN=1" - "_WIN32_WINNT=0x0600") + list(APPEND all_definitions "NOMINMAX" "WIN32_LEAN_AND_MEAN=1" "_WIN32_WINNT=0x0600") # Disabling warning for not using "secure-but-not-standard" STL algos - list(APPEND all_definitions "_CRT_SECURE_NO_WARNINGS" - "_SCL_SECURE_NO_WARNINGS") + list(APPEND all_definitions "_CRT_SECURE_NO_WARNINGS" "_SCL_SECURE_NO_WARNINGS") endif() if(x_REMOVE) @@ -80,8 +78,9 @@ function(asap_set_compile_definitions target) if(found EQUAL -1) message( FATAL_ERROR - "Compiler definition '${definition}' specified for removal is not " - "part of the set of common compiler definitions.") + "Compiler definition '${definition}' specified for removal is not " + "part of the set of common compiler definitions." + ) endif() endforeach() list(REMOVE_ITEM all_definitions ${x_REMOVE}) @@ -96,23 +95,25 @@ function(asap_set_compile_definitions target) # friendly with multi-config generators. if(NOT x_CONTRACTS STREQUAL "TESTING") if(x_CONTRACTS MATCHES "OFF|AUDIT|DEFAULT") - target_compile_definitions(${target} - PRIVATE "ASAP_CONTRACT_${x_CONTRACTS}") + target_compile_definitions(${target} PRIVATE "ASAP_CONTRACT_${x_CONTRACTS}") elseif(x_CONTRACTS STREQUAL "AUTO") if(NOT DEFINED OPTION_CONTRACT_MODE) target_compile_definitions( ${target} - PRIVATE $<$:ASAP_CONTRACT_AUDIT> - $<$:ASAP_CONTRACT_DEFAULT> - $<$:ASAP_CONTRACT_OFF>) + PRIVATE + $<$:ASAP_CONTRACT_AUDIT> + $<$:ASAP_CONTRACT_DEFAULT> + $<$:ASAP_CONTRACT_OFF> + ) else() - target_compile_definitions( - ${target} PRIVATE "ASAP_CONTRACT_${OPTION_CONTRACT_MODE}") + target_compile_definitions(${target} PRIVATE "ASAP_CONTRACT_${OPTION_CONTRACT_MODE}") endif() else() message( - FATAL_ERROR "Contract mode '${x_CONTRACTS}' is not valid." - "Valid values are: OFF, DEFAULT, AUDIT, AUTO and TESTING.") + FATAL_ERROR + "Contract mode '${x_CONTRACTS}' is not valid." + "Valid values are: OFF, DEFAULT, AUDIT, AUTO and TESTING." + ) endif() endif() endfunction() diff --git a/cmake/CompileOptions.cmake b/cmake/CompileOptions.cmake index da1138b2..7a53746b 100644 --- a/cmake/CompileOptions.cmake +++ b/cmake/CompileOptions.cmake @@ -25,7 +25,8 @@ function(asap_set_compile_options) -Wno-c++98-compat-pedantic -Wno-c++98-c++11-compat-pedantic -Wno-padded - -Wno-documentation-unknown-command) + -Wno-documentation-unknown-command + ) # -Wno-switch-enum -Wno-unused-macros -Wno-disabled-macro-expansion) elseif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") # using GCC @@ -38,7 +39,8 @@ function(asap_set_compile_options) -Woverloaded-virtual -Wsign-conversion -Wsign-promo - -Wundef) + -Wundef + ) if(NOT DEFINED CMAKE_CXX_CLANG_TIDY) swift_set_compile_options(ADD -Wlogical-op -Wstrict-null-sentinel) endif() @@ -62,7 +64,6 @@ function(asap_set_compile_options) target_link_options(${target} PRIVATE $<$:/PROFILE>) endforeach() endif() - endfunction() # ------------------------------------------------------------------------------ diff --git a/cmake/ComponentInstall.cmake b/cmake/ComponentInstall.cmake index 6a704954..680a489f 100644 --- a/cmake/ComponentInstall.cmake +++ b/cmake/ComponentInstall.cmake @@ -7,5 +7,4 @@ # Execute cmake_install.cmake wrapper that allows to pass both DESTDIR and # COMPONENT environment variable -execute_process(COMMAND ${CMAKE_COMMAND} -DCOMPONENT=$ENV{COMPONENT} -P - cmake_install.cmake) +execute_process(COMMAND ${CMAKE_COMMAND} -DCOMPONENT=$ENV{COMPONENT} -P cmake_install.cmake) diff --git a/cmake/DoxGeneration.cmake b/cmake/DoxGeneration.cmake index d0413959..38d36662 100644 --- a/cmake/DoxGeneration.cmake +++ b/cmake/DoxGeneration.cmake @@ -29,7 +29,14 @@ include(FindDoxygen) if(DOXYGEN_FOUND) - function(_configure_doxyfile MODULE_NAME VERSION TITLE BRIEF INPUT_PATH) + function( + _configure_doxyfile + MODULE_NAME + VERSION + TITLE + BRIEF + INPUT_PATH + ) if(EXISTS "${CMAKE_SOURCE_DIR}/doxygen/Doxyfile.in") set(DOXY_OUTPUT_DIR "${MODULE_NAME}") set(DOXY_MODULE_DIR "${CMAKE_CURRENT_SOURCE_DIR}") @@ -51,13 +58,9 @@ if(DOXYGEN_FOUND) if(NOT EXISTS "${DOXYGEN_BUILD_DIR}/${DOXY_OUTPUT_DIR}") file(MAKE_DIRECTORY "${DOXYGEN_BUILD_DIR}/${DOXY_OUTPUT_DIR}") endif() - configure_file("${CMAKE_SOURCE_DIR}/doxygen/Doxyfile.in" - "${DOXYGEN_BUILD_DIR}/${MODULE_NAME}_Doxyfile" @ONLY) + configure_file("${CMAKE_SOURCE_DIR}/doxygen/Doxyfile.in" "${DOXYGEN_BUILD_DIR}/${MODULE_NAME}_Doxyfile" @ONLY) else() - message( - STATUS - "WARNING: The '${CMAKE_SOURCE_DIR}/doxygen/Doxyfile.in' file does not exist!" - ) + message(STATUS "WARNING: The '${CMAKE_SOURCE_DIR}/doxygen/Doxyfile.in' file does not exist!") endif() endfunction() @@ -66,13 +69,13 @@ if(DOXYGEN_FOUND) add_custom_target( ${MODULE_NAME}_dox COMMAND ${CMAKE_COMMAND} -E remove -f "${MODULE_NAME}_Doxyfile.out" - COMMAND ${CMAKE_COMMAND} -E copy "${MODULE_NAME}_Doxyfile" - "${MODULE_NAME}_Doxyfile.out" + COMMAND ${CMAKE_COMMAND} -E copy "${MODULE_NAME}_Doxyfile" "${MODULE_NAME}_Doxyfile.out" COMMAND ${DOXYGEN_EXECUTABLE} "${MODULE_NAME}_Doxyfile.out" COMMAND ${CMAKE_COMMAND} -E remove -f "${MODULE_NAME}_Doxyfile.out" WORKING_DIRECTORY "${DOXYGEN_BUILD_DIR}" COMMENT "Generating doxygen documentation for \"${MODULE_NAME}\"" - VERBATIM) + VERBATIM + ) set_target_properties(${MODULE_NAME}_dox PROPERTIES EXCLUDE_FROM_ALL TRUE) add_dependencies(dox ${MODULE_NAME}_dox) endfunction() @@ -84,11 +87,17 @@ if(DOXYGEN_FOUND) endif() set(options) - set(oneValueArgs MODULE_NAME VERSION TITLE BRIEF INPUT_PATH) + set( + oneValueArgs + MODULE_NAME + VERSION + TITLE + BRIEF + INPUT_PATH + ) set(multiValueArgs) - cmake_parse_arguments(x "${options}" "${oneValueArgs}" "${multiValueArgs}" - ${ARGN}) + cmake_parse_arguments(x "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) if(NOT DEFINED x_MODULE_NAME) message(FATAL_ERROR "Module name is required.") @@ -111,7 +120,8 @@ if(DOXYGEN_FOUND) # Substitute variables in the doxygen config file for the target _configure_doxyfile(${x_MODULE_NAME} ${x_VERSION} ${x_TITLE} ${x_BRIEF} - ${x_INPUT_PATH}) + ${x_INPUT_PATH} + ) # Add the target as a dependency to the master dox target _add_doxygen_target(${x_MODULE_NAME}) endfunction() @@ -131,7 +141,10 @@ if(DOXYGEN_FOUND) set(COLLECT_WARNINGS_SCRIPT "${DOXYGEN_BUILD_DIR}/collect_warnings.cmake") # cmake-format: off - file(WRITE "${COLLECT_WARNINGS_SCRIPT}" " \ + file( + WRITE + "${COLLECT_WARNINGS_SCRIPT}" + " \ # Collect warnings from submodules into the consolidated warnings file\n \ file(WRITE \"${DOXYGEN_BUILD_DIR}/${MODULE_NAME}/doxygen_warnings.txt\" \"\")\n \ file(GLOB_RECURSE DOX_MODULES \"module_warnings.txt\")\n \ @@ -145,7 +158,8 @@ if(DOXYGEN_FOUND) if(DOXYGEN_HAD_WARNINGS)\n \ # Print the warnings\n \ message(\"\${ALL_WARNINGS}\")\n \ - endif(DOXYGEN_HAD_WARNINGS)\n") + endif(DOXYGEN_HAD_WARNINGS)\n" + ) # cmake-format: on # Custom command to collect warnings and print them @@ -154,14 +168,12 @@ if(DOXYGEN_FOUND) POST_BUILD COMMAND ${CMAKE_COMMAND} -P "${COLLECT_WARNINGS_SCRIPT}" WORKING_DIRECTORY "${DOXYGEN_BUILD_DIR}" - COMMENT "Running post-build command for dox") + COMMENT "Running post-build command for dox" + ) endif() - else() - message(WARNING "`doxygen` is not available on this system! " - "API documentation generation targets will not be added.") + message(WARNING "`doxygen` is not available on this system! " "API documentation generation targets will not be added.") function(asap_with_doxygen) - endfunction() endif() diff --git a/cmake/FasterBuild.cmake b/cmake/FasterBuild.cmake index dbe9c613..a1bd795b 100644 --- a/cmake/FasterBuild.cmake +++ b/cmake/FasterBuild.cmake @@ -10,27 +10,17 @@ # Only do the following if we have not already done it in this project or in in # its parent hierarchy of projects. -if(NOT DEFINED CMAKE_CXX_COMPILER_LAUNCHER OR NOT DEFINED - CMAKE_C_COMPILER_LAUNCHER) +if(NOT DEFINED CMAKE_CXX_COMPILER_LAUNCHER OR NOT DEFINED CMAKE_C_COMPILER_LAUNCHER) find_program(CCACHE_TOOL_PATH ccache) - if(NOT WIN32 - AND USE_CCACHE - AND CCACHE_TOOL_PATH) + if(NOT WIN32 AND USE_CCACHE AND CCACHE_TOOL_PATH) message(STATUS "Using ccache (${CCACHE_TOOL_PATH}) (via wrapper).") # see https://github.com/TheLartians/Ccache.cmake enables CCACHE support # through the USE_CCACHE flag possible values are: YES, NO or equivalent cpmaddpackage("gh:TheLartians/Ccache.cmake@1.2.3") - elseif( - WIN32 - AND USE_CCACHE - AND CCACHE_TOOL_PATH) - set(CMAKE_C_COMPILER_LAUNCHER - ${CCACHE_TOOL_PATH} - CACHE STRING "" FORCE) - set(CMAKE_CXX_COMPILER_LAUNCHER - ${CCACHE_TOOL_PATH} - CACHE STRING "" FORCE) + elseif(WIN32 AND USE_CCACHE AND CCACHE_TOOL_PATH) + set(CMAKE_C_COMPILER_LAUNCHER ${CCACHE_TOOL_PATH} CACHE STRING "" FORCE) + set(CMAKE_CXX_COMPILER_LAUNCHER ${CCACHE_TOOL_PATH} CACHE STRING "" FORCE) message(STATUS "Using ccache (${CCACHE_TOOL_PATH}).") endif() endif() diff --git a/cmake/FindSphinx.cmake b/cmake/FindSphinx.cmake index ad1ebe87..1e63e314 100644 --- a/cmake/FindSphinx.cmake +++ b/cmake/FindSphinx.cmake @@ -8,12 +8,7 @@ # # This modules defines SPHINX_EXECUTABLE SPHINX_FOUND -find_program( - SPHINX_EXECUTABLE - NAMES sphinx-build - HINTS $ENV{SPHINX_DIR} - PATH_SUFFIXES bin - DOC "Sphinx documentation generator") +find_program(SPHINX_EXECUTABLE NAMES sphinx-build DOC "Sphinx documentation generator") include(FindPackageHandleStandardArgs) diff --git a/cmake/GetGitRevisionDescription.cmake b/cmake/GetGitRevisionDescription.cmake index 58914c82..02accf84 100644 --- a/cmake/GetGitRevisionDescription.cmake +++ b/cmake/GetGitRevisionDescription.cmake @@ -46,12 +46,8 @@ function(get_git_head_revision _refspecvar _hashvar) get_filename_component(GIT_PARENT_DIR ${GIT_PARENT_DIR} PATH) if(GIT_PARENT_DIR STREQUAL GIT_PREVIOUS_PARENT) # We have reached the root directory, we are not in git - set(${_refspecvar} - "GITDIR-NOTFOUND" - PARENT_SCOPE) - set(${_hashvar} - "GITDIR-NOTFOUND" - PARENT_SCOPE) + set(${_refspecvar} "GITDIR-NOTFOUND" PARENT_SCOPE) + set(${_hashvar} "GITDIR-NOTFOUND" PARENT_SCOPE) return() endif() set(GIT_DIR "${GIT_PARENT_DIR}/.git") @@ -61,8 +57,7 @@ function(get_git_head_revision _refspecvar _hashvar) file(READ ${GIT_DIR} submodule) string(REGEX REPLACE "gitdir: (.*)\n$" "\\1" GIT_DIR_RELATIVE ${submodule}) get_filename_component(SUBMODULE_DIR ${GIT_DIR} PATH) - get_filename_component(GIT_DIR ${SUBMODULE_DIR}/${GIT_DIR_RELATIVE} - ABSOLUTE) + get_filename_component(GIT_DIR ${SUBMODULE_DIR}/${GIT_DIR_RELATIVE} ABSOLUTE) endif() set(GIT_DATA "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/git-data") if(NOT EXISTS "${GIT_DATA}") @@ -75,16 +70,11 @@ function(get_git_head_revision _refspecvar _hashvar) set(HEAD_FILE "${GIT_DATA}/HEAD") configure_file("${GIT_DIR}/HEAD" "${HEAD_FILE}" COPYONLY) - configure_file("${_gitdescmoddir}/GetGitRevisionDescription.cmake.in" - "${GIT_DATA}/grabRef.cmake" @ONLY) + configure_file("${_gitdescmoddir}/GetGitRevisionDescription.cmake.in" "${GIT_DATA}/grabRef.cmake" @ONLY) include("${GIT_DATA}/grabRef.cmake") - set(${_refspecvar} - "${HEAD_REF}" - PARENT_SCOPE) - set(${_hashvar} - "${HEAD_HASH}" - PARENT_SCOPE) + set(${_refspecvar} "${HEAD_REF}" PARENT_SCOPE) + set(${_hashvar} "${HEAD_HASH}" PARENT_SCOPE) endfunction() function(git_describe _var) @@ -93,15 +83,11 @@ function(git_describe _var) endif() get_git_head_revision(refspec hash) if(NOT GIT_FOUND) - set(${_var} - "GIT-NOTFOUND" - PARENT_SCOPE) + set(${_var} "GIT-NOTFOUND" PARENT_SCOPE) return() endif() if(NOT hash) - set(${_var} - "HEAD-HASH-NOTFOUND" - PARENT_SCOPE) + set(${_var} "HEAD-HASH-NOTFOUND" PARENT_SCOPE) return() endif() @@ -110,19 +96,17 @@ function(git_describe _var) WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" RESULT_VARIABLE res OUTPUT_VARIABLE out - ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE) + ERROR_QUIET + OUTPUT_STRIP_TRAILING_WHITESPACE + ) if(NOT res EQUAL 0) set(out "${out}-${res}-NOTFOUND") endif() - set(${_var} - "${out}" - PARENT_SCOPE) + set(${_var} "${out}" PARENT_SCOPE) endfunction() function(git_get_exact_tag _var) git_describe(out --exact-match ${ARGN}) - set(${_var} - "${out}" - PARENT_SCOPE) + set(${_var} "${out}" PARENT_SCOPE) endfunction() diff --git a/cmake/GoogleSanitizers.cmake b/cmake/GoogleSanitizers.cmake index f1af4659..0a616ccb 100644 --- a/cmake/GoogleSanitizers.cmake +++ b/cmake/GoogleSanitizers.cmake @@ -56,14 +56,11 @@ function(_check_sanitizer_flags _flag _var) set(ENV{${v}} C) endforeach() check_compiler_flag_common_patterns(_common_patterns) - check_cxx_source_compiles("int main() { return 0; }" ${_var} - ${_common_patterns}) + check_cxx_source_compiles("int main() { return 0; }" ${_var} ${_common_patterns}) foreach(v IN LISTS _locale_vars) set(ENV{${v}} ${_locale_vars_saved_${v}}) endforeach() - set(${_var} - "${${_var}}" - PARENT_SCOPE) + set(${_var} "${${_var}}" PARENT_SCOPE) cmake_pop_check_state() endfunction() @@ -71,11 +68,12 @@ endfunction() macro(_report_error sanitizer sanitizer_lib) message( STATUS - "\ + "\ WARNING: ${sanitizer} Sanitizer was requested but is not working!\n\ -- => You may want to do the following:\n\ -- 1- Check that your compiler(${CMAKE_CXX_COMPILER}) does support it,\n\ --- 2- Make sure ${sanitizer_lib} is installed.") +-- 2- Make sure ${sanitizer_lib} is installed." + ) endmacro() # ---- Address Sanitizer @@ -103,8 +101,8 @@ function(asap_add_google_asan target) add_library(internal_asan INTERFACE IMPORTED) set_target_properties( internal_asan - PROPERTIES INTERFACE_COMPILE_OPTIONS "${SANITIZER_FLAGS_ASAN}" - INTERFACE_LINK_OPTIONS "${SANITIZER_FLAGS_ASAN}") + PROPERTIES INTERFACE_COMPILE_OPTIONS "${SANITIZER_FLAGS_ASAN}" INTERFACE_LINK_OPTIONS "${SANITIZER_FLAGS_ASAN}" + ) endif() target_link_libraries(${target} PRIVATE internal_asan) endif() @@ -117,8 +115,7 @@ function(asap_add_google_ubsan target) # To use UBSan, compile and link your program with -fsanitize=undefined. To # get nicer output for file names, we'll only keep the last 3 components of # the path. - set(SANITIZER_FLAGS_UBSAN "-fsanitize=undefined" - "-fsanitize-undefined-strip-path-components=-2") + set(SANITIZER_FLAGS_UBSAN "-fsanitize=undefined" "-fsanitize-undefined-strip-path-components=-2") if(NOT DEFINED COMPILER_SUPPORTS_UBSAN) # We'll use these flags to detect if the compiler supports ASan or not @@ -135,8 +132,8 @@ function(asap_add_google_ubsan target) add_library(internal_ubsan INTERFACE IMPORTED) set_target_properties( internal_ubsan - PROPERTIES INTERFACE_COMPILE_OPTIONS "${SANITIZER_FLAGS_UBSAN}" - INTERFACE_LINK_OPTIONS "${SANITIZER_FLAGS_UBSAN}") + PROPERTIES INTERFACE_COMPILE_OPTIONS "${SANITIZER_FLAGS_UBSAN}" INTERFACE_LINK_OPTIONS "${SANITIZER_FLAGS_UBSAN}" + ) endif() target_link_libraries(${target} PRIVATE internal_ubsan) endif() @@ -164,8 +161,8 @@ function(asap_add_google_tsan target) add_library(internal_tsan INTERFACE IMPORTED) set_target_properties( internal_tsan - PROPERTIES INTERFACE_COMPILE_OPTIONS "${SANITIZER_FLAGS_TSAN}" - INTERFACE_LINK_OPTIONS "${SANITIZER_FLAGS_TSAN}") + PROPERTIES INTERFACE_COMPILE_OPTIONS "${SANITIZER_FLAGS_TSAN}" INTERFACE_LINK_OPTIONS "${SANITIZER_FLAGS_TSAN}" + ) endif() target_link_libraries(${target} PRIVATE internal_tsan) endif() @@ -186,9 +183,7 @@ function(asap_add_sanitizers target) endif() # Add -O2 to get some reasonable performance during the test - if(ASAP_WITH_GOOGLE_ASAN - OR ASAP_WITH_GOOGLE_UBSAN - OR ASAP_WITH_GOOGLE_TSAN) + if(ASAP_WITH_GOOGLE_ASAN OR ASAP_WITH_GOOGLE_UBSAN OR ASAP_WITH_GOOGLE_TSAN) target_compile_options(${target} PRIVATE -O2) endif() endfunction() diff --git a/cmake/LogHelpers.cmake b/cmake/LogHelpers.cmake index 1017a4d5..43e3b3c6 100644 --- a/cmake/LogHelpers.cmake +++ b/cmake/LogHelpers.cmake @@ -34,17 +34,14 @@ macro(asap_push_project project_name) if(${META_PROJECT_ID}_IS_MASTER_PROJECT) message("=> [${depth}] in project ${ASAP_LOG_PROJECT_HIERARCHY} (master)") else() - message( - "=> [${depth}] in project ${ASAP_LOG_PROJECT_HIERARCHY} (sub-project)") + message("=> [${depth}] in project ${ASAP_LOG_PROJECT_HIERARCHY} (sub-project)") endif() endmacro() macro(asap_pop_project project_name) list(POP_BACK ASAP_LOG_PROJECT_HIERARCHY_STACK removed) if(NOT removed STREQUAL "[${project_name}]") - message( - FATAL_ERROR - "Project [${removed}] was pushed but not popped, please fix this") + message(FATAL_ERROR "Project [${removed}] was pushed but not popped, please fix this") endif() list(JOIN ASAP_LOG_PROJECT_HIERARCHY_STACK " > " ASAP_LOG_PROJECT_HIERARCHY) list(LENGTH ASAP_LOG_PROJECT_HIERARCHY_STACK depth) @@ -63,9 +60,7 @@ endmacro() macro(asap_pop_module module_name) list(POP_BACK ASAP_LOG_PROJECT_HIERARCHY_STACK removed) if(NOT removed STREQUAL "(${module_name})") - message( - FATAL_ERROR - "Module [${removed}] was pushed but not popped, please fix this") + message(FATAL_ERROR "Module [${removed}] was pushed but not popped, please fix this") endif() list(JOIN ASAP_LOG_PROJECT_HIERARCHY_STACK " > " ASAP_LOG_PROJECT_HIERARCHY) list(LENGTH ASAP_LOG_PROJECT_HIERARCHY_STACK depth) diff --git a/cmake/SphinxGeneration.cmake b/cmake/SphinxGeneration.cmake index 41fb2a4f..671243a0 100644 --- a/cmake/SphinxGeneration.cmake +++ b/cmake/SphinxGeneration.cmake @@ -38,8 +38,7 @@ if(SPHINX_FOUND) function(_add_dependecy_to_master module_sphinx_target) if(${META_PROJECT_ID}_IS_MASTER_PROJECT) _master_sphinx_target() - add_dependencies(${master_sphinx_target}_sphinx - ${module_sphinx_target}_sphinx) + add_dependencies(${master_sphinx_target}_sphinx ${module_sphinx_target}_sphinx) endif() endfunction() @@ -56,23 +55,20 @@ if(SPHINX_FOUND) file(MAKE_DIRECTORY "${SPHINX_TARGET_WORKDIR}") endif() # Do @ substitutions in the sphinx config file for the module - configure_file("${CMAKE_CURRENT_SOURCE_DIR}/doc/conf.py.in" - "${CMAKE_CURRENT_SOURCE_DIR}/doc/conf.py" @ONLY) + configure_file("${CMAKE_CURRENT_SOURCE_DIR}/doc/conf.py.in" "${CMAKE_CURRENT_SOURCE_DIR}/doc/conf.py" @ONLY) # Add a target for building the sphinx documentation of the module - message( - STATUS "[sphinx] Adding module sphinx target: ${TARGET_NAME}_sphinx") + message(STATUS "[sphinx] Adding module sphinx target: ${TARGET_NAME}_sphinx") add_custom_target( ${TARGET_NAME}_sphinx COMMAND - ${SPHINX_EXECUTABLE} -q -b html -c "${EXHALE_TARGET_WORKDIR}" -d - "${SPHINX_TARGET_WORKDIR}/_doctrees" "${CMAKE_CURRENT_SOURCE_DIR}/doc" - "${SPHINX_TARGET_WORKDIR}/html" + ${SPHINX_EXECUTABLE} -q -b html -c "${EXHALE_TARGET_WORKDIR}" -d "${SPHINX_TARGET_WORKDIR}/_doctrees" + "${CMAKE_CURRENT_SOURCE_DIR}/doc" "${SPHINX_TARGET_WORKDIR}/html" WORKING_DIRECTORY "${SPHINX_TARGET_WORKDIR}" VERBATIM - COMMENT "Generating `sphinx` documentation for `${TARGET_NAME}`") - set_target_properties(${TARGET_NAME}_sphinx PROPERTIES EXCLUDE_FROM_ALL - TRUE) + COMMENT "Generating `sphinx` documentation for `${TARGET_NAME}`" + ) + set_target_properties(${TARGET_NAME}_sphinx PROPERTIES EXCLUDE_FROM_ALL TRUE) # Finally add the module sphinx target as a dependency for the overall # sphinx target if(${META_PROJECT_ID}_IS_MASTER_PROJECT) @@ -98,15 +94,15 @@ if(SPHINX_FOUND) set(index_file_src "${CMAKE_CURRENT_SOURCE_DIR}/doc/index.html") set(index_file_out "${CMAKE_CURRENT_BINARY_DIR}/sphinx/index.html") if(EXISTS ${index_file_src}) - message( - STATUS "Will use project custom doc index file: ${index_file_src}") + message(STATUS "Will use project custom doc index file: ${index_file_src}") # Add a target for copying the index.html from the doc dir to the sphinx # build dir. A dependency on this target will be added to the master # sphinx target. add_custom_command( OUTPUT ${index_file_out} COMMAND ${CMAKE_COMMAND} -E copy ${index_file_src} ${index_file_out} - DEPENDS ${index_file_src}) + DEPENDS ${index_file_src} + ) add_custom_target(copy_doc_index ALL DEPENDS ${index_file_out}) add_dependencies(${master_sphinx_target}_sphinx copy_doc_index) endif() @@ -114,13 +110,9 @@ if(SPHINX_FOUND) endfunction() _add_master_sphinx_target() endif() - else(SPHINX_FOUND) - message(WARNING "`sphinx` is not available on this system! " - "Restructured text documentation generation targets " - "will not be added.") + message(STATUS "Restructured text documentation generation targets will not be added.") function(asap_with_sphinx TARGET_NAME) - endfunction() endif(SPHINX_FOUND) diff --git a/cmake/TestTargets.cmake b/cmake/TestTargets.cmake index 73214ef2..08493879 100644 --- a/cmake/TestTargets.cmake +++ b/cmake/TestTargets.cmake @@ -27,7 +27,8 @@ macro(asap_add_test target) if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang") asap_set_compile_options( ${target} ADD "-Wno-used-but-marked-unused" "-Wno-global-constructors" - "-Wno-unused-member-function") + "-Wno-unused-member-function" + ) endif() endif() set_target_properties(${target} PROPERTIES FOLDER "Unit Tests") @@ -52,8 +53,6 @@ function(asap_add_test_library target) asap_set_compile_options(${target}) set_target_properties( ${target} - PROPERTIES FOLDER "Test Libraries" - VERSION ${META_MODULE_VERSION} - SOVERSION ${META_MODULE_VERSION_MAJOR} - DEBUG_POSTFIX "d") + PROPERTIES FOLDER "Test Libraries" VERSION ${META_MODULE_VERSION} SOVERSION ${META_MODULE_VERSION_MAJOR} DEBUG_POSTFIX "d" + ) endfunction() diff --git a/doc/getting-started/devenv.rst b/doc/getting-started/devenv.rst index 0ff5fce4..6891d0c8 100644 --- a/doc/getting-started/devenv.rst +++ b/doc/getting-started/devenv.rst @@ -563,7 +563,7 @@ recommend the following: * On Linux, you can of course use the distribution package manager to get a pre-built package, but they are in general quite old. - + The better alternative is to download and manually install the [latest pre-built binaries](https://ccache.dev/download.html) from the `ccache` GitHub page. diff --git a/doc/getting-started/index.rst b/doc/getting-started/index.rst index b264a96b..09fd7fe5 100644 --- a/doc/getting-started/index.rst +++ b/doc/getting-started/index.rst @@ -92,4 +92,3 @@ organization's policies and style.* *when using this starter project to build your own project, you might follow the instructions in this guide to customize it to fit your needs or your organization's policies and style.* - diff --git a/doc/license.rst b/doc/license.rst index 0818576a..3aadb7ce 100644 --- a/doc/license.rst +++ b/doc/license.rst @@ -15,4 +15,3 @@ License Last Updated on |date| .. include:: ../LICENSE - diff --git a/doxygen/footer.html b/doxygen/footer.html index 2924e1f9..523ae5f9 100644 --- a/doxygen/footer.html +++ b/doxygen/footer.html @@ -29,4 +29,4 @@ - \ No newline at end of file + diff --git a/doxygen/header.html b/doxygen/header.html index 12dbfcb5..7e832fe0 100644 --- a/doxygen/header.html +++ b/doxygen/header.html @@ -127,4 +127,4 @@ - \ No newline at end of file + diff --git a/tools/version-info/CMakeLists.txt b/tools/version-info/CMakeLists.txt index 56277671..383ab7a0 100644 --- a/tools/version-info/CMakeLists.txt +++ b/tools/version-info/CMakeLists.txt @@ -25,7 +25,8 @@ asap_declare_module( VERSION_MINOR "0" VERSION_PATCH - "0") + "0" +) # ============================================================================== # Build instructions @@ -48,22 +49,19 @@ asap_add_executable(${MODULE_TARGET_NAME} WARNING SOURCES "src/main.cpp") target_compile_features(${MODULE_TARGET_NAME} PUBLIC cxx_constexpr) -cmake_path(SET version_include_dir ${CMAKE_CURRENT_BINARY_DIR}/../../include - NORMALIZE) +cmake_path(SET version_include_dir ${CMAKE_CURRENT_BINARY_DIR}/../../include NORMALIZE) target_include_directories( ${MODULE_TARGET_NAME} PUBLIC $ $ - PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}) + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} +) # ------------------------------------------------------------------------------ # Run executable test # ------------------------------------------------------------------------------ # Always run the version-info as part of ctest suite -add_test( - NAME "Misc:version-info" - COMMAND ${MODULE_TARGET_NAME} - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) +add_test(NAME "Misc:version-info" COMMAND ${MODULE_TARGET_NAME} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) # ============================================================================== # Deployment instructions @@ -78,17 +76,20 @@ if(${META_PROJECT_ID}_INSTALL) install( TARGETS ${MODULE_TARGET_NAME} EXPORT "${TARGETS_EXPORT_NAME}" - COMPONENT runtime + COMPONENT + runtime RUNTIME DESTINATION ${ASAP_INSTALL_BIN} COMPONENT ${runtime} LIBRARY DESTINATION ${ASAP_INSTALL_SHARED} COMPONENT ${runtime} - ARCHIVE DESTINATION ${ASAP_INSTALL_LIB} COMPONENT ${dev}) + ARCHIVE DESTINATION ${ASAP_INSTALL_LIB} COMPONENT ${dev} + ) # Docs if(EXISTS ${SPHINX_BUILD_DIR}/${MODULE_TARGET_NAME}) install( DIRECTORY ${SPHINX_BUILD_DIR}/${MODULE_TARGET_NAME} DESTINATION ${ASAP_INSTALL_DOC} - COMPONENT ${MODULE_TARGET_NAME}_docs) + COMPONENT ${MODULE_TARGET_NAME}_docs + ) endif() endif()