-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathjustfile
More file actions
83 lines (65 loc) · 2.37 KB
/
Copy pathjustfile
File metadata and controls
83 lines (65 loc) · 2.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# CoBRA build system recipes
# Usage: just <recipe>
set dotenv-load := false
llvm_prefix := `brew --prefix llvm 2>/dev/null || echo /usr/local`
z3_prefix := `brew --prefix z3 2>/dev/null || echo /usr/local`
clang_format := `command -v clang-format 2>/dev/null || echo "$(brew --prefix llvm 2>/dev/null || echo /usr/local)/bin/clang-format"`
clang_tidy := `command -v clang-tidy 2>/dev/null || echo "$(brew --prefix llvm 2>/dev/null || echo /usr/local)/bin/clang-tidy"`
nproc := `sysctl -n hw.logicalcpu 2>/dev/null || nproc 2>/dev/null || echo 4`
# Default recipe: build and test
default: build test
# Build dependencies (GoogleTest, LLVM forwarding, Z3 forwarding)
deps:
cmake -S dependencies -B build-deps \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_PREFIX_PATH="{{llvm_prefix}};{{z3_prefix}}" \
-DCOBRA_ENABLE_Z3=ON \
-DUSE_EXTERNAL_Z3=ON
cmake --build build-deps -j {{nproc}}
# Configure the main project
configure: deps
cmake -S . -B build \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_PREFIX_PATH="$(pwd)/build-deps/install;{{llvm_prefix}};{{z3_prefix}}"
# Build the project
build: configure
cmake --build build -j {{nproc}}
# Build without LLVM pass plugin
build-no-llvm: deps
cmake -S . -B build \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_PREFIX_PATH="$(pwd)/build-deps/install" \
-DCOBRA_BUILD_LLVM_PASS=OFF
cmake --build build -j {{nproc}}
# Run all tests
test:
ctest --test-dir build --output-on-failure -j {{nproc}}
# Run a specific test by name pattern
test-filter pattern:
ctest --test-dir build --output-on-failure -R "{{pattern}}"
# Install to a prefix (default: build/_install)
install prefix="build/_install": build
cmake --install build --prefix "{{prefix}}"
# Clean build artifacts
clean:
cmake --build build --target clean 2>/dev/null || true
# Remove all build directories
distclean:
rm -rf build build-deps
# Run clang-format on all source files
format:
fd -e cpp -e h --exclude build --exclude build-deps . | xargs {{clang_format}} -i
# Check formatting without modifying files
format-check:
fd -e cpp -e h --exclude build --exclude build-deps . | xargs {{clang_format}} --dry-run --Werror
# Run codespell
spell:
codespell
# Run all lint checks
lint: format-check spell
# Run prek pre-commit hooks
hooks:
prek run
# Install prek git hooks
hooks-install:
prek install