|
1 | 1 | # 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