This repository was archived by the owner on Dec 10, 2025. It is now read-only.
forked from antgroup/vsag
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
157 lines (129 loc) · 6.66 KB
/
Makefile
File metadata and controls
157 lines (129 loc) · 6.66 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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
CMAKE_GENERATOR ?= "Unix Makefiles"
CMAKE_INSTALL_PREFIX ?= "/usr/local/"
COMPILE_JOBS ?= 6
DEBUG_BUILD_DIR ?= "./build/"
RELEASE_BUILD_DIR ?= "./build-release/"
VSAG_CMAKE_ARGS := -DCMAKE_EXPORT_COMPILE_COMMANDS=1 -DCMAKE_COLOR_DIAGNOSTICS=ON
VSAG_CMAKE_ARGS := ${VSAG_CMAKE_ARGS} -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} -DNUM_BUILDING_JOBS=${COMPILE_JOBS}
VSAG_CMAKE_ARGS := ${VSAG_CMAKE_ARGS} -DENABLE_TESTS=ON -DENABLE_PYBINDS=ON -DENABLE_TOOLS=ON
ifdef EXTRA_DEFINED
VSAG_CMAKE_ARGS := ${VSAG_CMAKE_ARGS} ${EXTRA_DEFINED}
endif
VSAG_CMAKE_ARGS := ${VSAG_CMAKE_ARGS} -G ${CMAKE_GENERATOR} -S.
UT_FILTER = ""
ifdef CASE
UT_FILTER = $(CASE)
endif
UT_SHARD = ""
ifdef SHARD
UT_SHARD = $(SHARD)
endif
.PHONY: help
help: ## Show the help.
@echo "Usage: make <target>"
@echo ""
@echo "Targets:"
@fgrep "##" Makefile | fgrep -v fgrep
##
## ================ development ================
.PHONY: debug
debug: ## Build vsag with debug options.
cmake ${VSAG_CMAKE_ARGS} -B${DEBUG_BUILD_DIR} -DCMAKE_BUILD_TYPE=Debug -DENABLE_ASAN=OFF -DENABLE_CCACHE=ON
cmake --build ${DEBUG_BUILD_DIR} --parallel ${COMPILE_JOBS}
.PHONY: test
test: ## Build and run unit tests.
cmake ${VSAG_CMAKE_ARGS} -B${DEBUG_BUILD_DIR} -DCMAKE_BUILD_TYPE=Debug -DENABLE_CCACHE=ON
cmake --build ${DEBUG_BUILD_DIR} --parallel ${COMPILE_JOBS}
./build/tests/unittests -d yes ${UT_FILTER} --allow-running-no-tests ${UT_SHARD}
./build/tests/functests -d yes ${UT_FILTER} --allow-running-no-tests ${UT_SHARD}
./build/mockimpl/tests_mockimpl -d yes ${UT_FILTER} --allow-running-no-tests ${UT_SHARD}
.PHONY: asan
asan: ## Build with AddressSanitizer option.
cmake ${VSAG_CMAKE_ARGS} -B${DEBUG_BUILD_DIR} -DCMAKE_BUILD_TYPE=Sanitize -DENABLE_ASAN=ON -DENABLE_TSAN=OFF -DENABLE_CCACHE=ON
cmake --build ${DEBUG_BUILD_DIR} --parallel ${COMPILE_JOBS}
.PHONY: test_asan
test_asan: asan ## Run unit tests with AddressSanitizer option.
./build/tests/unittests -d yes ${UT_FILTER} --allow-running-no-tests ${UT_SHARD}
./build/tests/functests -d yes ${UT_FILTER} --allow-running-no-tests ${UT_SHARD}
./build/mockimpl/tests_mockimpl -d yes ${UT_FILTER} --allow-running-no-tests ${UT_SHARD}
.PHONY: tsan
tsan: ## Build with ThreadSanitizer option.
cmake ${VSAG_CMAKE_ARGS} -B${DEBUG_BUILD_DIR} -DCMAKE_BUILD_TYPE=Sanitize -DENABLE_ASAN=OFF -DENABLE_TSAN=ON -DENABLE_CCACHE=ON
cmake --build ${DEBUG_BUILD_DIR} --parallel ${COMPILE_JOBS}
.PHONY: test_tsan
test_tsan: tsan ## Run unit tests with ThreadSanitizer option.
./build/tests/unittests -d yes ${UT_FILTER} --allow-running-no-tests ${UT_SHARD}
./build/tests/functests -d yes ${UT_FILTER} --allow-running-no-tests ${UT_SHARD}
./build/mockimpl/tests_mockimpl -d yes ${UT_FILTER} --allow-running-no-tests ${UT_SHARD}
.PHONY: clean
clean: ## Clear build/ directory.
rm -rf ${DEBUG_BUILD_DIR}/*
##
## ================ integration ================
.PHONY: fmt
fmt: ## Format codes.
@./scripts/format-cpp.sh
.PHONY: cov
cov: ## Build unit tests with code coverage enabled.
cmake ${VSAG_CMAKE_ARGS} -B${DEBUG_BUILD_DIR} -DCMAKE_BUILD_TYPE=Debug -DENABLE_COVERAGE=ON -DENABLE_CCACHE=ON -DENABLE_ASAN=OFF
cmake --build ${DEBUG_BUILD_DIR} --parallel ${COMPILE_JOBS}
.PHONEY: lint
lint: ## Check coding styles defined in `.clang-tidy`.
@./scripts/linters/run-clang-tidy.py -p build-release/ -use-color -source-filter '^.*vsag\/src.*(?<!_test)\.cpp$$' -j ${COMPILE_JOBS}
.PHONEY: fix-lint
fix-lint: ## Fix coding style issues in-place via clang-apply-replacements, use it be careful!!!
@./scripts/linters/run-clang-tidy.py -p build-release/ -use-color -source-filter '^.*vsag\/src.*(?<!_test)\.cpp$$' -j ${COMPILE_JOBS} -fix
.PHONY: test_parallel
test_parallel: ## Run all tests parallel (used in CI).
cmake ${VSAG_CMAKE_ARGS} -B${DEBUG_BUILD_DIR} -DCMAKE_BUILD_TYPE=Sanitize -DENABLE_ASAN=OFF -DENABLE_CCACHE=OFF
cmake --build ${DEBUG_BUILD_DIR} --parallel ${COMPILE_JOBS}
@./scripts/test_parallel_bg.sh
./build/mockimpl/tests_mockimpl -d yes ${UT_FILTER} --allow-running-no-tests ${UT_SHARD}
.PHONY: test_asan_parallel
test_asan_parallel: asan ## Run unit tests parallel with AddressSanitizer option.
@./scripts/test_parallel_bg.sh
./build/mockimpl/tests_mockimpl -d yes ${UT_FILTER} --allow-running-no-tests ${UT_SHARD}
.PHONY: test_tsan_parallel
test_tsan_parallel: tsan ## Run unit tests parallel with ThreadSanitizer option.
@./scripts/test_parallel_bg.sh
./build/mockimpl/tests_mockimpl -d yes ${UT_FILTER} --allow-running-no-tests ${UT_SHARD}
##
## ================ distribution ================
.PHONY: release
release: ## Build vsag with release options.
cmake ${VSAG_CMAKE_ARGS} -B${RELEASE_BUILD_DIR} -DCMAKE_BUILD_TYPE=Release
cmake --build ${RELEASE_BUILD_DIR} --parallel ${COMPILE_JOBS}
.PHONY: run-dist-tests
run-dist-tests: ## Run distribution tests.
@echo "running tests..."
@${RELEASE_BUILD_DIR}/tests/unittests -d yes "~[daily]"
@${RELEASE_BUILD_DIR}/tests/functests -d yes "~[daily]"
@${RELEASE_BUILD_DIR}/mockimpl/tests_mockimpl -d yes "~[daily]"
.PHONY: dist-old-abi
dist-pre-cxx11-abi: ## Build vsag with distribution options.
echo "building dist-pre-cxx11-abi..."
cmake ${VSAG_CMAKE_ARGS} -B${RELEASE_BUILD_DIR} -DCMAKE_BUILD_TYPE=Release -DENABLE_INTEL_MKL=off -DENABLE_CXX11_ABI=off -DENABLE_LIBCXX=off
cmake --build ${RELEASE_BUILD_DIR} --parallel ${COMPILE_JOBS}
$(MAKE) run-dist-tests
.PHONY: dist-cxx11-abi
dist-cxx11-abi: ## Build vsag with distribution options.
echo "building dist-cxx11-abi..."
cmake ${VSAG_CMAKE_ARGS} -B${RELEASE_BUILD_DIR} -DCMAKE_BUILD_TYPE=Release -DENABLE_INTEL_MKL=off -DENABLE_CXX11_ABI=on -DENABLE_LIBCXX=off
cmake --build ${RELEASE_BUILD_DIR} --parallel ${COMPILE_JOBS}
$(MAKE) run-dist-tests
.PHONY: dist-libcxx
dist-libcxx: ## Build vsag using libc++.
cmake ${VSAG_CMAKE_ARGS} -B${RELEASE_BUILD_DIR} -DCMAKE_BUILD_TYPE=Release -DENABLE_LIBCXX=on
cmake --build ${RELEASE_BUILD_DIR} --parallel ${COMPILE_JOBS}
PARAM1 := "-DNUM_BUILDING_JOBS=${COMPILE_JOBS} -DENABLE_PYBINDS=1 -S. -B${RELEASE_BUILD_DIR} -DCMAKE_BUILD_TYPE=Release"
PARAM2 := "--build ${RELEASE_BUILD_DIR} --parallel ${COMPILE_JOBS}"
PARAM3 := "${RELEASE_BUILD_DIR}"
.PHONY: pyvsag
pyvsag: ## Build pyvsag wheel.
bash ./scripts/build_pyvsag_multiple_version.sh $(PARAM1) $(PARAM2) $(PARAM3)
.PHONY: clean-release
clean-release: ## Clear build-release/ directory.
rm -rf ${RELEASE_BUILD_DIR}/*
.PHONY: install
install: ## Build and install the release version of vsag.
cmake --install ${RELEASE_BUILD_DIR}/