Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
---
BasedOnStyle: LLVM
IndentWidth: 2
---
Language: Cpp
AccessModifierOffset: -2
AlignAfterOpenBracket: Align
Expand Down Expand Up @@ -106,11 +109,11 @@ IfMacros:
- KJ_IF_MAYBE
IncludeBlocks: Preserve
IncludeCategories:
- Regex: '^"(llvm|llvm-c|clang|clang-c)/'
- Regex: '^"(beman|llvm|llvm-c|clang|clang-c)/'
Priority: 2
SortPriority: 0
CaseSensitive: false
- Regex: '^(<|"(gtest|isl|json)/)'
- Regex: '^(<|"(catch2|gtest|gmock|isl|json)/)'
Priority: 3
SortPriority: 0
CaseSensitive: false
Expand Down
28 changes: 14 additions & 14 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/cpp
// README at: https://github.com/devcontainers/templates/tree/main/src/cpp

{
"name": "Beman Project Generic Devcontainer",
"image": "ghcr.io/bemanproject/infra-containers-devcontainer-gcc:14",
"postCreateCommand": "pre-commit",
"customizations": {
"vscode": {
"extensions": [
"ms-vscode.cpptools",
"ms-vscode.cmake-tools"
]
}
}
}
{
"name": "Beman Project Generic Devcontainer",
"image": "ghcr.io/bemanproject/infra-containers-devcontainer-gcc:14",
"postCreateCommand": "pre-commit",
"customizations": {
"vscode": {
"extensions": [
"ms-vscode.cpptools",
"ms-vscode.cmake-tools"
]
}
}
}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.cache
/compile_commands.json
/build

Expand Down
11 changes: 6 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,21 @@ repos:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
exclude: ^\.clang-(format|tidy)$
- id: check-added-large-files

# Clang-format for C++
# This brings in a portable version of clang-format.
# See also: https://github.com/ssciwr/clang-format-wheel
- repo: https://github.com/pre-commit/mirrors-clang-format
rev: v21.1.2
rev: v21.1.6
hooks:
- id: clang-format
types_or: [c++, c]
types_or: [c++, c, json]

# CMake linting and formatting
- repo: https://github.com/BlankSpruce/gersemi
rev: 0.22.3
rev: 0.23.1
hooks:
- id: gersemi
name: CMake linting
Expand All @@ -30,7 +31,7 @@ repos:
# Config file: .markdownlint.yaml
# Commented out to disable this by default. Uncomment to enable markdown linting.
# - repo: https://github.com/igorshubovych/markdownlint-cli
# rev: v0.42.0
# rev: v0.46.0
# hooks:
# - id: markdownlint

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

exclude: 'cookiecutter/'
exclude: 'infra/'
4 changes: 3 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

cmake_minimum_required(VERSION 3.28...4.1)
cmake_minimum_required(VERSION 3.28...4.2)

project(
beman.scope
Expand Down Expand Up @@ -91,6 +91,8 @@ install(

FILE_SET CXX_MODULES
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
CXX_MODULES_BMI
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/beman.scope/bmi-${CMAKE_CXX_COMPILER_ID}_$<CONFIG>
Comment on lines +94 to +95
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note this!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Noted. We don't have a standard for how to do this, but this seems reasonable for now -- but something we need to ultimately add into exemplar.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm going to merge this -- I've recorded an issue for us to look at bemanproject/exemplar#272 (comment)

FILE_SET HEADERS
)

Expand Down
5 changes: 5 additions & 0 deletions examples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

set(ALL_EXAMPLES scope_example unique_resource unique_resource-file)

# module tests will only compile with gcc15 or clang20 and above
if(CMAKE_CXX_SCAN_FOR_MODULES AND CMAKE_CXX_MODULE_STD)
list(APPEND ALL_EXAMPLES scope-module)
endif()

message("Examples to be built: ${ALL_EXAMPLES}")

foreach(example ${ALL_EXAMPLES})
Expand Down
6 changes: 6 additions & 0 deletions examples/scope-module.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,13 @@
// destroy noisy
// scope exit: true success: true fail: false

// #ifdef HAS_MODULE_STD
import std;
// #else
// NOTE: this needs C++23!
// #include <print>
// #endif

import beman.scope;

// clang-format off
Expand Down
16 changes: 6 additions & 10 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,17 @@ include(FetchContent)
FetchContent_Declare(
Catch2
GIT_REPOSITORY https://github.com/catchorg/Catch2.git
GIT_TAG v3.8.0
GIT_TAG v3.11.0
EXCLUDE_FROM_ALL
# FIND_PACKAGE_ARGS 3.11
)
FetchContent_MakeAvailable(Catch2)

set(ALL_TESTNAMES scope_success scope_exit scope_fail unique_resource)

# module tests will only compile with gcc15 or clang20 and above
if(CMAKE_CXX_SCAN_FOR_MODULES)
set(ALL_TESTNAMES
scope_success
scope_exit
scope_fail
unique_resource
module
)
else()
set(ALL_TESTNAMES scope_success scope_exit scope_fail unique_resource)
list(APPEND ALL_TESTNAMES module)
endif()

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