1010# or implied. See the License for the specific language governing permissions and limitations under the License.
1111
1212PWD := $(shell pwd)
13- BUILD_DIR := $(PWD ) /build
13+ # BUILD_DIR is where conan + cmake put build outputs. Overridable from the
14+ # command line, e.g. `make BUILD_DIR=$(pwd)/build_asan WITH_ASAN=True`.
15+ # Binaries end up at $(BUILD_DIR)/$(BUILD_TYPE)/... (e.g. build/Release/...).
16+ BUILD_DIR ?= $(PWD ) /build
1417SHELL := /bin/bash
1518
1619# Conan install-only flags (not valid for conan build)
@@ -20,6 +23,7 @@ CONAN_INSTALL_FLAGS := --update --build=missing
2023# Usage: make WITH_GPU=True WITH_UT=True WITH_ASAN=True WITH_DEBUG=True
2124WITH_GPU ?=
2225WITH_UT ?=
26+ WITH_BENCHMARK ?=
2327WITH_ASAN ?=
2428WITH_SVS ?=
2529WITH_CARDINAL ?=
@@ -31,7 +35,7 @@ CONAN_PROFILE ?=
3135# variables such as WITH_ASAN to every sub-process, which causes the custom
3236# folly recipe to pick up $ENV{WITH_ASAN} and compile folly itself with
3337# -fsanitize=address — breaking the build on GCC.
34- unexport WITH_GPU WITH_UT WITH_ASAN WITH_CARDINAL WITH_DEBUG
38+ unexport WITH_GPU WITH_UT WITH_BENCHMARK WITH_ASAN WITH_CARDINAL WITH_DEBUG
3539
3640# ---------- Derived settings ----------
3741ifdef WITH_DEBUG
@@ -72,6 +76,10 @@ ifdef WITH_UT
7276 CONAN_SETTINGS += -o with_ut=True
7377endif
7478
79+ ifdef WITH_BENCHMARK
80+ CONAN_SETTINGS += -o with_benchmark=True
81+ endif
82+
7583ifdef WITH_ASAN
7684 CONAN_SETTINGS += -o with_asan=True
7785endif
@@ -97,13 +105,13 @@ all: build ## Default: CPU release build
97105
98106# ---------- Build ----------
99107
100- build : # # Build knowhere (use WITH_GPU=True, WITH_UT=True, WITH_ASAN=True)
108+ build : # # Build knowhere (use WITH_GPU=True, WITH_UT=True, WITH_BENCHMARK=True, WITH_ASAN=True)
101109ifdef WITH_GPU
102110 @$(PWD)/scripts/prepare_gpu_build.sh
103111endif
104112 @mkdir -p $(BUILD_DIR) && \
105- conan install . $(CONAN_INSTALL_FLAGS) $(CONAN_SETTINGS) && \
106- conan build . $(CONAN_SETTINGS)
113+ conan install . -of $(BUILD_DIR) $(CONAN_INSTALL_FLAGS) $(CONAN_SETTINGS) && \
114+ conan build . -of $(BUILD_DIR) $(CONAN_SETTINGS)
107115
108116# ---------- Test ----------
109117
@@ -148,6 +156,7 @@ help: ## Show available targets
148156 @echo " Build flags:"
149157 @echo " WITH_GPU=True Enable GPU (cuVS) build"
150158 @echo " WITH_UT=True Enable unit tests"
159+ @echo " WITH_BENCHMARK=True Enable benchmarks build"
151160 @echo " WITH_ASAN=True Enable AddressSanitizer"
152161 @echo " WITH_SVS=True Enable SVS (Intel Scalable Vector Search, x86 only)"
153162 @echo " WITH_CARDINAL=True Enable Cardinal build"
0 commit comments