Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update makefile and remove outdated benchs directory #270

Merged
merged 1 commit into from
Jan 3, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 18 additions & 7 deletions DEVELOPMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,32 +35,43 @@ Usage: make <target>

Targets:
help: ## Show the help.
##
## ================ development ================
debug: ## Build vsag with debug options.
release: ## Build vsag with release options.
distribution: ## Build vsag with distribution options.
libcxx: ## Build vsag using libc++.
fmt: ## Format codes.
test: ## Build and run unit tests.
asan: ## Build with AddressSanitizer option.
test_asan_parallel: asan ## Run unit tests parallel with AddressSanitizer option.
test_asan: asan ## Run unit tests with AddressSanitizer option.
tsan: ## Build with ThreadSanitizer option.
test_tsan: tsan ## Run unit tests with ThreadSanitizer option.
test_cov: cov ## Build and run unit tests with code coverage enabled.
clean: ## Clear build/ directory.
##
## ================ integration ================
fmt: ## Format codes.
cov: ## Build unit tests with code coverage enabled.
test_parallel: debug ## Run all tests parallel (used in CI).
test_asan_parallel: asan ## Run unit tests parallel with AddressSanitizer option.
test_tsan_parallel: tsan ## Run unit tests parallel with ThreadSanitizer option.
##
## ================ distribution ================
release: ## Build vsag with release options.
distribution: ## Build vsag with distribution options.
libcxx: ## Build vsag using libc++.
pyvsag: ## Build pyvsag wheel.
clean-release: ## Clear build-release/ directory.
install: ## Build and install the release version of vsag.
```

## Project Structure
- `benchs/`: benchmark script in Python
- `cmake/`: cmake util functions
- `docker/`: the dockerfile to build develop and ci image
- `docs/`: the design documents
- `examples/`: cpp and python example codes
- `extern/`: third-party libraries
- `include/`: export header files
- `mockimpl/`: the mock implementation that can be used in interface test
- `python/`: the pyvsag package and setup tools
- `python_bindings/`: the python bindings
- `scripts/`: useful scripts
- `src/`: the source codes and unit tests
- `tests/`: the functional tests
- `tools/`: the tools
90 changes: 46 additions & 44 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@ 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_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} -DNUM_BUILDING_JOBS=${COMPILE_JOBS} -DENABLE_TESTS=1 -DENABLE_PYBINDS=1 -G ${CMAKE_GENERATOR} -S.

VSAG_CMAKE_ARGS := -DCMAKE_EXPORT_COMPILE_COMMANDS=1
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=1 -DENABLE_PYBINDS=1 -G ${CMAKE_GENERATOR} -S.

UT_FILTER = ""
ifdef CASE
UT_FILTER = $(CASE)
Expand All @@ -22,22 +26,13 @@ help: ## Show the help.
@echo "Targets:"
@fgrep "##" Makefile | fgrep -v fgrep

# ================= development part =================
##
## ================ development ================
.PHONY: debug
debug: ## Build vsag with debug options.
cmake ${VSAG_CMAKE_ARGS} -B${DEBUG_BUILD_DIR} -DCMAKE_BUILD_TYPE=Debug -DENABLE_CCACHE=ON -DENABLE_ASAN=OFF
cmake ${VSAG_CMAKE_ARGS} -B${DEBUG_BUILD_DIR} -DCMAKE_BUILD_TYPE=Debug -DENABLE_ASAN=OFF -DENABLE_CCACHE=ON
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe we can set ENABLE_EXAMPLES=ON?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

change the default value of ENABLE_EXAMPLES in another pull request

cmake --build ${DEBUG_BUILD_DIR} --parallel ${COMPILE_JOBS}

.PHONY: fmt
fmt: ## Format codes.
find include/ -iname "*.h" -o -iname "*.cpp" | xargs clang-format -i
find src/ -iname "*.h" -o -iname "*.cpp" | xargs clang-format -i
find python_bindings/ -iname "*.h" -o -iname "*.cpp" | xargs clang-format -i
find examples/cpp/ -iname "*.h" -o -iname "*.cpp" | xargs clang-format -i
find mockimpl/ -iname "*.h" -o -iname "*.cpp" | xargs clang-format -i
find tests/ -iname "*.h" -o -iname "*.cpp" | xargs clang-format -i
find tools/ -iname "*.h" -o -iname "*.cpp" | xargs clang-format -i

.PHONY: test
test: ## Build and run unit tests.
cmake ${VSAG_CMAKE_ARGS} -B${DEBUG_BUILD_DIR} -DCMAKE_BUILD_TYPE=Debug -DENABLE_CCACHE=ON
Expand All @@ -46,21 +41,11 @@ test: ## Build and run unit tests.
./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: test_parallel
test_parallel: debug
@./scripts/test_parallel_bg.sh
./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=Debug -DENABLE_ASAN=ON -DENABLE_CCACHE=ON
cmake ${VSAG_CMAKE_ARGS} -B${DEBUG_BUILD_DIR} -DCMAKE_BUILD_TYPE=Debug -DENABLE_ASAN=ON -DENABLE_TSAN=OFF -DENABLE_CCACHE=ON
cmake --build ${DEBUG_BUILD_DIR} --parallel ${COMPILE_JOBS}

.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_asan
test_asan: asan ## Run unit tests with AddressSanitizer option.
./build/tests/unittests -d yes ${UT_FILTER} --allow-running-no-tests ${UT_SHARD}
Expand All @@ -69,7 +54,7 @@ test_asan: asan ## Run unit tests with AddressSanitizer option.

.PHONY: tsan
tsan: ## Build with ThreadSanitizer option.
cmake ${VSAG_CMAKE_ARGS} -B${DEBUG_BUILD_DIR} -DCMAKE_BUILD_TYPE=Debug -DENABLE_TSAN=ON -DENABLE_CCACHE=ON
cmake ${VSAG_CMAKE_ARGS} -B${DEBUG_BUILD_DIR} -DCMAKE_BUILD_TYPE=Debug -DENABLE_ASAN=OFF -DENABLE_TSAN=ON -DENABLE_CCACHE=ON
cmake --build ${DEBUG_BUILD_DIR} --parallel ${COMPILE_JOBS}

.PHONY: test_tsan
Expand All @@ -78,24 +63,38 @@ test_tsan: tsan ## Run unit tests with ThreadSanitizer option.
./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: cov # Build unit tests with code coverage enabled.
cov:
.PHONY: clean
clean: ## Clear build/ directory.
rm -rf ${DEBUG_BUILD_DIR}/*

##
## ================ integration ================
.PHONY: fmt
fmt: ## Format codes.
jiaweizone marked this conversation as resolved.
Show resolved Hide resolved
@./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}

.PHONY: test_cov
test_cov: cov ## Build and run unit tests with code coverage enabled.
./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}
.PHONY: test_parallel
test_parallel: debug ## Run all tests parallel (used in CI).
@./scripts/test_parallel_bg.sh
./build/mockimpl/tests_mockimpl -d yes ${UT_FILTER} --allow-running-no-tests ${UT_SHARD}
bash scripts/collect_cpp_coverage.sh
genhtml --output-directory coverage/coverage/html coverage/coverage.info --ignore-errors inconsistent,inconsistent

.PHONY: clean
clean: ## Clear build/ directory.
rm -rf ${DEBUG_BUILD_DIR}/*
.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 part =================
##
## ================ distribution ================
.PHONY: release
release: ## Build vsag with release options.
cmake ${VSAG_CMAKE_ARGS} -B${RELEASE_BUILD_DIR} -DCMAKE_BUILD_TYPE=Release
Expand All @@ -111,15 +110,18 @@ 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}

.PHONY: install
install: ## Build and install the release version of vsag.
cmake --install ${RELEASE_BUILD_DIR}/


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 ## Build pyvsag wheel
pyvsag:
.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}/
6 changes: 0 additions & 6 deletions benchs/README.md

This file was deleted.

14 changes: 0 additions & 14 deletions benchs/benchmark/__init__.py

This file was deleted.

83 changes: 0 additions & 83 deletions benchs/benchmark/bench_index.py

This file was deleted.

Loading
Loading