Page MenuHomePhabricator

[CMAKE] Add the bitcoinconsensus library
AbandonedPublic

Authored by Fabien on Oct 2 2019, 10:06.

Details

Reviewers
deadalnix
Group Reviewers
Restricted Project
Summary

This adds the bitcoinconsensus library as a target.
This library exports 3 symbols:

  • bitcoinconsensus_verify_script
  • bitcoinconsensus_verify_script_with_amount
  • bitcoinconsensus_version

A few manipulations are required to get the same output than autotools.
These can be later removed but are kept for now in order to not break
the software relying on the current autotools format.

Depends on D4197.

Test Plan
mkdir -p buildcmake/install && cd buildcmake
cmake -GNinja .. -DCMAKE_INSTALL_PREFIX=install
ninja install

ls install/lib

Should return 1 file and 2 symbolic links:

  • libbitcoinconsensus.so.0.0.0
  • libbitcoinconsensus.so.0 (link to libbitcoinconsensus.so.0.0.0)
  • libbitcoinconsensus.so (link to libbitcoinconsensus.so.0) ls install/include

Should return bitcoinconsensus.h.

nm -D --defined-only install/lib/libbitcoinconsensus.so

Check the exported symbols contain the 3 above mentioned functions, and
no other public function.

ninja check # There are additional test cases in `script_tests.cpp`

rm -rf *
mkdir install
cmake -GNinja .. -DCMAKE_INSTALL_PREFIX=install \
  -DCMAKE_TOOLCHAIN_FILE=../cmake/platforms/OSX.cmake
ninja install

ls install/lib

Should return 1 file and 1 symbolic link:

  • libbitcoinconsensus.0.dylib
  • libbitcoinconsensus.dylib (link to libbitcoinconsensus.0.dylib) ls install/include

Should return bitcoinconsensus.h.

rm -rf *
mkdir install
cmake -GNinja .. -DCMAKE_INSTALL_PREFIX=install \
  -DBUILD_BITCOIN_SEEDER=OFF \
  -DCMAKE_TOOLCHAIN_FILE=../cmake/platforms/Win64.cmake
ninja install

ls install/lib

Should return 1 file :

  • libbitcoinconsensus-0.dll ls install/include

Should return bitcoinconsensus.h.

Diff Detail

Repository
rABC Bitcoin ABC
Branch
cmake_libbitcoinconsensus
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 7664
Build 13367: Bitcoin ABC Buildbot (legacy)
Build 13366: arc lint + arc unit

Event Timeline

src/CMakeLists.txt
559

It seems like this is the same library you already have, and it's the same good old thing where you need to build it statically and dynamically. Rolling a custom solution every time for the same problem isn't a good approach.

deadalnix requested changes to this revision.Oct 2 2019, 12:15
This revision now requires changes to proceed.Oct 2 2019, 12:15