Skip to content

Commit 8f83cab

Browse files
authored
Merge pull request #41 from OpenVicProject/add/cmake
Replace scons scripts with cmake support scripts
2 parents 9f8318f + 03627a5 commit 8f83cab

25 files changed

Lines changed: 1164 additions & 1775 deletions

.pre-commit-config.yaml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,6 @@
11
default_language_version:
22
python: python3
33

4-
exclude: |
5-
(?x)^(
6-
tools/.*py|
7-
build/cache.py|
8-
build/common_compiler_flags.py
9-
)
10-
114
repos:
125
- repo: https://github.com/astral-sh/ruff-pre-commit
136
rev: v0.7.3

README.md

Lines changed: 38 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,39 @@
11
# OpenVicProject/scripts
2-
Common Scons scripts repo for the [OpenVicProject repos](https://github.com/OpenVicProject)
3-
4-
## Required
5-
* [scons](https://scons.org/)
6-
7-
## Usage
8-
1. Call `env.SetupOptions()` and use the return value to add your options:
9-
```py
10-
opts = env.SetupOptions()
11-
opts.Add(BoolVariable("example", "Is an example", false))
12-
```
13-
2. When options are finished call `env.FinalizeOptions()` then setup your scons script using env.
2+
3+
Shared CMake helpers for the [OpenVicProject repos](https://github.com/OpenVicProject)
4+
(OpenVic, openvic-simulation, openvic-dataloader, lexy-vdf).
5+
6+
7+
Each consuming repo fetches this repo as a **pinned FetchContent tarball**
8+
9+
```cmake
10+
if(NOT COMMAND openvic_setup_base_flags)
11+
include(FetchContent)
12+
FetchContent_Declare(
13+
openvic_scripts
14+
URL "https://github.com/OpenVicProject/scripts/archive/<SHA>.tar.gz"
15+
URL_HASH SHA256=<SHA256>
16+
)
17+
FetchContent_MakeAvailable(openvic_scripts)
18+
include("${openvic_scripts_SOURCE_DIR}/cmake/OpenVicScripts.cmake")
19+
endif()
20+
```
21+
22+
## Bumping the pin in a consuming repo
23+
24+
After a change lands on `master` here:
25+
26+
1. Note the new commit SHA.
27+
2. Compute the tarball hash:
28+
```sh
29+
curl -sL https://github.com/OpenVicProject/scripts/archive/<SHA>.tar.gz | sha256sum
30+
```
31+
3. In the consumer's root `CMakeLists.txt` bootstrap block, update the `URL`
32+
SHA and the `URL_HASH SHA256=` value.
33+
34+
To test uncommitted changes to this repo from a consumer, configure the
35+
consumer with:
36+
37+
```sh
38+
cmake --preset <preset> -DFETCHCONTENT_SOURCE_DIR_OPENVIC_SCRIPTS=<path-to-this-checkout>
39+
```

0 commit comments

Comments
 (0)