Skip to content

Commit d4236a1

Browse files
the final cleanup to my contribution (#168)
* ck * The final cut * Restore my generic workflow presets * ./.../beman-submodule update --remote --------- Co-authored-by: Dietmar Kühl <[email protected]>
1 parent 73880e9 commit d4236a1

File tree

22 files changed

+938
-515
lines changed

22 files changed

+938
-515
lines changed

.pre-commit-config.yaml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,18 @@ repos:
1414
# This brings in a portable version of clang-format.
1515
# See also: https://github.com/ssciwr/clang-format-wheel
1616
- repo: https://github.com/pre-commit/mirrors-clang-format
17-
rev: v19.1.4
17+
rev: v20.1.7
1818
hooks:
1919
- id: clang-format
2020
types_or: [c++, c, json]
2121
exclude: docs/TODO.json
2222

23-
# TODO: CMake linting and formatting
24-
# - repo: https://github.com/BlankSpruce/gersemi
25-
# rev: 0.17.1
26-
# hooks:
27-
# - id: gersemi
28-
# name: CMake linting
23+
# CMake linting and formatting
24+
- repo: https://github.com/BlankSpruce/gersemi
25+
rev: 0.20.0
26+
hooks:
27+
- id: gersemi
28+
name: CMake linting
2929

3030
# TODO: Markdown linting
3131
# Config file: .markdownlint.yaml
@@ -35,8 +35,8 @@ repos:
3535
# - id: markdownlint
3636

3737
- repo: https://github.com/codespell-project/codespell
38-
rev: v2.3.0
38+
rev: v2.4.1
3939
hooks:
4040
- id: codespell
4141
files: ^.*\.(cmake|cpp|hpp|txt|md|json|in|yaml|yml)$
42-
args: ["--ignore-words", ".codespellignore" ]
42+
args: ["-w", "--ignore-words", ".codespellignore" ]

CMakeLists.txt

Lines changed: 23 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ cmake_minimum_required(VERSION 3.25...3.31)
88
project(beman_execution VERSION 0.0.1 LANGUAGES CXX)
99

1010
if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
11-
message(FATAL_ERROR "In-source builds are not allowed!")
11+
message(FATAL_ERROR "In-source builds are not allowed!")
1212
endif()
1313

1414
set(TARGET_NAME execution)
@@ -20,112 +20,61 @@ set(TARGET_PACKAGE_NAME ${PROJECT_NAME}-config)
2020
set(TARGETS_EXPORT_NAME ${PROJECT_NAME}-targets)
2121

2222
option(
23-
BEMAN_EXECUTION_ENABLE_TESTING
24-
"Enable building tests and test infrastructure. Values: { ON, OFF }."
25-
${PROJECT_IS_TOP_LEVEL}
23+
BEMAN_EXECUTION_ENABLE_TESTING
24+
"Enable building tests and test infrastructure. Values: { ON, OFF }."
25+
${PROJECT_IS_TOP_LEVEL}
2626
)
2727

2828
option(
29-
BEMAN_EXECUTION_BUILD_EXAMPLES
30-
"Enable building examples. Values: { ON, OFF }."
31-
${PROJECT_IS_TOP_LEVEL}
29+
BEMAN_EXECUTION_BUILD_EXAMPLES
30+
"Enable building examples. Values: { ON, OFF }."
31+
${PROJECT_IS_TOP_LEVEL}
3232
)
3333

3434
option(
35-
BEMAN_EXECUTION_ENABLE_INSTALL
36-
"Install the project components. Values: { ON, OFF }."
37-
${PROJECT_IS_TOP_LEVEL}
35+
BEMAN_EXECUTION_ENABLE_INSTALL
36+
"Install the project components. Values: { ON, OFF }."
37+
${PROJECT_IS_TOP_LEVEL}
3838
)
3939

4040
include(GNUInstallDirs)
4141
set(INSTALL_CONFIGDIR ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME})
4242

