-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
61 lines (45 loc) · 1.75 KB
/
Makefile
File metadata and controls
61 lines (45 loc) · 1.75 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
.PHONY: all build release test clean rebuild format wasm coverage coverage-build coverage-clean \
build-shared build-node test-python test-node
BUILD_DIR := build
all: build
build:
cmake -B $(BUILD_DIR) -DCMAKE_BUILD_TYPE=Debug
cmake --build $(BUILD_DIR) -j
release:
cmake -B $(BUILD_DIR) -DCMAKE_BUILD_TYPE=Release
cmake --build $(BUILD_DIR) -j
wasm:
emcmake cmake -B build-wasm -DBUILD_WASM=ON -DCMAKE_BUILD_TYPE=Release
cmake --build build-wasm -j
test: build
ctest --test-dir $(BUILD_DIR) --output-on-failure
clean:
rm -rf $(BUILD_DIR)
rebuild: clean build
format:
find src tests -name '*.cpp' -o -name '*.h' | xargs clang-format -i
# Binding targets
build-shared:
cmake -B $(BUILD_DIR) -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED=ON
cmake --build $(BUILD_DIR) -j
build-node:
cd bindings/node && yarn install && yarn build
test-python: build-shared
cd bindings/python && pip install -e . -q && python -m pytest tests/ -v
test-node: build-node
cd bindings/node && yarn test
# Coverage targets
coverage-build:
cmake -B $(BUILD_DIR) -DCMAKE_BUILD_TYPE=Debug -DENABLE_COVERAGE=ON
cmake --build $(BUILD_DIR) -j
coverage: coverage-build
@mkdir -p $(BUILD_DIR)/coverage
cd $(BUILD_DIR) && lcov --directory . --zerocounters
-cd $(BUILD_DIR) && ctest --output-on-failure --parallel
cd $(BUILD_DIR) && lcov --directory . --capture --output-file coverage/coverage.info
cd $(BUILD_DIR) && lcov --extract coverage/coverage.info '$(CURDIR)/src/*' --output-file coverage/coverage_filtered.info
cd $(BUILD_DIR) && genhtml coverage/coverage_filtered.info --output-directory coverage/html
@echo "Coverage report: $(BUILD_DIR)/coverage/html/index.html"
coverage-clean:
find $(BUILD_DIR) -name '*.gcda' -delete 2>/dev/null || true
rm -rf $(BUILD_DIR)/coverage