Building¶
This page covers all build targets, testing, code coverage, and optional Python bindings.
Prerequisites¶
See Installation for the full list of required and optional system dependencies.
Make Targets¶
The project provides a Makefile that wraps CMake for common workflows:
| Target | Description |
|---|---|
make build |
Configure (CMake) and compile all C++ targets |
make test |
Build, download test data if needed, and run the full test suite via CTest |
make coverage |
Build with coverage instrumentation, run tests, generate an HTML report |
make format |
Format C++ sources (clang-format) and Python code (ruff) in-place |
make format-check |
Dry-run format check --- exits non-zero on violations |
make lint |
Run clang-tidy on C++ and ruff on Python |
make clean |
Remove the entire build directory |
make changelog |
Generate CHANGELOG.md via git-cliff |
make install |
Build and install to the system (default /usr/local) |
Build configuration
You can customize the build via environment variables:
Running Tests¶
Tests compile into a separate reseq_test binary and run through CTest.
Full test suite¶
This automatically downloads any missing test data (E. coli and Drosophila references, BAM files) before running.
Running tests directly¶
Filtering tests with GoogleTest¶
Use --gtest_filter to run a subset of tests:
# Run all Simulator tests
build/bin/reseq_test --gtest_filter="SimulatorTest.*"
# Run a single test
build/bin/reseq_test --gtest_filter="ReferenceTest.LoadsEcoliGenome"
# Run everything except slow tests
build/bin/reseq_test --gtest_filter="-*Slow*"
Sequential execution required
Tests must run sequentially (not in parallel) due to inter-test dependencies on shared test data. Do not pass -j to CTest.
Code Coverage¶
Generate an HTML coverage report:
This performs the following steps:
- Configures a Debug build with
-DCODE_COVERAGE=ON - Builds and runs the full test suite
- Captures coverage data with
lcov - Strips vendored (
skewer/), system, and build-directory paths - Generates an HTML report at
build/coverage-report/index.html
Pre-commit Hooks¶
The project uses pre-commit to enforce formatting and linting on every commit.
Setup¶
Running manually¶
Pre-commit hooks enforce formatting on reseq/ (C++) and python/ (Python) only. Other directories are excluded.
Python Bindings¶
Python bindings are off by default. To enable them:
Additional requirements for Python bindings:
| Dependency | Ubuntu / Debian |
|---|---|
| python3-dev | sudo apt install python3-dev |
| SWIG 3+ | sudo apt install swig |
After building, install the Python package:
Python Tools¶
ReSeq2 ships Python utilities for plotting and read-name preparation in python/reseq/. These have their own quality targets:
| Target | Description |
|---|---|
make python-format |
Format Python code with ruff |
make python-format-check |
Check Python formatting (dry-run) |
make python-lint |
Lint Python code with ruff |
make python-typecheck |
Type-check with mypy |
make python-test |
Run Python unit tests |
make python-verify |
Run all Python checks (format + lint + typecheck + test) |
CMake Options¶
| Option | Default | Description |
|---|---|---|
CMAKE_BUILD_TYPE |
RelWithDebInfo |
Build type (Debug, Release, RelWithDebInfo) |
RESEQ_BUILD_PYTHON |
OFF |
Build Python SWIG bindings |
CODE_COVERAGE |
OFF |
Enable code coverage instrumentation |
CMAKE_EXPORT_COMPILE_COMMANDS |
ON (via Make) |
Generate compile_commands.json for clang-tidy |