Skip to content

Commit f191bef

Browse files
authored
Merge pull request #49 from ClausKlein/develop
Update pre-commit config file
2 parents 6af8df2 + d62d6c4 commit f191bef

File tree

8 files changed

+46
-32
lines changed

8 files changed

+46
-32
lines changed

.clang-format

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
---
2+
BasedOnStyle: LLVM
3+
IndentWidth: 2
4+
---
25
Language: Cpp
36
AccessModifierOffset: -2
47
AlignAfterOpenBracket: Align
@@ -106,11 +109,11 @@ IfMacros:
106109
- KJ_IF_MAYBE
107110
IncludeBlocks: Preserve
108111
IncludeCategories:
109-
- Regex: '^"(llvm|llvm-c|clang|clang-c)/'
112+
- Regex: '^"(beman|llvm|llvm-c|clang|clang-c)/'
110113
Priority: 2
111114
SortPriority: 0
112115
CaseSensitive: false
113-
- Regex: '^(<|"(gtest|isl|json)/)'
116+
- Regex: '^(<|"(catch2|gtest|gmock|isl|json)/)'
114117
Priority: 3
115118
SortPriority: 0
116119
CaseSensitive: false

.devcontainer/devcontainer.json

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
// 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
2+
// README at: https://github.com/devcontainers/templates/tree/main/src/cpp
33

4-
{
5-
"name": "Beman Project Generic Devcontainer",
6-
"image": "ghcr.io/bemanproject/infra-containers-devcontainer-gcc:14",
7-
"postCreateCommand": "pre-commit",
8-
"customizations": {
9-
"vscode": {
10-
"extensions": [
11-
"ms-vscode.cpptools",
12-
"ms-vscode.cmake-tools"
13-
]
14-
}
15-
}
16-
}
4+
{
5+
"name": "Beman Project Generic Devcontainer",
6+
"image": "ghcr.io/bemanproject/infra-containers-devcontainer-gcc:14",
7+
"postCreateCommand": "pre-commit",
8+
"customizations": {
9+
"vscode": {
10+
"extensions": [
11+
"ms-vscode.cpptools",
12+
"ms-vscode.cmake-tools"
13+
]
14+
}
15+
}
16+
}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
.cache
12
/compile_commands.json
23
/build
34

.pre-commit-config.yaml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,21 @@ repos:
77
- id: trailing-whitespace
88
- id: end-of-file-fixer
99
- id: check-yaml
10+
exclude: ^\.clang-(format|tidy)$
1011
- id: check-added-large-files
1112

1213
# Clang-format for C++
1314
# This brings in a portable version of clang-format.
1415
# See also: https://github.com/ssciwr/clang-format-wheel
1516
- repo: https://github.com/pre-commit/mirrors-clang-format
16-
rev: v21.1.2
17+
rev: v21.1.6
1718
hooks:
1819
- id: clang-format
19-
types_or: [c++, c]
20+
types_or: [c++, c, json]
2021

2122
# CMake linting and formatting
2223
- repo: https://github.com/BlankSpruce/gersemi
23-
rev: 0.22.3
24+
rev: 0.23.1
2425
hooks:
2526
- id: gersemi
2627
name: CMake linting
@@ -30,7 +31,7 @@ repos:
3031
# Config file: .markdownlint.yaml
3132
# Commented out to disable this by default. Uncomment to enable markdown linting.
3233
# - repo: https://github.com/igorshubovych/markdownlint-cli
33-
# rev: v0.42.0
34+
# rev: v0.46.0
3435
# hooks:
3536
# - id: markdownlint
3637

@@ -40,4 +41,4 @@ repos:
4041
- id: codespell
4142
args: ["--ignore-words-list=wil"]
4243

43-
exclude: 'cookiecutter/'
44+
exclude: 'infra/'

CMakeLists.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
22

3-
cmake_minimum_required(VERSION 3.28...4.1)
3+
cmake_minimum_required(VERSION 3.28...4.2)
44

55
project(
66
beman.scope
@@ -91,6 +91,8 @@ install(
9191

9292
FILE_SET CXX_MODULES
9393
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
94+
CXX_MODULES_BMI
95+
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/beman.scope/bmi-${CMAKE_CXX_COMPILER_ID}_$<CONFIG>
9496
FILE_SET HEADERS
9597
)
9698

examples/CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22

33
set(ALL_EXAMPLES scope_example unique_resource unique_resource-file)
44

5+
# module tests will only compile with gcc15 or clang20 and above
6+
if(CMAKE_CXX_SCAN_FOR_MODULES AND CMAKE_CXX_MODULE_STD)
7+
list(APPEND ALL_EXAMPLES scope-module)
8+
endif()
9+
510
message("Examples to be built: ${ALL_EXAMPLES}")
611

712
foreach(example ${ALL_EXAMPLES})

examples/scope-module.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,13 @@
1515
// destroy noisy
1616
// scope exit: true success: true fail: false
1717

18+
// #ifdef HAS_MODULE_STD
1819
import std;
20+
// #else
21+
// NOTE: this needs C++23!
22+
// #include <print>
23+
// #endif
24+
1925
import beman.scope;
2026

2127
// clang-format off

tests/CMakeLists.txt

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,17 @@ include(FetchContent)
55
FetchContent_Declare(
66
Catch2
77
GIT_REPOSITORY https://github.com/catchorg/Catch2.git
8-
GIT_TAG v3.8.0
8+
GIT_TAG v3.11.0
9+
EXCLUDE_FROM_ALL
10+
# FIND_PACKAGE_ARGS 3.11
911
)
1012
FetchContent_MakeAvailable(Catch2)
1113

14+
set(ALL_TESTNAMES scope_success scope_exit scope_fail unique_resource)
15+
1216
# module tests will only compile with gcc15 or clang20 and above
1317
if(CMAKE_CXX_SCAN_FOR_MODULES)
14-
set(ALL_TESTNAMES
15-
scope_success
16-
scope_exit
17-
scope_fail
18-
unique_resource
19-
module
20-
)
21-
else()
22-
set(ALL_TESTNAMES scope_success scope_exit scope_fail unique_resource)
18+
list(APPEND ALL_TESTNAMES module)
2319
endif()
2420

2521
message("Tests to be built: ${ALL_TESTNAMES}")

0 commit comments

Comments
 (0)