Skip to content

Commit d13c048

Browse files
committed
Use beman-install-library.cmake
1 parent 7529f88 commit d13c048

File tree

15 files changed

+527
-69
lines changed

15 files changed

+527
-69
lines changed

.clang-format

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,14 @@
11
---
2+
BasedOnStyle: LLVM
3+
Language: Json
4+
IndentWidth: 2
5+
UseTab: Never
6+
---
7+
BasedOnStyle: LLVM
8+
Language: JavaScript
9+
IndentWidth: 4
10+
UseTab: Never
11+
---
212
Language: Cpp
313
AccessModifierOffset: -2
414
AlignAfterOpenBracket: Align

.codespellignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
que
2+
cancelled
3+
copyable
4+
pullrequest
5+
snd
6+
statics
7+
Claus

.codespellrc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[codespell]
2+
builtin = clear,rare,en-GB_to_en-US,names,informal,code
3+
check-hidden =
4+
skip = ./.git,./build/*,./stagedir/*,./docs/html/*,./docs/latex/*,*.log,.*.swp,*~,*.bak,Makefile
5+
quiet-level = 2
6+
ignore-words = .codespellignore

.devcontainer/Dockerfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
2+
13
FROM mcr.microsoft.com/devcontainers/cpp:1-ubuntu-22.04
24

35
USER vscode

.devcontainer/devcontainer.json

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,15 @@
1-
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
2-
// README at: https://github.com/devcontainers/templates/tree/main/src/cpp
3-
4-
{
5-
"name": "Beman Project Generic Devcontainer",
6-
"build": {
7-
"dockerfile": "Dockerfile"
8-
},
9-
"postCreateCommand": "bash .devcontainer/postcreate.sh",
10-
"customizations": {
11-
"vscode": {
12-
"extensions": [
13-
"ms-vscode.cpptools",
14-
"ms-vscode.cmake-tools"
15-
]
16-
}
17-
}
1+
{
2+
"name": "Beman Project Generic Devcontainer",
3+
"build": {
4+
"dockerfile": "Dockerfile"
5+
},
6+
"postCreateCommand": "bash .devcontainer/postcreate.sh",
7+
"customizations": {
8+
"vscode": {
9+
"extensions": [
10+
"ms-vscode.cpptools",
11+
"ms-vscode.cmake-tools"
12+
]
1813
}
14+
}
15+
}

.devcontainer/postcreate.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
12
# Setup pre-commit
23
pre-commit
34
pre-commit install

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/.cache
22
/compile_commands.json
3-
/build
3+
build/
44
/docs/generated
55
/docs/wg21

.pre-commit-config.yaml

Lines changed: 25 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,26 +4,38 @@ repos:
44
- repo: https://github.com/pre-commit/pre-commit-hooks
55
rev: v6.0.0
66
hooks:
7-
- id: trailing-whitespace
8-
- id: end-of-file-fixer
9-
- id: check-yaml
10-
- id: check-added-large-files
7+
- id: trailing-whitespace
8+
- id: end-of-file-fixer
9+
- id: check-json
10+
- id: check-yaml
11+
exclude: ^\.clang-(format|tidy)$
12+
- id: check-added-large-files
1113

12-
# Clang-format for C++
13-
# This brings in a portable version of clang-format.
14-
# See also: https://github.com/ssciwr/clang-format-wheel
14+
# Config file: .codespellrc
15+
# - repo: https://github.com/codespell-project/codespell
16+
# rev: v2.4.1
17+
# hooks:
18+
# - id: codespell
19+
# files: ^.*\.(cmake|cpp|hpp|txt|md|json|in|yaml|yml|py|toml)$
20+
# args: ["--write", "--ignore-words", ".codespellignore" ]
21+
22+
# Clang-format for C++
23+
# This brings in a portable version of clang-format.
24+
# See also: https://github.com/ssciwr/clang-format-wheel
25+
# Config file: .clang-format
1526
- repo: https://github.com/pre-commit/mirrors-clang-format
1627
rev: v21.1.8
1728
hooks:
18-
- id: clang-format
19-
types_or: [c++, c, json]
29+
- id: clang-format
30+
types_or: [c++, c, json]
31+
exclude: docs/TODO.json
2032

21-
# CMake linting and formatting
33+
# CMake linting and formatting
2234
- repo: https://github.com/BlankSpruce/gersemi
2335
rev: 0.26.0
2436
hooks:
25-
- id: gersemi
26-
name: CMake linting
27-
exclude: ^.*/tests/.*/data/ # Exclude test data directories
37+
- id: gersemi
38+
name: CMake linting
39+
exclude: ^.*/tests/.*/data/ # Exclude test data directories
2840