43-
if(FALSE)
44-
if(PROJECT_IS_TOP_LEVEL AND NOT BEMAN_EXECUTION_ENABLE_INSTALL OR CMAKE_SKIP_INSTALL_RULES)
45-
set(CMAKE_SKIP_INSTALL_RULES ON)
46-
47-
include(FetchContent)
48-
49-
# Add project_options from https://github.com/aminya/project_options
50-
# Change the version in the following URL to update the package
51-
# (watch the releases of the repository for future updates)
52-
set(PROJECT_OPTIONS_VERSION "v0.41.0")
53-
FetchContent_Declare(
54-
_project_options URL https://github.com/aminya/project_options/archive/refs/tags/${PROJECT_OPTIONS_VERSION}.zip
55-
)
56-
FetchContent_MakeAvailable(_project_options)
57-
include(${_project_options_SOURCE_DIR}/Index.cmake)
58-
59-
# Initialize project_options variable related to this project
60-
# This overwrites `project_options` and sets `project_warnings`
61-
# uncomment to enable the options. Some of them accept one or more inputs:
62-
project_options(
63-
PREFIX
64-
${TARGET_NAME}
65-
ENABLE_CACHE
66-
# NO! # ENABLE_CLANG_TIDY
67-
# NO! ENABLE_VS_ANALYSIS
68-
# ENABLE_INTERPROCEDURAL_OPTIMIZATION
69-
# ENABLE_NATIVE_OPTIMIZATION
70-
# ENABLE_DOXYGEN
71-
# ENABLE_COVERAGE
72-
ENABLE_SANITIZER_ADDRESS
73-
ENABLE_SANITIZER_UNDEFINED
74-
# TODO: ENABLE_SANITIZER_THREAD
75-
# FIXME: on Linux only with clang++? ENABLE_SANITIZER_MEMORY
76-
ENABLE_SANITIZER_POINTER_COMPARE
77-
ENABLE_SANITIZER_POINTER_SUBTRACT
78-
ENABLE_CONTROL_FLOW_PROTECTION
79-
ENABLE_STACK_PROTECTION
80-
ENABLE_OVERFLOW_PROTECTION
81-
# ENABLE_ELF_PROTECTION
82-
# ENABLE_RUNTIME_SYMBOLS_RESOLUTION
83-
# ENABLE_COMPILE_COMMANDS_SYMLINK
84-
# ENABLE_PCH
85-
# PCH_HEADERS
86-
# WARNINGS_AS_ERRORS
87-
# ENABLE_INCLUDE_WHAT_YOU_USE
88-
# ENABLE_GCC_ANALYZER
89-
# ENABLE_BUILD_WITH_TIME_TRACE
90-
# TODO: buggy! ENABLE_UNITY
91-
# LINKER "lld"
92-
)
93-
endif()
94-
endif()
95-
9643
add_subdirectory(src/beman/execution)
9744

9845
if(BEMAN_EXECUTION_ENABLE_TESTING)
99-
enable_testing()
46+
enable_testing()
10047

101-
add_subdirectory(tests/beman/execution)
48+
add_subdirectory(tests/beman/execution)
10249
endif()
10350

10451
if(BEMAN_EXECUTION_BUILD_EXAMPLES)
105-
add_subdirectory(examples)
52+
add_subdirectory(examples)
10653
endif()
10754

10855
if(NOT BEMAN_EXECUTION_ENABLE_INSTALL OR CMAKE_SKIP_INSTALL_RULES)
109-
return()
56+
return()
11057
endif()
11158

11259
include(CMakePackageConfigHelpers)
11360

11461
write_basic_package_version_file(
115-
${CMAKE_CURRENT_BINARY_DIR}/${TARGET_PACKAGE_NAME}-version.cmake
116-
VERSION ${CMAKE_PROJECT_VERSION}
117-
COMPATIBILITY AnyNewerVersion
62+
${CMAKE_CURRENT_BINARY_DIR}/${TARGET_PACKAGE_NAME}-version.cmake
63+
VERSION ${CMAKE_PROJECT_VERSION}
64+
COMPATIBILITY AnyNewerVersion
11865
)
11966

12067
configure_package_config_file(
121-
"cmake/Config.cmake.in" ${CMAKE_CURRENT_BINARY_DIR}/${TARGET_PACKAGE_NAME}.cmake
122-
INSTALL_DESTINATION ${INSTALL_CONFIGDIR}
68+
"cmake/Config.cmake.in"
69+
${CMAKE_CURRENT_BINARY_DIR}/${TARGET_PACKAGE_NAME}.cmake
70+
INSTALL_DESTINATION ${INSTALL_CONFIGDIR}
12371
)
12472

12573
install(
126-
FILES ${CMAKE_CURRENT_BINARY_DIR}/${TARGET_PACKAGE_NAME}.cmake
74+
FILES
75+
${CMAKE_CURRENT_BINARY_DIR}/${TARGET_PACKAGE_NAME}.cmake
12776
${CMAKE_CURRENT_BINARY_DIR}/${TARGET_PACKAGE_NAME}-version.cmake
128-
DESTINATION ${INSTALL_CONFIGDIR}
77+
DESTINATION ${INSTALL_CONFIGDIR}
12978
)
13079

13180
set(CPACK_GENERATOR TGZ)

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ codespell:
124124
format: cmake-format clang-format
125125

126126
cmake-format:
127-
cmake-format -i `git diff --name-only main | egrep '(CMakeLists.txt|\.cmake)'`
127+
pre-commit run --all
128128

