Skip to content

Commit fd9c09c

Browse files
authored
Merge pull request #33 from ednolan/ednolan_exemplarfix_20260405
Refresh to latest beman.exemplar template
2 parents 49a6a62 + 27f7c4e commit fd9c09c

28 files changed

Lines changed: 595 additions & 1171 deletions

.clang-format

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ IndentCaseBlocks: false
125125
IndentCaseLabels: false
126126
IndentExternBlock: AfterExternBlock
127127
IndentGotoLabels: true
128-
IndentPPDirectives: None
128+
IndentPPDirectives: BeforeHash
129129
IndentRequiresClause: true
130130
IndentWidth: 4
131131
IndentWrappedFunctionNames: false

.devcontainer/devcontainer.json

Lines changed: 0 additions & 16 deletions
This file was deleted.

.exemplar_version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
f5759898e1ac110fc070791b83267f13c9b50b4c

.github/CODEOWNERS

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
2-
# Codeowners for reviews on PRs
32

4-
* @TedLyngmo @ednolan @JeffGarland @inbal2l
3+
* @TedLyngmo

.github/workflows/ci_tests.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@ on:
99
pull_request:
1010
workflow_dispatch:
1111
schedule:
12-
- cron: '30 15 * * *'
12+
- cron: '53 16 * * 0'
1313

1414
jobs:
1515
beman-submodule-check:
16-
uses: bemanproject/infra-workflows/.github/workflows/reusable-beman-submodule-check.yml@1.1.0
16+
uses: bemanproject/infra-workflows/.github/workflows/reusable-beman-submodule-check.yml@1.5.0
1717