2941
exclude: 'infra/'

CMakeLists.txt

Lines changed: 12 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,9 @@ project(
77
# targets (e.g., library, executable, etc.).
88
DESCRIPTION "A Beman library task (coroutine task)"
99
LANGUAGES CXX
10+
VERSION 0.1.0
1011
)
1112

12-
enable_testing()
13-
1413
# [CMAKE.SKIP_TESTS]
1514
option(
1615
BEMAN_TASK_BUILD_TESTS
@@ -26,10 +25,6 @@ option(
2625
)
2726

2827
include(FetchContent)
29-
include(GNUInstallDirs)
30-
include(CMakePackageConfigHelpers)
31-
32-
set(TARGETS_EXPORT_NAME ${CMAKE_PROJECT_NAME}Targets)
3328

3429
FetchContent_Declare(
3530
execution
@@ -41,27 +36,21 @@ FetchContent_MakeAvailable(execution)
4136

4237
add_subdirectory(src/beman/task)
4338

39+
#===============================================================================
40+
# NOTE: this must be done before tests! CK
41+
include(./cmake/beman-install-library.cmake)
42+
beman_install_library(${CMAKE_PROJECT_NAME} TARGETS ${CMAKE_PROJECT_NAME}
43+
# TODO: DEPENDENCIES [===[beman.inplace_vector 1.0.0]===] [===[beman.scope 0.0.1 EXACT]===] fmt
44+
DEPENDENCIES beman.execution
45+
)
46+
#===============================================================================
47+
48+
enable_testing()
49+
4450
if(BEMAN_TASK_BUILD_TESTS)
4551
add_subdirectory(tests/beman/task)
4652
endif()
4753

4854
if(BEMAN_TASK_BUILD_EXAMPLES)
4955
add_subdirectory(examples)
5056
endif()
51-
52-
# This will be used to replace @PACKAGE_cmakeModulesDir@
53-
set(cmakeModulesDir cmake/beman)
54-
configure_package_config_file(
55-
cmake/Config.cmake.in
56-
BemanTaskConfig.cmake
57-
INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/beman/task/
58-
PATH_VARS cmakeModulesDir
59-
NO_SET_AND_CHECK_MACRO
60-
NO_CHECK_REQUIRED_COMPONENTS_MACRO
61-
)
62-
63-
install(
64-
FILES ${CMAKE_CURRENT_BINARY_DIR}/BemanTaskConfig.cmake
65-
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/beman/task/
66-
COMPONENT beman_task_development
67-
)

CMakePresets.json

Lines changed: 77 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,26 @@
1212
"CMAKE_CXX_STANDARD": "23",
1313
"CMAKE_CXX_EXTENSIONS": true,
1414
"CMAKE_CXX_STANDARD_REQUIRED": true,
15-
"CMAKE_EXPORT_COMPILE_COMMANDS": "ON",
15+
"CMAKE_EXPORT_COMPILE_COMMANDS": true,
1616
"CMAKE_INSTALL_MESSAGE": "LAZY",
1717
"CMAKE_SKIP_TEST_ALL_DEPENDENCY": false,
18-
"CMAKE_PROJECT_TOP_LEVEL_INCLUDES": "./infra/cmake/use-fetch-content.cmake"
18+
"CMAKE_PROJECT_TOP_LEVEL_INCLUDES": "infra/cmake/use-fetch-content.cmake"
1919
}
2020
},
2121
{
2222
"name": "_debug-base",
2323
"hidden": true,
24+
"warnings": {
25+
"dev": true,
26+
"deprecated": true,
27+
"uninitialized": true,
28+
"unusedCli": true,
29+
"systemVars": false
30+
},
31+
"errors": {
32+
"dev": false,
33+
"deprecated": false
34+
},
2435
"cacheVariables": {
2536
"CMAKE_BUILD_TYPE": "Debug",
2637
"BEMAN_BUILDSYS_SANITIZER": "MaxSan"
@@ -63,7 +74,12 @@
6374
"_debug-base"
6475
],
6576
"cacheVariables": {
66-
"CMAKE_TOOLCHAIN_FILE": "infra/cmake/llvm-toolchain.cmake"
77+
"BEMAN_USE_STD_MODULE": false,
78+
"CMAKE_TOOLCHAIN_FILE": "infra/cmake/llvm-libc++-toolchain.cmake"
79+
},
80+
"environment": {
81+
"CXX": "clang++",
82+
"CMAKE_CXX_FLAGS": "-stdlib=libc++"
6783
}
6884
},
6985
{
@@ -74,7 +90,12 @@
7490
"_release-base"
7591
],
7692
"cacheVariables": {
77-
"CMAKE_TOOLCHAIN_FILE": "infra/cmake/llvm-toolchain.cmake"
93+
"BEMAN_USE_STD_MODULE": false,
94+
"CMAKE_TOOLCHAIN_FILE": "infra/cmake/llvm-libc++-toolchain.cmake"
95+
},
96+
"environment": {
97+
"CXX": "clang++",
98+
"CMAKE_CXX_FLAGS": "-stdlib=libc++"
7899
}
79100
},
80101
{
@@ -85,6 +106,7 @@
85106
"_debug-base"
86107
],
87108
"cacheVariables": {
109+
"BEMAN_USE_MODULES": false,
88110
"CMAKE_TOOLCHAIN_FILE": "infra/cmake/appleclang-toolchain.cmake"
89111
}
90112
},
@@ -96,9 +118,26 @@
96118
"_release-base"
97119
],
98120
"cacheVariables": {
121+
"BEMAN_USE_MODULES": false,
99122
"CMAKE_TOOLCHAIN_FILE": "infra/cmake/appleclang-toolchain.cmake"
100123
}
101124
},
125+
{
126+
"name": "msvc-debug",
127+
"displayName": "MSVC Debug Build",
128+
"inherits": [
129+
"_root-config",
130+
"_debug-base"
131+
],
132+
"cacheVariables": {
133+
"CMAKE_TOOLCHAIN_FILE": "infra/cmake/msvc-toolchain.cmake"
134+
},
135+
"condition": {
136+
"type": "equals",
137+
"lhs": "${hostSystemName}",
138+
"rhs": "Windows"
139+
}
140+
},
102141
{
103142
"name": "msvc-release",
104143
"displayName": "MSVC Release Build",
@@ -108,6 +147,11 @@
108147
],
109148
"cacheVariables": {
110149
"CMAKE_TOOLCHAIN_FILE": "infra/cmake/msvc-toolchain.cmake"
150+
},
151+
"condition": {
152+
"type": "equals",
153+
"lhs": "${hostSystemName}",
154+
"rhs": "Windows"
111155
}
112156
}
113157
],
@@ -159,6 +203,13 @@
159203
"_root-build"
160204
]
161205
},
206+
{
207+
"name": "msvc-debug",
208+
"configurePreset": "msvc-debug",
209+
"inherits": [
210+
"_root-build"
211+
]
212+
},
162213
{
163214
"name": "msvc-release",
164215
"configurePreset": "msvc-release",
@@ -209,6 +260,11 @@
209260
"inherits": "_test_base",
210261
"configurePreset": "appleclang-release"
211262
},
263+
{
264+
"name": "msvc-debug",
265+
"inherits": "_test_base",
266+
"configurePreset": "msvc-debug"
267+
},
212268
{
213269
"name": "msvc-release",
214270
"inherits": "_test_base",
@@ -318,6 +374,23 @@
318374
}
319375
]
320376
},
377+
{
378+
"name": "msvc-debug",
379+
"steps": [
380+
{
381+
"type": "configure",
382+
"name": "msvc-debug"
383+
},
384+
{
385+
"type": "build",
386+
"name": "msvc-debug"
387+
},
388+
{
389+
"type": "test",
390+
"name": "msvc-debug"
391+
}
392+
]
393+
},
321394
{
322395
"name": "msvc-release",
323396
"steps": [

0 commit comments

Comments
 (0)