Skip to content

Commit 900cb16

Browse files
authored
chore: adapt Makefile for Windows (#1786)
1 parent db4242c commit 900cb16

1 file changed

Lines changed: 12 additions & 9 deletions

File tree

Makefile

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ all: test
22

33
GIT_COMMON_DIR := $(shell git rev-parse --git-common-dir)
44

5+
VENV_BIN = $(if $(filter Windows_NT,$(OS)),.venv/Scripts,.venv/bin)
6+
57
update-test-discovery:
68
@perl -ne 'print if s/SENTRY_TEST\(([^)]+)\).*/XX(\1)/' tests/unit/*.c | LC_ALL=C sort | grep -v define | uniq > tests/unit/tests.inc
79
.PHONY: update-test-discovery
@@ -21,14 +23,15 @@ test-unit: update-test-discovery CMakeLists.txt
2123
@mkdir -p unit-build
2224
@cd unit-build; cmake \
2325
-DCMAKE_RUNTIME_OUTPUT_DIRECTORY=$(PWD)/unit-build \
26+
-DCMAKE_RUNTIME_OUTPUT_DIRECTORY_RELWITHDEBINFO=$(PWD)/unit-build \
2427
-DSENTRY_BACKEND=none \
2528
..
26-
@cmake --build unit-build --target sentry_test_unit --parallel
29+
@cmake --build unit-build --target sentry_test_unit --parallel --config RelWithDebInfo
2730
./unit-build/sentry_test_unit
2831
.PHONY: test-unit
2932

3033
test-integration: setup-venv
31-
.venv/bin/pytest tests --verbose
34+
$(VENV_BIN)/pytest tests --verbose
3235
.PHONY: test-integration
3336

3437
test-leaks: update-test-discovery CMakeLists.txt
@@ -46,7 +49,7 @@ test-leaks: update-test-discovery CMakeLists.txt
4649
.PHONY: test-leaks
4750

4851
benchmark: setup-venv
49-
.venv/bin/pytest tests/benchmark.py --verbose
52+
$(VENV_BIN)/pytest tests/benchmark.py --verbose
5053
.PHONY: benchmark
5154

5255
clean: build/Makefile
@@ -69,19 +72,19 @@ $(GIT_COMMON_DIR)/hooks/pre-commit:
6972
.venv/.stamp: Makefile tests/requirements.txt
7073
@rm -rf .venv
7174
python3 -m venv .venv
72-
.venv/bin/pip install --upgrade --requirement tests/requirements.txt
75+
$(VENV_BIN)/pip install --upgrade --requirement tests/requirements.txt
7376
@touch $@
7477

7578
format: setup-venv
7679
@find examples include src tests/unit \
7780
\( -name '*.c' -o -name '*.cpp' -o -name '*.h' \) -print0 \
78-
| xargs -0 .venv/bin/clang-format -i
79-
@.venv/bin/black tests
81+
| xargs -0 $(VENV_BIN)/clang-format -i
82+
@$(VENV_BIN)/black tests
8083
.PHONY: format
8184

8285
style: setup-venv
83-
@.venv/bin/python ./scripts/check-clang-format.py \
84-
--clang-format-executable .venv/bin/clang-format \
86+
@$(VENV_BIN)/python ./scripts/check-clang-format.py \
87+
--clang-format-executable $(VENV_BIN)/clang-format \
8588
-r examples include src tests/unit
86-
@.venv/bin/black --diff --check tests
89+
@$(VENV_BIN)/black --diff --check tests
8790
.PHONY: style

0 commit comments

Comments
 (0)