Skip to content

build: slim default build targets#1796

Open
wxyucs wants to merge 1 commit intoantgroup:mainfrom
wxyucs:build/slim-default-config
Open

build: slim default build targets#1796
wxyucs wants to merge 1 commit intoantgroup:mainfrom
wxyucs:build/slim-default-config

Conversation

@wxyucs
Copy link
Copy Markdown
Collaborator

@wxyucs wxyucs commented Apr 2, 2026

Change Type

  • Bug fix
  • New feature
  • Improvement/Refactor
  • Documentation
  • CI/Build/Infra

Linked Issue

  • Issue: not applicable

What Changed

  • Slimmed the default CMake and make debug build by disabling tests, examples, tools, Python bindings, and mockimpl by default.
  • Reduced the default debug build's filtered logical target count from 117 to 42 using the same CMake help-based counting rule, for a reduction of 75 targets.
  • Added ENABLE_MOCKIMPL to make mockimpl an explicit opt-in build component.
  • Added make dev to preserve the previous full developer build with tests, examples, tools, Python bindings, and mockimpl enabled.
  • Updated make test, make cov, sanitizer, and distribution test paths to explicitly enable the targets they require.
  • Avoided loading Catch2 in slim default builds unless ENABLE_TESTS=ON.
  • Updated DEVELOPMENT.md to document the new default build behavior and build options.

Test Evidence

  • make fmt
  • make lint
  • make test
  • make cov, run tests, and collect coverage
  • Other (describe below)

Test details:

make clean && make debug
make clean-release && make release
make clean && make dev
make test
make cov
ls build/tests/unittests build/tests/functests build/mockimpl/tests_mockimpl
./build/tests/unittests --list-tests >/dev/null
./build/tests/functests --list-tests >/dev/null
./build/mockimpl/tests_mockimpl --list-tests >/dev/null

# target-count comparison (same counting rule on cmake --build <dir> --target help)
slim debug config: 42 filtered logical targets
full debug config: 117 filtered logical targets

Compatibility Impact

  • API/ABI compatibility: none
  • Behavior changes: default source builds are slimmer; tests, examples, tools, Python bindings, and mockimpl now require explicit enablement or the make dev target.

Performance and Concurrency Impact

  • Performance impact: improved build scope for default source builds
  • Concurrency/thread-safety impact: none

Documentation Impact

  • No docs update needed
  • Updated docs:
    • README.md
    • DEVELOPMENT.md
    • CONTRIBUTING.md
    • Other:

Risk and Rollback

  • Risk level: low
  • Rollback plan: revert commit 707176af to restore the previous default build configuration and remove make dev / ENABLE_MOCKIMPL.

Checklist

  • I have linked the relevant issue (or explained why not applicable)
  • I have added/updated tests for new behavior or bug fixes
  • I have considered API compatibility impact
  • I have updated docs if behavior/workflow changed
  • My commit messages follow project conventions (Conventional Commits, optional [skip ci] prefix)

Copilot AI review requested due to automatic review settings April 2, 2026 12:03
@wxyucs wxyucs added kind/improvement Code improvements (variable/function renaming, refactoring, etc. ) version/1.0 labels Apr 2, 2026
@wxyucs wxyucs self-assigned this Apr 2, 2026
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request refactors the build system by disabling tests, examples, tools, and Python bindings by default, while introducing a new ENABLE_MOCKIMPL option and a dev make target for full developer builds. Feedback indicates that changing the default for VSAG_ENABLE_TESTS causes a regression in the cov target, which now requires explicit test enablement. Additionally, it is recommended to explicitly disable AddressSanitizer in the test target to ensure consistency and avoid potential CMake cache persistence issues.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR slims the default CMake/Makefile build configuration by disabling optional components (tests, examples, tools, Python bindings, and mockimpl) by default, while adding an explicit make dev target to restore the prior “full developer” build behavior.

Changes:

  • Default build flags in Makefile and cmake/VSAGOptions.cmake now default optional components to OFF.
  • Added ENABLE_MOCKIMPL and gated mockimpl/ inclusion behind it.
  • Added make dev and updated test/sanitizer/distribution build paths to explicitly enable the components they require.
  • Updated DEVELOPMENT.md to document new default build behavior and options.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
Makefile Changes default build toggles to OFF, adds dev, and updates test/sanitizer/dist targets to opt-in to tests/mockimpl explicitly.
DEVELOPMENT.md Documents the new default-minimal make debug, the new make dev, and lists key CMake toggles (including ENABLE_MOCKIMPL).
CMakeLists.txt Gates mockimpl/ subdirectory on ENABLE_MOCKIMPL (and not Apple).
cmake/VSAGOptions.cmake Updates default option values for examples/tests and introduces ENABLE_MOCKIMPL.
Comments suppressed due to low confidence (1)

Makefile:67

  • make test configures the build directory via -B${DEBUG_BUILD_DIR}, but the test execution commands are hard-coded to ./build/.... If DEBUG_BUILD_DIR is overridden (or if build/ contains stale binaries), this target can run the wrong executables or fail. Please switch the invoked paths to ${DEBUG_BUILD_DIR}/tests/... and ${DEBUG_BUILD_DIR}/mockimpl/... to match the configured build directory.
	cmake ${VSAG_CMAKE_ARGS} -B${DEBUG_BUILD_DIR} -DCMAKE_BUILD_TYPE=Debug -DENABLE_CCACHE=ON -DENABLE_TESTS=ON -DENABLE_MOCKIMPL=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}

@wxyucs wxyucs force-pushed the build/slim-default-config branch from ee55286 to 707176a Compare April 3, 2026 03:19
Copilot AI review requested due to automatic review settings April 3, 2026 03:59
@wxyucs wxyucs force-pushed the build/slim-default-config branch from 707176a to 3afd66f Compare April 3, 2026 03:59
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.

Comments suppressed due to low confidence (1)

Makefile:110

  • lint and fix-lint are declared with .PHONEY instead of .PHONY, so make will not treat them as phony targets. This can cause these targets to be skipped if a file named lint or fix-lint exists. Rename .PHONEY to .PHONY for both targets.
.PHONEY: lint
lint:                    ## Check coding styles defined in `.clang-tidy`.
	@./scripts/linters/run-clang-tidy-15.sh -p build-release/ -use-color -source-filter '^.*vsag\/src.*(?<!_test)\.cpp$$' -j ${COMPILE_JOBS}

.PHONEY: fix-lint

@wxyucs wxyucs force-pushed the build/slim-default-config branch from 3afd66f to 567fd6a Compare April 3, 2026 08:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/improvement Code improvements (variable/function renaming, refactoring, etc. ) size/M version/1.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants