Page MenuHomePhabricator

[Chronik] Add `ENABLE_CHRONIK` #define macro
ClosedPublic

Authored by tobias_ruck on Jul 26 2022, 19:19.

Details

Reviewers
Fabien
Group Reviewers
Restricted Project
Commits
rABC68ac3d500882: [Chronik] Add `ENABLE_CHRONIK` #define macro
Summary

This is required for conditional compilation in the C++ code depending on whether Chronik is enabled.

Test Plan
  1. cmake with -DBUILD_BITCOIN_CHRONIK=ON generates #define ENABLE_CHRONIK 1 in build/src/config/bitcoin-config.h
  2. cmake with -DBUILD_BITCOIN_CHRONIK=OFF generates #define ENABLE_CHRONIK 0 in build/src/config/bitcoin-config.h

Diff Detail

Event Timeline

Fabien requested changes to this revision.Jul 27 2022, 10:20

You are missing the option(BUILD_BITCOIN_CHRONIK) statement.
Also please expand on the test plan to check the option creates the expected defines when set.

src/config/bitcoin-config.h.cmake.in
76

That's a weird location for this define. Either move it in it's own place with a short comment or at least keep the lexical ordering.
Also chronik should be opt-in, so 0 is a better default.

This revision now requires changes to proceed.Jul 27 2022, 10:20

NVM about the option, it's already there

Move ENABLE_CHRONIK to its own block

Fix: Use #cmakedefine01 to define the macro. This is the expected behavior (define ENABLE_CHRONIK as either 1 or 0) and
meshes better with #if.

This revision is now accepted and ready to land.Jul 27 2022, 16:36