feat: added woodpecker config
Reviewed-on: #1 Co-authored-by: Tobias Schmidl <tobias@schmidl.dev> Co-committed-by: Tobias Schmidl <tobias@schmidl.dev>
This commit is contained in:
parent
70dcc822fd
commit
2c822ce773
15 changed files with 129 additions and 129 deletions
|
@ -3,12 +3,12 @@
|
|||
# SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
---
|
||||
format:
|
||||
line_width: 120
|
||||
line_width: 140
|
||||
tab_size: 4
|
||||
use_tabchars: true
|
||||
fractional_tab_policy: round-up
|
||||
max_subgroups_hwrap: 2
|
||||
max_pargs_hwrap: 3
|
||||
max_subgroups_hwrap: 3
|
||||
max_pargs_hwrap: 6
|
||||
dangle_parens: true
|
||||
dangle_align: prefix
|
||||
min_prefix_chars: 0
|
||||
|
|
8
.ecrc
Normal file
8
.ecrc
Normal file
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
"IgnoreDefaults": false,
|
||||
"Exclude": [
|
||||
"^LICENSE$",
|
||||
"^LICENSES/.*",
|
||||
"documentation/pages/about.dox"
|
||||
]
|
||||
}
|
3
.ecrc.license
Normal file
3
.ecrc.license
Normal file
|
@ -0,0 +1,3 @@
|
|||
SPDX-FileCopyrightText: 2023 Tobias Schmidl
|
||||
|
||||
SPDX-License-Identifier: AGPL-3.0-or-later
|
25
.editorconfig
Normal file
25
.editorconfig
Normal file
|
@ -0,0 +1,25 @@
|
|||
# SPDX-FileCopyrightText: 2023 Tobias Schmidl
|
||||
#
|
||||
# SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
# EditorConfig is awesome: https://EditorConfig.org
|
||||
|
||||
# top-most EditorConfig file
|
||||
root = true
|
||||
|
||||
[*]
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
end_of_line = lf
|
||||
charset = utf-8
|
||||
trim_trailing_whitespace = true
|
||||
insert_final_newline = true
|
||||
|
||||
[*.{yaml,yml}]
|
||||
indent_size = 2
|
||||
|
||||
[*.{cpp,hpp,h}]
|
||||
indent_size = 2
|
||||
|
||||
[{CMakeLists.txt,*.cmake}]
|
||||
indent_style = tabs
|
|
@ -11,6 +11,7 @@ repos:
|
|||
- id: trailing-whitespace
|
||||
- id: check-merge-conflict
|
||||
- id: check-ast
|
||||
- id: check-byte-order-marker
|
||||
- repo: https://github.com/fsfe/reuse-tool
|
||||
rev: v2.1.0
|
||||
hooks:
|
||||
|
@ -29,4 +30,15 @@ repos:
|
|||
hooks:
|
||||
- id: clang-format
|
||||
- id: clang-tidy
|
||||
- repo: https://github.com/editorconfig-checker/editorconfig-checker.python
|
||||
rev: '2.7.2'
|
||||
hooks:
|
||||
- id: editorconfig-checker
|
||||
alias: ec
|
||||
stages: [commit]
|
||||
- repo: https://github.com/compilerla/conventional-pre-commit
|
||||
rev: v2.4.0
|
||||
hooks:
|
||||
- id: conventional-pre-commit
|
||||
stages: [commit-msg]
|
||||
...
|
||||
|
|
16
.woodpecker.yml
Normal file
16
.woodpecker.yml
Normal file
|
@ -0,0 +1,16 @@
|
|||
# SPDX-FileCopyrightText: 2023 Tobias Schmidl
|
||||
#
|
||||
# SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
---
|
||||
steps:
|
||||
|
||||
editor-config:
|
||||
image: mstruebing/editorconfig-checker
|
||||
group: lint
|
||||
|
||||
reuse:
|
||||
image: fsfe/reuse:latest
|
||||
group: lint
|
||||
|
||||
...
|
|
@ -8,18 +8,11 @@ include(cmake/version-from-git.cmake)
|
|||
|
||||
# ---- Project ----
|
||||
|
||||
project(
|
||||
Glimpses
|
||||
VERSION ${VERSION_STRING}
|
||||
LANGUAGES CXX
|
||||
)
|
||||
project(Glimpses VERSION ${VERSION_STRING} LANGUAGES CXX)
|
||||
|
||||
# ---- Include guards ----
|
||||
if(PROJECT_SOURCE_DIR STREQUAL PROJECT_BINARY_DIR)
|
||||
message(
|
||||
FATAL_ERROR
|
||||
"In-source builds not allowed. Please make a new directory (called a build directory) and run CMake from there."
|
||||
)
|
||||
message(FATAL_ERROR "In-source builds not allowed. Please make a new directory (called a build directory) and run CMake from there.")
|
||||
endif()
|
||||
|
||||
# ---- Add dependencies via CPM ----
|
||||
|
@ -30,22 +23,11 @@ include(cmake/CPM.cmake)
|
|||
# PackageProject.cmake will be used to make our target installable
|
||||
CPMAddPackage("gh:TheLartians/PackageProject.cmake@1.8.0")
|
||||
|
||||
# CPMAddPackage( NAME fmt GIT_TAG 9.1.0 GITHUB_REPOSITORY fmtlib/fmt OPTIONS "FMT_INSTALL YES" # create an installable
|
||||
# target )
|
||||
# CPMAddPackage( NAME fmt GIT_TAG 9.1.0 GITHUB_REPOSITORY fmtlib/fmt OPTIONS "FMT_INSTALL YES" # create an installable target )
|
||||
|
||||
# ---- Add source files ----
|
||||
file(
|
||||
GLOB_RECURSE
|
||||
headers
|
||||
CONFIGURE_DEPENDS
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/include/*.h"
|
||||
)
|
||||
file(
|
||||
GLOB_RECURSE
|
||||
sources
|
||||
CONFIGURE_DEPENDS
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/source/*.cpp"
|
||||
)
|
||||
file(GLOB_RECURSE headers CONFIGURE_DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/include/*.h")
|
||||
file(GLOB_RECURSE sources CONFIGURE_DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/source/*.cpp")
|
||||
|
||||
# ---- Create library ----
|
||||
|
||||
|
@ -60,8 +42,7 @@ target_link_libraries(${PROJECT_NAME} PRIVATE # fmt::fmt
|
|||
)
|
||||
|
||||
target_include_directories(
|
||||
${PROJECT_NAME} PUBLIC $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
|
||||
$<INSTALL_INTERFACE:include/${PROJECT_NAME}-${PROJECT_VERSION}>
|
||||
${PROJECT_NAME} PUBLIC $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include> $<INSTALL_INTERFACE:include/${PROJECT_NAME}-${PROJECT_VERSION}>
|
||||
)
|
||||
|
||||
# the location where the project's version header will be placed should match the project's regular header paths
|
||||
|
|
9
LICENSES/MIT.txt
Normal file
9
LICENSES/MIT.txt
Normal file
|
@ -0,0 +1,9 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) <year> <copyright holders>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
@ -2,8 +2,7 @@
|
|||
#
|
||||
# SPDX-License-Identifier: CC0-1.0
|
||||
|
||||
# this script adds all subprojects to a single build to allow IDEs understand the full project
|
||||
# structure.
|
||||
# this script adds all subprojects to a single build to allow IDEs understand the full project structure.
|
||||
|
||||
cmake_minimum_required(VERSION 3.14...3.22)
|
||||
|
||||
|
|
|
@ -6,19 +6,18 @@ set(CPM_DOWNLOAD_VERSION 0.38.5)
|
|||
set(CPM_HASH_SUM "192aa0ccdc57dfe75bd9e4b176bf7fb5692fd2b3e3f7b09c74856fc39572b31c")
|
||||
|
||||
if(CPM_SOURCE_CACHE)
|
||||
set(CPM_DOWNLOAD_LOCATION "${CPM_SOURCE_CACHE}/cpm/CPM_${CPM_DOWNLOAD_VERSION}.cmake")
|
||||
set(CPM_DOWNLOAD_LOCATION "${CPM_SOURCE_CACHE}/cpm/CPM_${CPM_DOWNLOAD_VERSION}.cmake")
|
||||
elseif(DEFINED ENV{CPM_SOURCE_CACHE})
|
||||
set(CPM_DOWNLOAD_LOCATION "$ENV{CPM_SOURCE_CACHE}/cpm/CPM_${CPM_DOWNLOAD_VERSION}.cmake")
|
||||
set(CPM_DOWNLOAD_LOCATION "$ENV{CPM_SOURCE_CACHE}/cpm/CPM_${CPM_DOWNLOAD_VERSION}.cmake")
|
||||
else()
|
||||
set(CPM_DOWNLOAD_LOCATION "${CMAKE_BINARY_DIR}/cmake/CPM_${CPM_DOWNLOAD_VERSION}.cmake")
|
||||
set(CPM_DOWNLOAD_LOCATION "${CMAKE_BINARY_DIR}/cmake/CPM_${CPM_DOWNLOAD_VERSION}.cmake")
|
||||
endif()
|
||||
|
||||
# Expand relative path. This is important if the provided path contains a tilde (~)
|
||||
get_filename_component(CPM_DOWNLOAD_LOCATION ${CPM_DOWNLOAD_LOCATION} ABSOLUTE)
|
||||
|
||||
file(DOWNLOAD
|
||||
https://github.com/cpm-cmake/CPM.cmake/releases/download/v${CPM_DOWNLOAD_VERSION}/CPM.cmake
|
||||
${CPM_DOWNLOAD_LOCATION} EXPECTED_HASH SHA256=${CPM_HASH_SUM}
|
||||
file(DOWNLOAD https://github.com/cpm-cmake/CPM.cmake/releases/download/v${CPM_DOWNLOAD_VERSION}/CPM.cmake ${CPM_DOWNLOAD_LOCATION}
|
||||
EXPECTED_HASH SHA256=${CPM_HASH_SUM}
|
||||
)
|
||||
|
||||
include(${CPM_DOWNLOAD_LOCATION})
|
||||
|
|
|
@ -2,69 +2,52 @@
|
|||
#
|
||||
# SPDX-License-Identifier: CC0-1.0
|
||||
|
||||
# this file contains a list of tools that can be activated and downloaded on-demand each tool is
|
||||
# enabled during configuration by passing an additional `-DUSE_<TOOL>=<VALUE>` argument to CMake
|
||||
# this file contains a list of tools that can be activated and downloaded on-demand each tool is enabled during configuration by passing an
|
||||
# additional `-DUSE_<TOOL>=<VALUE>` argument to CMake
|
||||
|
||||
# only activate tools for top level project
|
||||
if(NOT PROJECT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
|
||||
return()
|
||||
return()
|
||||
endif()
|
||||
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/CPM.cmake)
|
||||
|
||||
# enables sanitizers support using the the `USE_SANITIZER` flag available values are: Address,
|
||||
# Memory, MemoryWithOrigins, Undefined, Thread, Leak, 'Address;Undefined'
|
||||
# enables sanitizers support using the the `USE_SANITIZER` flag available values are: Address, Memory, MemoryWithOrigins, Undefined, Thread,
|
||||
# Leak, 'Address;Undefined'
|
||||
if(USE_SANITIZER OR USE_STATIC_ANALYZER)
|
||||
CPMAddPackage("gh:StableCoder/cmake-scripts#1f822d1fc87c8d7720c074cde8a278b44963c354")
|
||||
CPMAddPackage("gh:StableCoder/cmake-scripts#1f822d1fc87c8d7720c074cde8a278b44963c354")
|
||||
|
||||
if(USE_SANITIZER)
|
||||
include(${cmake-scripts_SOURCE_DIR}/sanitizers.cmake)
|
||||
endif()
|
||||
if(USE_SANITIZER)
|
||||
include(${cmake-scripts_SOURCE_DIR}/sanitizers.cmake)
|
||||
endif()
|
||||
|
||||
if(USE_STATIC_ANALYZER)
|
||||
if("clang-tidy" IN_LIST USE_STATIC_ANALYZER)
|
||||
set(CLANG_TIDY
|
||||
ON
|
||||
CACHE INTERNAL ""
|
||||
)
|
||||
else()
|
||||
set(CLANG_TIDY
|
||||
OFF
|
||||
CACHE INTERNAL ""
|
||||
)
|
||||
endif()
|
||||
if("iwyu" IN_LIST USE_STATIC_ANALYZER)
|
||||
set(IWYU
|
||||
ON
|
||||
CACHE INTERNAL ""
|
||||
)
|
||||
else()
|
||||
set(IWYU
|
||||
OFF
|
||||
CACHE INTERNAL ""
|
||||
)
|
||||
endif()
|
||||
if("cppcheck" IN_LIST USE_STATIC_ANALYZER)
|
||||
set(CPPCHECK
|
||||
ON
|
||||
CACHE INTERNAL ""
|
||||
)
|
||||
else()
|
||||
set(CPPCHECK
|
||||
OFF
|
||||
CACHE INTERNAL ""
|
||||
)
|
||||
endif()
|
||||
# cmake-lint: disable=C0103
|
||||
if(USE_STATIC_ANALYZER)
|
||||
if("clang-tidy" IN_LIST USE_STATIC_ANALYZER)
|
||||
set(CLANG_TIDY ON CACHE INTERNAL "")
|
||||
else()
|
||||
set(CLANG_TIDY OFF CACHE INTERNAL "")
|
||||
endif()
|
||||
if("iwyu" IN_LIST USE_STATIC_ANALYZER)
|
||||
set(IWYU ON CACHE INTERNAL "")
|
||||
else()
|
||||
set(IWYU OFF CACHE INTERNAL "")
|
||||
endif()
|
||||
if("cppcheck" IN_LIST USE_STATIC_ANALYZER)
|
||||
set(CPPCHECK ON CACHE INTERNAL "")
|
||||
else()
|
||||
set(CPPCHECK OFF CACHE INTERNAL "")
|
||||
endif()
|
||||
|
||||
include(${cmake-scripts_SOURCE_DIR}/tools.cmake)
|
||||
include(${cmake-scripts_SOURCE_DIR}/tools.cmake)
|
||||
|
||||
clang_tidy(${CLANG_TIDY_ARGS})
|
||||
include_what_you_use(${IWYU_ARGS})
|
||||
cppcheck(${CPPCHECK_ARGS})
|
||||
endif()
|
||||
clang_tidy(${CLANG_TIDY_ARGS})
|
||||
include_what_you_use(${IWYU_ARGS})
|
||||
cppcheck(${CPPCHECK_ARGS})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# enables CCACHE support through the USE_CCACHE flag possible values are: YES, NO or equivalent
|
||||
if(USE_CCACHE)
|
||||
CPMAddPackage("gh:TheLartians/Ccache.cmake@1.2.3")
|
||||
CPMAddPackage("gh:TheLartians/Ccache.cmake@1.2.3")
|
||||
endif()
|
||||
|
|
|
@ -12,12 +12,7 @@ execute_process(
|
|||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
if(GIT_DESCRIBE_ERROR_CODE EQUAL 0)
|
||||
string(
|
||||
REGEX MATCH
|
||||
"^v?([0-9]+)(\\.([0-9]+))?(\\.([0-9]+))?(\\.([0-9]+))?.*$"
|
||||
_
|
||||
"${GIT_DESCRIBE_VERSION_STRING}"
|
||||
)
|
||||
string(REGEX MATCH "^v?([0-9]+)(\\.([0-9]+))?(\\.([0-9]+))?(\\.([0-9]+))?.*$" _ "${GIT_DESCRIBE_VERSION_STRING}")
|
||||
if(DEFINED CMAKE_MATCH_1)
|
||||
set(VERSION_STRING "${CMAKE_MATCH_1}")
|
||||
if(DEFINED CMAKE_MATCH_3)
|
||||
|
|
|
@ -28,10 +28,7 @@ configure_file(${CMAKE_CURRENT_LIST_DIR}/conf.py ${CMAKE_CURRENT_BINARY_DIR}/con
|
|||
# cmake-lint: disable=C0113
|
||||
add_custom_target(
|
||||
GenerateDocs
|
||||
${CMAKE_COMMAND}
|
||||
-E
|
||||
make_directory
|
||||
"${DOXYGEN_OUTPUT_DIRECTORY}"
|
||||
${CMAKE_COMMAND} -E make_directory "${DOXYGEN_OUTPUT_DIRECTORY}"
|
||||
COMMAND "${m.css_SOURCE_DIR}/documentation/doxygen.py" "${CMAKE_CURRENT_BINARY_DIR}/conf.py"
|
||||
COMMAND echo "Docs written to: ${DOXYGEN_OUTPUT_DIRECTORY}"
|
||||
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
|
||||
|
|
|
@ -18,12 +18,7 @@ CPMAddPackage(NAME Glimpses SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/..)
|
|||
|
||||
# ---- Create standalone executable ----
|
||||
|
||||
file(
|
||||
GLOB
|
||||
sources
|
||||
CONFIGURE_DEPENDS
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/source/*.cpp
|
||||
)
|
||||
file(GLOB sources CONFIGURE_DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/source/*.cpp)
|
||||
|
||||
add_executable(${PROJECT_NAME} ${sources})
|
||||
|
||||
|
|
|
@ -29,12 +29,7 @@ endif()
|
|||
|
||||
# ---- Create binary ----
|
||||
|
||||
file(
|
||||
GLOB
|
||||
sources
|
||||
CONFIGURE_DEPENDS
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/source/*.cpp
|
||||
)
|
||||
file(GLOB sources CONFIGURE_DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/source/*.cpp)
|
||||
add_executable(${PROJECT_NAME} ${sources})
|
||||
target_link_libraries(
|
||||
${PROJECT_NAME}
|
||||
|
@ -46,13 +41,7 @@ set_target_properties(${PROJECT_NAME} PROPERTIES CXX_STANDARD 17)
|
|||
# enable compiler warnings
|
||||
if(NOT TEST_INSTALLED_VERSION)
|
||||
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR CMAKE_CXX_COMPILER_ID MATCHES "GNU")
|
||||
target_compile_options(
|
||||
Glimpses
|
||||
PUBLIC -Wall
|
||||
-Wpedantic
|
||||
-Wextra
|
||||
-Werror
|
||||
)
|
||||
target_compile_options(Glimpses PUBLIC -Wall -Wpedantic -Wextra -Werror)
|
||||
elseif(MSVC)
|
||||
target_compile_options(Glimpses PUBLIC /W4 /WX)
|
||||
target_compile_definitions(${PROJECT_NAME} PUBLIC DOCTEST_CONFIG_USE_STD_HEADERS)
|
||||
|
@ -63,25 +52,14 @@ endif()
|
|||
|
||||
enable_testing()
|
||||
|
||||
# Note: doctest and similar testing frameworks can automatically configure CMake tests. For other testing frameworks add
|
||||
# the tests target instead: add_test(NAME ${PROJECT_NAME} COMMAND ${PROJECT_NAME})
|
||||
# Note: doctest and similar testing frameworks can automatically configure CMake tests. For other testing frameworks add the tests target
|
||||
# instead: add_test(NAME ${PROJECT_NAME} COMMAND ${PROJECT_NAME})
|
||||
|
||||
# include(${doctest_SOURCE_DIR}/scripts/cmake/doctest.cmake) doctest_discover_tests(${PROJECT_NAME})
|
||||
|
||||
# ---- code coverage ----
|
||||
|
||||
if(ENABLE_TEST_COVERAGE)
|
||||
target_compile_options(
|
||||
Glimpses
|
||||
PUBLIC -O0
|
||||
-g
|
||||
-fprofile-arcs
|
||||
-ftest-coverage
|
||||
)
|
||||
target_link_options(
|
||||
Glimpses
|
||||
PUBLIC
|
||||
-fprofile-arcs
|
||||
-ftest-coverage
|
||||
)
|
||||
target_compile_options(Glimpses PUBLIC -O0 -g -fprofile-arcs -ftest-coverage)
|
||||
target_link_options(Glimpses PUBLIC -fprofile-arcs -ftest-coverage)
|
||||
endif()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue