Skip to content

Make strata consumable: install rules, exported target, usage docs - #2

Merged
lgoyal6 merged 1 commit into
mainfrom
feat/installable
Aug 24, 2026
Merged

Make strata consumable: install rules, exported target, usage docs#2
lgoyal6 merged 1 commit into
mainfrom
feat/installable

Conversation

@lgoyal6

@lgoyal6 lgoyal6 commented Aug 24, 2026

Copy link
Copy Markdown
Owner

Why

strata had no install rules, no namespaced target and no package config, so the only way to use it from another project was to vendor the source tree and reverse-engineer the include paths. It also had 0 tags and 0 releases, so there was no version anyone could pin.

What

  • Export a strata::strata target that behaves identically through FetchContent and find_package, so a consumer can switch between them without touching their code.
  • Public include dir now uses BUILD_INTERFACE / INSTALL_INTERFACE generator expressions. The old plain source path is meaningless once installed and would have made the exported target unusable.
  • Install strata_warnings alongside. It is build-time-only, but the export set names it, so omitting it makes a consumer's find_package fail on a target it has never heard of.
  • Tests, tools, fuzzers and the RocksDB benchmark now default OFF unless strata is the top-level project. A consumer has no use for the crash harness, and building it would break their configure on a missing RocksDB or a non-clang compiler.
  • README gains a "Use it in your project" section.

A doc correction included here

The durability note I first wrote claimed WriteOptions{.sync = true}. That is wrong: WriteOptions is an empty struct. The guarantee is governed by Options::fsync_policy, which defaults to FsyncPolicy::kAlways. Fixed before commit.

Verification

Two throwaway consumer projects built outside the repo, one per path:

Path Result
find_package(strata 0.1 REQUIRED) after cmake --install builds, runs, read back: it links
FetchContent + strata::strata builds, runs, read back: it links
Consumer build artifacts libstrata.a only, no tests or tools, so the option defaults hold
strata's own build tools still build, 46/46 tests pass
gtest leaking into a consumer prefix no, INSTALL_GTEST OFF was already set here

strata had no install rules, no namespaced target and no package config, so the
only way to use it from another project was to vendor the source tree and
reverse-engineer the include paths. It also had zero tags and zero releases,
which meant there was no version anyone could pin.

- Export a `strata::strata` target that works identically through
  FetchContent and through find_package, so a consumer can switch between
  them without touching their code.
- Give the public include directory BUILD_INTERFACE and INSTALL_INTERFACE
  generator expressions. The old plain source path is meaningless once
  installed, and would have made the exported target unusable.
- Install strata_warnings alongside. It is a build-time-only interface target,
  but the export set still names it, so omitting it makes the consumer's
  find_package fail on a target it has never heard of.
- Default tests, tools, fuzzers and the RocksDB benchmark OFF unless strata is
  the top-level project. A consumer pulling this in has no use for the crash
  harness, and building it would break their configure step on a missing
  RocksDB or a non-clang compiler.
- Document both paths in the README, with a corrected durability note: the
  guarantee is governed by Options::fsync_policy (kAlways by default), not by
  a field on WriteOptions, which is empty.

Verified by building two throwaway consumer projects outside the repo, one per
path, each opening a DB, writing and reading back: both link and run. The
FetchContent build produces libstrata.a and nothing else, confirming the option
defaults hold. strata's own suite still builds its tools and passes 46/46.
@lgoyal6
lgoyal6 merged commit a684328 into main Aug 24, 2026
10 checks passed
@lgoyal6
lgoyal6 deleted the feat/installable branch August 24, 2026 21:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant