Skip to content

Commit

Permalink
style: fix formatting / eol issues
Browse files Browse the repository at this point in the history
  • Loading branch information
abdes committed Oct 21, 2024
1 parent 2d66564 commit c485dbf
Show file tree
Hide file tree
Showing 28 changed files with 237 additions and 298 deletions.
2 changes: 1 addition & 1 deletion .clangd.in
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion .commitlintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
"extends": [
"@commitlint/config-conventional"
]
}
}
2 changes: 1 addition & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
}
2 changes: 1 addition & 1 deletion .vscode/extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@
"cheshirekow.cmake-format",
"editorconfig.editorconfig"
]
}
}
10 changes: 6 additions & 4 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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"
Expand Down Expand Up @@ -293,4 +291,8 @@
"files.exclude": {
"**/.sphinx": true
},
}
"accessibility.signals.terminalBell": {
"sound": "on"
},
"terminal.integrated.enableVisualBell": true,
}
52 changes: 26 additions & 26 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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")
Expand All @@ -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)
Expand Down Expand Up @@ -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)
Expand All @@ -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
Expand All @@ -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()

Expand All @@ -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
Expand All @@ -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()
Expand Down Expand Up @@ -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()

# ------------------------------------------------------------------------------
Expand All @@ -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)

Expand All @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -434,4 +434,4 @@
"configurePreset": "dev-gcc"
}
]
}
}
89 changes: 35 additions & 54 deletions cmake/AsapInstall.cmake
Original file line number Diff line number Diff line change
@@ -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()

Expand All @@ -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/<project>
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/<project>/examples
set(ASAP_INSTALL_DATA "${CMAKE_INSTALL_DATAROOTDIR}/${META_PROJECT_NAME}") # /usr/[local]/share/<project>
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/<project>
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/<project>
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/<project>/examples
set(ASAP_INSTALL_DATA "${CMAKE_INSTALL_DATAROOTDIR}/${META_PROJECT_NAME}") # /usr/[local]/share/<project>
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/<project>
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/<project>
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/<project>
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()
Expand All @@ -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()
Loading

0 comments on commit c485dbf

Please sign in to comment.