129129
clang-format:
130130
git clang-format main

cmake/CMakeUserPresets.json

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
{
2+
"version": 9,
3+
"cmakeMinimumRequired": {
4+
"major": 3,
5+
"minor": 30,
6+
"patch": 0
7+
},
8+
"include": [
9+
"cmake/presets/CMake${hostSystemName}Presets.json"
10+
],
11+
"buildPresets": [
12+
{
13+
"name": "debug",
14+
"configurePreset": "debug",
15+
"configuration": "Debug",
16+
"targets": [
17+
"all"
18+
]
19+
},
20+
{
21+
"name": "release",
22+
"configurePreset": "release",
23+
"configuration": "Release",
24+
"targets": [
25+
"all_verify_interface_header_sets",
26+
"all"
27+
]
28+
}
29+
],
30+
"testPresets": [
31+
{
32+
"name": "test_base",
33+
"hidden": true,
34+
"output": {
35+
"outputOnFailure": true
36+
},
37+
"execution": {
38+
"noTestsAction": "error",
39+
"stopOnFailure": false
40+
}
41+
},
42+
{
43+
"name": "debug",
44+
"inherits": "test_base",
45+
"configuration": "Debug",
46+
"configurePreset": "debug"
47+
},
48+
{
49+
"name": "release",
50+
"inherits": "test_base",
51+
"configuration": "Release",
52+
"configurePreset": "release"
53+
}
54+
],
55+
"packagePresets": [
56+
{
57+
"name": "release",
58+
"configurePreset": "release",
59+
"configurations": [
60+
"Release"
61+
],
62+
"generators": [
63+
"TGZ"
64+
]
65+
}
66+
],
67+
"workflowPresets": [
68+
{
69+
"name": "debug",
70+
"steps": [
71+
{
72+
"type": "configure",
73+
"name": "debug"
74+
},
75+
{
76+
"type": "build",
77+
"name": "debug"
78+
},
79+
{
80+
"type": "test",
81+
"name": "debug"
82+
}
83+
]
84+
},
85+
{
86+
"name": "release",
87+
"steps": [
88+
{
89+
"type": "configure",
90+
"name": "release"
91+
},
92+
{
93+
"type": "build",
94+
"name": "release"
95+
},
96+
{
97+
"type": "test",
98+
"name": "release"
99+
},
100+
{
101+
"type": "package",
102+
"name": "release"
103+
}
104+
]
105+
}
106+
]
107+
}
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
{
2+
"version": 6,
3+
"include": [
4+
"CMakeGenericPresets.json"
5+
],
6+
"configurePresets": [
7+
{
8+
"name": "debug-base-Darwin",
9+
"hidden": true,
10+
"cacheVariables": {
11+
"CMAKE_BUILD_TYPE": "Debug"
12+
},
13+
"condition": {
14+
"type": "equals",
15+
"lhs": "${hostSystemName}",
16+
"rhs": "Darwin"
17+
}
18+
},
19+
{
20+
"name": "release-base-Darwin",
21+
"hidden": true,
22+
"cacheVariables": {
23+
"CMAKE_BUILD_TYPE": "RelWithDebInfo"
24+
},
25+
"condition": {
26+
"type": "equals",
27+
"lhs": "${hostSystemName}",
28+
"rhs": "Darwin"
29+
}
30+
},
31+
{
32+
"name": "debug",
33+
"displayName": "Debug Build",
34+
"inherits": [
35+
"root-config",
36+
"debug-base-Darwin"
37+
]
38+
},
39+
{
40+
"name": "release",
41+
"displayName": "Release Build",
42+
"inherits": [
43+
"root-config",
44+
"release-base-Darwin"
45+
]
46+
}
47+
]
48+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"version": 6,
3+
"configurePresets": [
4+
{
5+
"name": "root-config",
6+
"hidden": true,
7+
"generator": "Ninja",
8+
"binaryDir": "${sourceDir}/build/${presetName}",
9+
"installDir": "${sourceDir}/stagedir",
10+
"cacheVariables": {
11+
"CMAKE_PREFIX_PATH": {
12+
"type": "path",
13+
"value": "${sourceDir}/stagedir"
14+
},
15+
"CMAKE_CXX_EXTENSIONS": true,
16+
"CMAKE_CXX_STANDARD": "23",
17+
"CMAKE_CXX_STANDARD_REQUIRED": true,
18+
"CMAKE_EXPORT_COMPILE_COMMANDS": true,
19+
"CMAKE_SKIP_TEST_ALL_DEPENDENCY": false
20+
}
21+
}
22+
]
23+
}

0 commit comments

Comments
 (0)