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
33 changes: 9 additions & 24 deletions .github/workflows/cmakeBuildTest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,37 +6,22 @@ on:
pull_request:
branches: ["main"]

env:
BUILD_TYPE: Release

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Switch to gcc-14
run: |
sudo apt install gcc-14 g++-14
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-14 100 --slave /usr/bin/g++ g++ /usr/bin/g++-14 --slave /usr/bin/gcov gcov /usr/bin/gcov-14
sudo update-alternatives --set gcc /usr/bin/gcc-14

- uses: actions/checkout@v4

- name: Install Conan
uses: conan-io/setup-conan@v1
- name: Install Nix
uses: cachix/install-nix-action@v31
with:
cache_packages: 'true'
extra_nix_config: |
experimental-features = nix-command flakes

- name: Install Conan dependencies
- name: Build and test in flake dev shell
run: |
mkdir cmake_build
cd cmake_build
cmake .. -DCMAKE_PROJECT_TOP_LEVEL_INCLUDES="conan_provider.cmake" -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}

- name: Build
working-directory: ${{github.workspace}}/cmake_build
run: cmake --build . -j 14

- name: Test
working-directory: ${{github.workspace}}/cmake_build
run: ctest
nix develop --command bash -lc '
build release
ctest --test-dir cmake_build_release --output-on-failure
'
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
cmake-build-debug/
.clangd
cmake_build/
cmake_build_debug/
cmake_build_release/
.clangd
flake.lock
8 changes: 4 additions & 4 deletions .idea/cmake.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 2 additions & 3 deletions .vscode/c_cpp_properties.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,12 @@
{
"name": "Linux",
"includePath": [
"${workspaceFolder}/**",
"~/.conan2/**"
"${workspaceFolder}/**"
],
"defines": [],
"cStandard": "c17",
"intelliSenseMode": "linux-clang-x64"
}
],
"version": 4
}
}
24 changes: 22 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,27 @@ endif ()

# Packages
find_package(absl)
find_package(Catch2)
find_package(Catch2 3 REQUIRED)

if(NOT TARGET abseil::abseil)
add_library(abseil::abseil INTERFACE IMPORTED)
set(_absl_components
absl::base
Comment on lines 58 to +64

Copilot AI Mar 30, 2026

Copy link

Choose a reason for hiding this comment

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

find_package(absl) is not marked REQUIRED, but the project unconditionally includes Abseil headers and links against abseil::abseil. With the fallback target below, CMake can configure successfully even when Abseil isn’t found (leading to later, harder-to-debug compile/link failures). Make Abseil discovery fail fast (e.g., find_package(absl REQUIRED) / CONFIG REQUIRED) and/or emit a fatal error if the expected absl::* targets are missing before creating abseil::abseil.

Copilot uses AI. Check for mistakes.
absl::hash
absl::strings
absl::flags
absl::flags_parse
absl::flags_usage
absl::log
absl::log_globals
absl::log_initialize
)
foreach(_absl_component IN LISTS _absl_components)
if(TARGET ${_absl_component})
target_link_libraries(abseil::abseil INTERFACE ${_absl_component})
endif()
endforeach()
endif()

add_executable(${PROJECT_NAME}
src/main.cpp
Expand Down Expand Up @@ -92,4 +112,4 @@ add_executable(tests
src/walker_sweep.cpp
)
target_link_libraries(tests PRIVATE Catch2::Catch2WithMain abseil::abseil)
add_test(NAME bdd_engine_tests COMMAND tests)
add_test(NAME bdd_engine_tests COMMAND tests)
8 changes: 2 additions & 6 deletions CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@
"minor": 30,
"patch": 0
},
"vendor": {
"conan": {}
},
"configurePresets": [
{
"name": "DebugPreset",
Expand All @@ -19,9 +16,8 @@
"CMAKE_BUILD_TYPE": "Debug",
"CMAKE_EXPORT_COMPILE_COMMANDS": "ON",
"CMAKE_CXX_FLAGS_DEBUG": "-Wall -Wextra -Wpedantic -fsanitize=address,undefined",
"CMAKE_EXE_LINKER_FLAGS_DEBUG": "-fsanitize=address,undefined",
"CMAKE_PROJECT_TOP_LEVEL_INCLUDES": "conan_provider.cmake"
"CMAKE_EXE_LINKER_FLAGS_DEBUG": "-fsanitize=address,undefined"
}
}
]
}
}
39 changes: 13 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -442,19 +442,23 @@ The REPL and overall application are implemented by the following

# Building and Dependencies

Uses [CMake](https://cmake.org/) 3.31 and [Conan](https://conan.io/) 2.15.0, tested on [GCC](https://gcc.gnu.org/) 14.
Uses [CMake](https://cmake.org/) 3.31 and [Nix](https://nixos.org/) flakes, tested on [GCC](https://gcc.gnu.org/) 14.

Depends on [Abseil](https://github.com/abseil/abseil-cpp) and [Catch2](https://github.com/catchorg/Catch2).

The easiest way to configure and build is using the Conan extension in CLion.
## Nix Development Shell

Otherwise:
This repository provides a `flake.nix` with a dev shell containing GCC 14, CMake, Ninja, Abseil and Catch2.

The shell also adds `scripts/` to `PATH`, so the following commands work from any directory inside the repository:

- `build debug` / `build release`: configure + build in `cmake_build_debug` or `cmake_build_release`
- `run debug` / `run release`: configure + build and then run `bdd_engine` from your current directory

```bash
mkdir cmake-build-release
cd cmake-build-release
cmake .. -G Ninja -DCMAKE_PROJECT_TOP_LEVEL_INCLUDES="conan_provider.cmake" -DCMAKE_BUILD_TYPE=Release
cmake --build .
nix develop
build release
ctest --test-dir cmake_build_release --output-on-failure
```

## Unit Tests
Expand Down Expand Up @@ -493,27 +497,10 @@ We can cross-compile the project to WebAssembly using [Emscripten](https://emscr

First, we need to [install Emscripten](https://emscripten.org/docs/getting_started/downloads.html).

Then we need to set up the following [Conan2 profile](https://docs.conan.io/2/reference/config_files/profiles.html),
named `emscripten`:

```text
[settings]
os=Emscripten
arch=wasm
compiler=clang
compiler.version=19
compiler.libcxx=libc++
build_type=Release
compiler.cppstd=23

[tool_requires]
emsdk/3.1.73
```

```bash
mkdir cmake-build-releasenodejs
cd cmake-build-releasenodejs
emcmake cmake .. -DCMAKE_PROJECT_TOP_LEVEL_INCLUDES="conan_provider.cmake" -DCMAKE_BUILD_TYPE=Release -DCONAN_HOST_PROFILE=emscripten -DCONAN_BUILD_PROFILE=default
emcmake cmake .. -DCMAKE_BUILD_TYPE=Release
make -j 14
```

Expand All @@ -528,4 +515,4 @@ Running `node bdd_engine.js` will start the REPL in Node.js and has the exact sa

* https://github.com/cryptool-org/wasm-webterm
* https://github.com/emscripten-core/emscripten/pull/23171
* https://webassembly.sh/
* https://webassembly.sh/
Loading
Loading