Skip to content
Merged
Show file tree
Hide file tree
Changes from 110 commits
Commits
Show all changes
129 commits
Select commit Hold shift + click to select a range
dec0712
Make ystdlib a cmake library
PacificViking May 26, 2025
4aa941c
add missing ystdlib-config.cmake.in file
PacificViking May 26, 2025
662e768
add coderabbit suggestions
PacificViking May 26, 2025
93c4d50
Modify according to coderabbit suggestion
PacificViking May 27, 2025
0a88c49
add changes according to coderabbit suggestions
PacificViking May 28, 2025
e4dc708
fix gersemi linting errors for cmakelists
PacificViking May 29, 2025
a3bc9d5
this cmake.in file is preprocessed and should not be linted
PacificViking May 30, 2025
601c462
fix coderabbit suggestion
PacificViking Jun 5, 2025
2e54cdb
public target_compile_features
PacificViking Jun 5, 2025
f5e2b4b
Merge remote-tracking branch 'upstream/main' into dev
PacificViking Jun 6, 2025
89f53c1
cleanup unnecessary dependencies, merge new yscope-dev-utils
PacificViking Jun 6, 2025
1d313c3
use correct yscope-dev-utils version
PacificViking Jun 6, 2025
2f9f30b
Merge branch 'backup-main'
PacificViking Jun 6, 2025
a63a4f2
fix version ordering error
PacificViking Jun 6, 2025
847162f
add example, require boost
PacificViking Jun 6, 2025
5e55b58
rename project name and relevant variables to ystdlib (from YSTDLIB_CPP)
PacificViking Jun 6, 2025
77fc7ea
not working: splitting libraries
PacificViking Jun 6, 2025
521c1f9
working examples without filesets but with separate library targets
PacificViking Jun 6, 2025
1c44077
Merge branch 'dev'
PacificViking Jun 6, 2025
c8a3c93
modify according to coderabbit suggestions
PacificViking Jun 6, 2025
ef48733
fix examples/cmakelists according to coderabbit
PacificViking Jun 6, 2025
f62ee82
use filesets
PacificViking Jun 8, 2025
7a625e7
bump examples cmake version according to coderabbit
PacificViking Jun 9, 2025
277dc1d
remove examples
PacificViking Jun 9, 2025
f25859e
remove YSTDLIB_CPP_* to ystdlib_* change
PacificViking Jun 9, 2025
e94d6ae
update readme for new usage and dependencies
PacificViking Jun 9, 2025
36ab649
Revert "remove YSTDLIB_CPP_* to ystdlib_* change"
PacificViking Jun 9, 2025
cafa9be
increase consistency in naming everything ystdlib (rather than
PacificViking Jun 9, 2025
134b1e0
remove unneeded cxx direction
PacificViking Jun 9, 2025
487844d
further removal of unneeded cxx
PacificViking Jun 9, 2025
96b2811
Apply suggestions from code review
PacificViking Jun 10, 2025
07df644
further changes according to review
PacificViking Jun 10, 2025
9a7400c
fix cmake linting errors
PacificViking Jun 10, 2025
caff1ae
update readme according to coderabbit suggestions
PacificViking Jun 10, 2025
630d389
Refactor taskfiles and add build, install, and example tasks for all …
davidlion Jun 10, 2025
6c55590
Fix rabbit review.
davidlion Jun 10, 2025
7f2745f
Remove unnecessary config PATH_VARS and move ystdlib_INSTALL_CONFIG_D…
davidlion Jun 11, 2025
93b4a70
Fix boost version with components, update settings file path to default.
davidlion Jun 11, 2025
3ab6484
Update testbin path to new version.
davidlion Jun 11, 2025
f449cce
Resolve rabbit nits.
davidlion Jun 11, 2025
b1243ed
Drop deps utils hack for boost that doesn't work. Update manually for…
davidlion Jun 11, 2025
d14bfdb
Rabbit nit.
davidlion Jun 11, 2025
aea57aa
Try to make boost dependency more robust.
davidlion Jun 11, 2025
729db5c
add examples
PacificViking Jun 11, 2025
43ee6cc
add other targets for examples and a README
PacificViking Jun 11, 2025
c4e67c4
Bump dev-utils; fix lint tasks.
davidlion Jun 11, 2025
cd7b3aa
Fix gersemirc path.
davidlion Jun 11, 2025
2dbca54
Update examples.
davidlion Jun 11, 2025
22a27c8
Refactor cmake install. Add missing boost arg define.
davidlion Jun 11, 2025
56470ad
Refactor taskfiles.
davidlion Jun 11, 2025
8183762
Add examples to gh workflow.
davidlion Jun 11, 2025
1e5b9bc
Add readme pass.
davidlion Jun 11, 2025
e9cbd7c
Add missing test: prefix to gh workflow.
davidlion Jun 11, 2025
596beb5
Add uv to workflow and readme.
davidlion Jun 11, 2025
28916c0
Fix typo in examples cmake.
davidlion Jun 11, 2025
a9f7054
Refactor validate tasks.
davidlion Jun 11, 2025
b329870
Refactor linking-tests.cpp.
davidlion Jun 11, 2025
7c62982
Update and refactor taskfiles.
davidlion Jun 11, 2025
1633044
Fix linking-tests.cpp.
davidlion Jun 11, 2025
ed60a76
Temporary change of dev-utils for CI testing.
davidlion Jun 11, 2025
d351128
Change interface inheritance to pulbic.
davidlion Jun 11, 2025
ebb9984
Disable release unit tests in workflow.
davidlion Jun 11, 2025
95cb0a0
Fix examles task in gh workflow.
davidlion Jun 11, 2025
5b944b0
Fix copy-paste error messages in examples.
davidlion Jun 11, 2025
962c1e0
allow separate target installations through components (relies on
PacificViking Jun 11, 2025
7198859
Merge branch 'install_separate'
PacificViking Jun 11, 2025
edecfb2
Fix readme link for github syntax.
davidlion Jun 11, 2025
30ba595
install task tweak.
davidlion Jun 11, 2025
0395b33
Revert all taskfile related changes for a new PR.
davidlion Jun 11, 2025
bb56c10
Readme pass.
davidlion Jun 11, 2025
346dcfe
Apply suggestions from code review
davidlion Jun 11, 2025
5a404d5
Example readme tweak.
davidlion Jun 11, 2025
2de6525
Obey gersemi.
davidlion Jun 11, 2025
f02a658
Tweak examples/README.md.
davidlion Jun 12, 2025
1637b6e
Update examples/README.md
davidlion Jun 12, 2025
0688e49
Tweak examples/README.md.
davidlion Jun 12, 2025
0e0651e
Fix dumb mistake.
davidlion Jun 12, 2025
7133493
Large switch env variable to handle library installation selection.
davidlion Jun 14, 2025
1e7cd87
Revert require_argument_values to fix logic mistake; Address rabbit n…
davidlion Jun 15, 2025
24ea39a
Address rabbit comments; Improve style consistency.
davidlion Jun 15, 2025
64f3929
Fix readme install prefix.
davidlion Jun 15, 2025
7687b09
Apply suggestions from code review.
davidlion Jun 16, 2025
2066564
Address review comments.
davidlion Jun 16, 2025
7d89e7e
Refactor repeated string to variable.
davidlion Jun 16, 2025
8453a16
Gersemi
davidlion Jun 16, 2025
dbd5f01
Tweak cmake logic with rabbit's help.
davidlion Jun 16, 2025
a50a033
Taskfile rewrite squash.
davidlion Jun 22, 2025
23bd52a
Merge remote-tracking branch 'upstream/main' into taskfile-rewrite
davidlion Jul 7, 2025
da59010
Merge remote-tracking branch 'upstream/main' into taskfile-rewrite
davidlion Jul 8, 2025
a8a6715
Remove old files from merge.
davidlion Jul 16, 2025
6de51cd
deps
davidlion Jul 22, 2025
a6be036
build -> ystdlib
davidlion Jul 22, 2025
e4d8ef0
Build changes; Update dev-utils to fix boost task dir bug.
davidlion Jul 23, 2025
8a9f7ec
Update test; Switch to verb-*
davidlion Jul 23, 2025
f801197
Update examples.
davidlion Jul 23, 2025
b32a08d
Update linting.
davidlion Jul 23, 2025
724d94a
Remove now unused utils.
davidlion Jul 23, 2025
be182bf
Fix libraries param.
davidlion Jul 23, 2025
692a7e1
Fix test location mistake; Fix readme library separator.
davidlion Jul 23, 2025
57cc01a
Revert most linting changes.
davidlion Jul 24, 2025
aa40c4d
Merge remote-tracking branch 'upstream/main' into taskfile-rewrite
davidlion Jul 24, 2025
8e78ec0
Fix examples mistake; Tweak examples readme.
davidlion Jul 24, 2025
27044bc
Revert venv include.
davidlion Jul 24, 2025
04c188f
Revert includes changes and dev-utils bump.
davidlion Jul 24, 2025
4814964
Add include refactoring back in.
davidlion Jul 24, 2025
926a20c
Fix dead compile commands variable.
davidlion Jul 24, 2025
bd3b37f
Fix markdown anchors.
davidlion Jul 24, 2025
5e94ac6
Fix yaml line lengths.
davidlion Jul 24, 2025
4800038
Add requires to test:run-unit-test.
davidlion Jul 24, 2025
bd23999
Forward ystdlib_LIBRARIES in test task.
davidlion Jul 24, 2025
bbf6d8f
Use html for anchor.
davidlion Jul 25, 2025
a5d9eea
Refactor to simplify code through minor duplication.
davidlion Jul 28, 2025
0aa2b0c
Fix generate task call in linting.
davidlion Jul 28, 2025
3f5ac82
Fix link in readme.
davidlion Jul 28, 2025
41803a7
Add missing updates pointed out by rabbit.
davidlion Jul 28, 2025
4146a03
Refactor deps and cmds to make more logical sense.
davidlion Jul 29, 2025
6937f07
Apply suggestions from code review.
davidlion Jul 30, 2025
68ae65b
Move build task in tests to deps from cmds.
davidlion Jul 30, 2025
8e49388
Add ystdlib_LIBRARIES explicitly in install tasks.
davidlion Jul 30, 2025
69a7e8e
Explicitly link to cmake build in cmake install.
davidlion Jul 30, 2025
298ece0
lock uv version.
davidlion Jul 30, 2025
8c45963
README attempt.
davidlion Jul 30, 2025
20c5ee2
README tweaks.
davidlion Jul 30, 2025
c046aac
Sneaky line length.
davidlion Jul 30, 2025
47adf89
Wrap path in quotes.
davidlion Jul 30, 2025
1d5a47c
Make anchors lower case.
davidlion Jul 30, 2025
76d5f64
README tweaks from Kirk.
davidlion Jul 30, 2025
c6dccc2
Update README.md
davidlion Jul 31, 2025
ae58bfa
README tweaks.
davidlion Jul 31, 2025
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
2 changes: 1 addition & 1 deletion .gersemirc
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@

definitions:
- "cmake/ystdlib-helpers.cmake"
- "build/deps/Catch2/Catch2-src/extras/Catch.cmake"
- "build/deps/Catch2-src/extras/Catch.cmake"
line_length: 100
list_expansion: "favour-expansion"
4 changes: 4 additions & 0 deletions .github/workflows/code-linting-checks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ jobs:
shell: "bash"
run: "npm install -g @go-task/cli"

- name: "Install uv"
shell: "bash"
run: "curl --fail --location --silent --show-error https://astral.sh/uv/install.sh | sh"

- name: "Run lint task"
shell: "bash"
run: "task lint:check"
11 changes: 9 additions & 2 deletions .github/workflows/unit-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ jobs:
- "macos-15"
- "ubuntu-22.04"
- "ubuntu-24.04"
build_type:
- "debug"
- "release"
runs-on: "${{matrix.os}}"
steps:
- uses: "actions/checkout@v4"
Expand All @@ -45,7 +48,7 @@ jobs:
brew install coreutils
brew install llvm@16

- name: "Run unit tests"
- name: "Run unit tests and examples"
env: >-
${{
'macos-14' == matrix.os
Expand All @@ -55,4 +58,8 @@ jobs:
}')
|| fromJson('{}')
}}
run: "task test-all"
# Currently unit tests rely on cassert and fail to compile in release mode.
run: |-
task test:run-debug
task examples:build-${{matrix.build_type}}
./build/examples/${{matrix.build_type}}/linking-tests
55 changes: 42 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ Follow the steps below to develop and contribute to the project.
* CMake 3.23 or higher
* Python 3.10 or higher
* [Task] 3.40.0 or higher
* [uv] 0.7.10 or higher

## Set up
Initialize and update submodules:
Expand All @@ -52,6 +53,7 @@ git submodule update --init --recursive

If you want to open the project in an IDE, run the following command to install any necessary
dependencies from source:

```shell
task deps:install-all
```
Expand All @@ -61,23 +63,26 @@ task deps:install-all
The library can be built directly using [CMake](#using-cmake) or indirectly using
[Task](#using-task).

### Using Task
### Using Task {#build-task}

To build all targets:
To build all libraries:
```shell
task build:all
task ystdlib:build-release
```

To build an executable containing all unit tests:
```shell
task build:unit-test-all
```
To build a subset of libraries, set the parameter `ystdlib_LIBRARIES` to a semicolon-separated (`;`)
list of library names. The library names match their [directory name in src/](./src/ystdlib). For
example:

To build an executable containing a single library's unit tests:
```shell
task build:unit-test-<lib_name>
task ystdlib:build-release ystdlib_LIBRARIES="containers;io_interface"
```

> [!NOTE]
> Internal dependencies of the libraries you choose will be automatically built, even if you don't
> explicitly specify them. In the example, specifying `io_interface` automatically adds
> `wrapped_facade_headers` to the build.

### Using CMake

To build all libraries, run:
Expand All @@ -103,21 +108,44 @@ cmake --build ./build

## Installing

After [building](#building), install with:
### Using Task

To build and install all libraries, run:

```shell
task ystdlib:install-release INSTALL_PREFIX="$HOME/.local"
```

To build and install a subset of libraries, set the variable `ystdlib_LIBRARIES` the same as in the
section, [Building: Using Task](build-task). For example:

```shell
task ystdlib:install-release \
INSTALL_PREFIX="$HOME/.local" \
ystdlib_LIBRARIES="containers;io_interface"
```

### Using CMake

After [building](#building), to install all built libraries run:

```shell
cmake --install "./build" --prefix "$HOME/.local"
```

## Testing

To build and run all unit tests:

```shell
task test-all
task test:run-debug
```

To build and run unit tests for a specific library:
To build and run unit tests for a subset of libraries, set the variable `ystdlib_LIBRARIES` the same
as in the section, [Building: Using Task](build-task). For example:

```shell
task test-<lib_name>
task test:run-debug ystdlib_LIBRARIES="containers;io_interface"
```

When generating a testing target, the CMake variable `BUILD_TESTING` is followed (unless overruled
Expand Down Expand Up @@ -145,3 +173,4 @@ task -a
Look for all tasks under the `lint` namespace (identified by the `lint:` prefix).

[Task]: https://taskfile.dev
[uv]: https://docs.astral.sh/uv
24 changes: 22 additions & 2 deletions examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,33 @@ This directory contains example programs that demonstrate how to use the ystdlib
The example program `linking-tests` references all of ystdlib's library targets to ensure they can
be installed and linked correctly.

## Requirements
## Building

### Using Task

#### Requirements

See the [ystdlib Requirements section](../README.md#requirements).

#### Commands

```shell
# debug build
task examples:build-debug

# release build
task examples:build-release
```

### Using CMake

#### Requirements

[Build](../README.md#building) and [install](../README.md#installing) ystdlib. The commands below
assume you've built and installed ystdlib to `./build/examples/ystdlib`. If you installed it to a
different location, adjust the paths accordingly.

## Building
#### Commands

```shell
cmake -S "./examples" -B "./build/examples" -Dystdlib_ROOT="./build/examples/ystdlib"
Expand Down
35 changes: 10 additions & 25 deletions taskfile.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,21 @@ set: ["u", "pipefail"]
shopt: ["globstar"]

includes:
build: "./taskfiles/build.yaml"
deps: "./taskfiles/deps.yaml"
examples: "./taskfiles/examples.yaml"
lint: "./taskfiles/lint.yaml"
utils: "tools/yscope-dev-utils/exports/taskfiles/utils/utils.yaml"
test: "./taskfiles/test.yaml"
ystdlib: "./taskfiles/ystdlib.yaml"

vars:
G_BUILD_DIR: "{{.ROOT_DIR}}/build"
G_CPP_SRC_DIR: "{{.ROOT_DIR}}/src"
G_DEPS_DIR: "{{.G_BUILD_DIR}}/deps"

# These should be kept in-sync with its usage in CMakeLists.txt
G_DEPS_CMAKE_SETTINGS_DIR: "{{.G_DEPS_DIR}}/cmake-settings"
G_DEPS_CMAKE_SETTINGS_FILE: "{{.G_DEPS_CMAKE_SETTINGS_DIR}}/all.cmake"
# General variables
# This must match the package name in CMakeLists.txt.
G_CMAKE_PACKAGE_NAME: "ystdlib"

G_TEST_BIN_DIR: "{{.G_BUILD_DIR}}/testbin"
G_TEST_TARGET_SUFFIXES:
- "all"
- "containers"
- "error_handling"
- "wrapped_facade_headers"
# Build variables
G_BUILD_DIR: "{{.ROOT_DIR}}/build"
G_EXAMPLES_BUILD_DIR: "{{.G_BUILD_DIR}}/examples"
G_YSTDLIB_BUILD_DIR: "{{.G_BUILD_DIR}}/{{.G_CMAKE_PACKAGE_NAME}}"

tasks:
clean:
Expand All @@ -37,13 +32,3 @@ tasks:
run: "once"
cmds:
- "mkdir -p '{{.G_BUILD_DIR}}'"

test-*:
desc: "Runs unit tests for the specified test target."
vars:
TEST_TARGET: >-
{{printf "unit-test-%s" (index .MATCH 0)}}
deps:
- "build:{{.TEST_TARGET}}"
cmds:
- "{{.G_TEST_BIN_DIR}}/{{.TEST_TARGET}}"
65 changes: 0 additions & 65 deletions taskfiles/build.yaml

This file was deleted.

50 changes: 28 additions & 22 deletions taskfiles/deps.yaml
Original file line number Diff line number Diff line change
@@ -1,49 +1,55 @@
version: "3"

includes:
utils:
internal: true
taskfile: "../tools/yscope-dev-utils/exports/taskfiles/utils/utils.yaml"

vars:
G_CATCH2_LIB_NAME: "Catch2"
G_CATCH2_WORK_DIR: "{{.G_DEPS_DIR}}/{{.G_CATCH2_LIB_NAME}}"
# General variables
G_DEPS_DIR: "{{.G_BUILD_DIR}}/deps"

# This path must be kept in-sync with its usage in CMakeLists.txt and examples/CMakeLists.txt.
G_DEPS_CMAKE_SETTINGS_DIR: "{{.G_DEPS_DIR}}/cmake-settings"

tasks:
install-all:
desc: "Install all dependencies required by ystdlib-cpp."
desc: "Install all dependencies required by ystdlib."
run: "once"
cmds:
- "rm -rf '{{.G_DEPS_CMAKE_SETTINGS_DIR}}'"
- "mkdir -p '{{.G_DEPS_CMAKE_SETTINGS_DIR}}'"
- task: ":utils:cmake:install-deps-and-generate-settings"
- task: "utils:cmake:install-deps-and-generate-settings"
vars:
CMAKE_SETTINGS_DIR: "{{.G_DEPS_CMAKE_SETTINGS_DIR}}"
CMAKE_SETTINGS_FILE: "{{.G_DEPS_CMAKE_SETTINGS_FILE}}"
DEP_TASK: "deps:install-all-parallel"
DEP_TASK: "install-all-parallel"

install-all-parallel:
internal: true
run: "once"
deps:
- "install-boost"
- "install-Catch2"
- "install-catch2"

install-Catch2:
install-boost:
internal: true
run: "once"
cmds:
- task: ":utils:cmake:install-remote-tar"
- task: "utils:boost:download-and-install"
vars:
CMAKE_PACKAGE_NAME: "{{.G_CATCH2_LIB_NAME}}"
CMAKE_SETTINGS_DIR: "{{.G_DEPS_CMAKE_SETTINGS_DIR}}"
TAR_SHA256: "1ab2de20460d4641553addfdfe6acd4109d871d5531f8f519a52ea4926303087"
TAR_URL: "https://github.com/catchorg/Catch2/archive/refs/tags/v3.8.0.tar.gz"
WORK_DIR: "{{.G_CATCH2_WORK_DIR}}"
FILE_SHA256: "d6c69e4459eb5d6ec208250291221e7ff4a2affde9af6e49c9303b89c687461f"
URL: "https://github.com/boostorg/boost/releases/download/boost-1.87.0\
/boost-1.87.0-b2-nodocs.tar.gz"
TARGETS: ["headers"]
WORK_DIR: "{{.G_DEPS_DIR}}"

install-boost:
install-catch2:
internal: true
run: "once"
cmds:
- task: ":utils:boost:download-and-install"
- task: "utils:cmake:install-remote-tar"
vars:
CMAKE_PACKAGE_NAME: "Catch2"
CMAKE_SETTINGS_DIR: "{{.G_DEPS_CMAKE_SETTINGS_DIR}}"
FILE_SHA256: "d6c69e4459eb5d6ec208250291221e7ff4a2affde9af6e49c9303b89c687461f"
URL: "https://github.com/boostorg/boost/releases/download/boost-1.87.0\
/boost-1.87.0-b2-nodocs.tar.gz"
TARGETS: ["headers"]
WORK_DIR: "{{.G_DEPS_DIR}}/boost"
TAR_SHA256: "1ab2de20460d4641553addfdfe6acd4109d871d5531f8f519a52ea4926303087"
TAR_URL: "https://github.com/catchorg/Catch2/archive/refs/tags/v3.8.0.tar.gz"
WORK_DIR: "{{.G_DEPS_DIR}}"
Loading
Loading