1818
preset-test:
19-
uses: bemanproject/infra-workflows/.github/workflows/reusable-beman-preset-test.yml@1.1.0
19+
uses: bemanproject/infra-workflows/.github/workflows/reusable-beman-preset-test.yml@1.5.0
2020
with:
2121
matrix_config: >
2222
[
@@ -31,7 +31,7 @@ jobs:
3131
]
3232
3333
build-and-test:
34-
uses: bemanproject/infra-workflows/.github/workflows/reusable-beman-build-and-test.yml@1.1.0
34+
uses: bemanproject/infra-workflows/.github/workflows/reusable-beman-build-and-test.yml@1.5.0
3535
with:
3636
matrix_config: >
3737
{
@@ -143,4 +143,4 @@ jobs:
143143
create-issue-when-fault:
144144
needs: [preset-test, build-and-test]
145145
if: failure() && github.event_name == 'schedule'
146-
uses: bemanproject/infra-workflows/.github/workflows/reusable-beman-create-issue-when-fault.yml@1.1.0
146+
uses: bemanproject/infra-workflows/.github/workflows/reusable-beman-create-issue-when-fault.yml@1.5.0

.github/workflows/pre-commit-check.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@ on:
88
branches:
99
- main
1010

11+
permissions:
12+
contents: read
13+
checks: write
14+
issues: write
15+
pull-requests: write
16+
1117
jobs:
1218
pre-commit:
13-
uses: bemanproject/infra-workflows/.github/workflows/reusable-beman-pre-commit.yml@1.1.0
19+
uses: bemanproject/infra-workflows/.github/workflows/reusable-beman-pre-commit.yml@1.5.0

.github/workflows/pre-commit-update.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ name: Weekly pre-commit autoupdate
55
on:
66
workflow_dispatch:
77
schedule:
8-
- cron: "0 16 * * 0"
8+
- cron: "5 15 * * 3"
99

1010
jobs:
1111
auto-update-pre-commit:
12-
uses: bemanproject/infra-workflows/.github/workflows/reusable-beman-update-pre-commit.yml@1.1.0
12+
uses: bemanproject/infra-workflows/.github/workflows/reusable-beman-update-pre-commit.yml@1.5.0
1313
secrets:
1414
APP_ID: ${{ secrets.AUTO_PR_BOT_APP_ID }}
1515
PRIVATE_KEY: ${{ secrets.AUTO_PR_BOT_PRIVATE_KEY }}

CMakeLists.txt

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

3-
cmake_minimum_required(VERSION 3.28)
3+
cmake_minimum_required(VERSION 3.30...4.3)
44

55
project(
66
beman.timed_lock_alg # CMake Project Name, which is also the name of the top-level
77
# targets (e.g., library, executable, etc.).
8-
DESCRIPTION "Beman Timed Lock Algorithms"
8+
DESCRIPTION "Timed lock algorithms for multiple lockables"
99
LANGUAGES CXX
10-
VERSION 1.0.0
10+
VERSION 0.1.0
1111
)
1212

1313
# [CMAKE.SKIP_TESTS]
@@ -24,11 +24,29 @@ option(
2424
${PROJECT_IS_TOP_LEVEL}
2525
)
2626

27-
include(CTest)
27+
# for find of beman-install-library
28+
include(infra/cmake/beman-install-library.cmake)
2829

30+
add_library(beman.timed_lock_alg)
31+
add_library(beman::timed_lock_alg ALIAS beman.timed_lock_alg)
32+
33+
target_sources(
34+
beman.timed_lock_alg
35+
PUBLIC FILE_SET HEADERS BASE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/include"
36+
)
37+
38+
set_target_properties(
39+
beman.timed_lock_alg
40+
PROPERTIES VERIFY_INTERFACE_HEADER_SETS ${PROJECT_IS_TOP_LEVEL}
41+
)
42+
43+
add_subdirectory(include/beman/timed_lock_alg)
2944
add_subdirectory(src/beman/timed_lock_alg)
3045

46+
beman_install_library(beman.timed_lock_alg TARGETS beman.timed_lock_alg)
47+
3148
if(BEMAN_TIMED_LOCK_ALG_BUILD_TESTS)
49+
enable_testing()
3250
add_subdirectory(tests/beman/timed_lock_alg)
3351
endif()
3452

CONTRIBUTING.md

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
# Development
2+
3+
## Configure and Build the Project Using CMake Presets
4+
5+
The simplest way of configuring and building the project is to use [CMake
6+
Presets](https://cmake.org/cmake/help/latest/manual/cmake-presets.7.html). Appropriate
7+
presets for major compilers have been included by default. You can use `cmake
8+
--list-presets=workflow` to see all available presets.
9+
10+
Here is an example of invoking the `gcc-debug` preset:
11+
12+
```shell
13+
cmake --workflow --preset gcc-debug
14+
```
15+
16+
Generally, there are two kinds of presets, `debug` and `release`.
17+
18+
The `debug` presets are designed to aid development, so they have debuginfo and sanitizers
19+
enabled.
20+
21+
> [!NOTE]
22+
>
23+
> The sanitizers that are enabled vary from compiler to compiler. See the toolchain files
24+
> under ([`infra/cmake`](infra/cmake/)) to determine the exact configuration used for each
25+
> preset.
26+
27+
The `release` presets are designed for production use, and
28+
consequently have the highest optimization turned on (e.g. `O3`).
29+
30+
## Configure and Build Manually
31+
32+
If the presets are not suitable for your use case, a traditional CMake invocation will
33+
provide more configurability.
34+
35+
To configure, build and test the project manually, you can run this set of commands. Note
36+
that this requires GoogleTest to be installed.
37+
38+
```bash
39+
cmake \
40+
-B build \
41+
-S . \
42+
-DCMAKE_CXX_STANDARD=20 \
43+
# Your extra arguments here.
44+
cmake --build build
45+
ctest --test-dir build
46+
```
47+
48+
> [!IMPORTANT]
49+
>
50+
> Beman projects are [passive projects](
51+
> https://github.com/bemanproject/beman/blob/main/docs/beman_standard.md#cmakepassive_projects),
52+
> so you need to specify the C++ version via `CMAKE_CXX_STANDARD` when manually
53+
> configuring the project.
54+
55+
## Dependency Management
56+
57+
### FetchContent
58+
59+
Instead of installing the project's dependencies via a package manager, you can optionally
60+
configure beman.timed_lock_alg to fetch them automatically via CMake FetchContent.
61+
62+
To do so, specify
63+
`-DCMAKE_PROJECT_TOP_LEVEL_INCLUDES=./infra/cmake/use-fetch-content.cmake`. This will
64+
bring in GoogleTest automatically along with any other dependency the project may require.
65+
66+
Example commands:
67+
68+
```shell
69+
cmake \
70+
-B build \
71+
-S . \
72+
-DCMAKE_CXX_STANDARD=20 \
73+
-DCMAKE_PROJECT_TOP_LEVEL_INCLUDES=./infra/cmake/use-fetch-content.cmake
74+
cmake --build build
75+
ctest --test-dir build
76+
```
77+
78+
The file `./lockfile.json` configures the list of dependencies and versions that will be
79+
acquired by FetchContent.
80+
81+
## Project-specific configure arguments
82+
83+
Project-specific options are prefixed with `BEMAN_TIMED_LOCK_ALG`.
84+
You can see the list of available options with:
85+
86+
```bash
87+
cmake -LH -S . -B build | grep "BEMAN_TIMED_LOCK_ALG" -C 2
88+
```
89+
90+
<details>
91+
92+
<summary>Some project-specific configure arguments</summary>
93+
94+
### `BEMAN_TIMED_LOCK_ALG_BUILD_TESTS`
95+
96+
Enable building tests and test infrastructure. Default: `ON`.
97+
Values: `{ ON, OFF }`.
98+
99+
### `BEMAN_TIMED_LOCK_ALG_BUILD_EXAMPLES`
100+
101+
Enable building examples. Default: `ON`. Values: `{ ON, OFF }`.
102+
103+
### `BEMAN_TIMED_LOCK_ALG_INSTALL_CONFIG_FILE_PACKAGE`
104+
105+
Enable installing the CMake config file package. Default: `ON`.
106+
Values: `{ ON, OFF }`.
107+
108+
This is required so that users of `beman.timed_lock_alg` can use
109+
`find_package(beman.timed_lock_alg)` to locate the library.
110+
111+
</details>

0 commit comments

Comments
 (0)