Skip to content

build: Add CMake-based build system#1113

Merged
sipa merged 3 commits intobitcoin-core:masterfrom
hebasto:220628-cmake
Mar 8, 2023
Merged

build: Add CMake-based build system#1113
sipa merged 3 commits intobitcoin-core:masterfrom
hebasto:220628-cmake

Conversation

@hebasto
Copy link
Copy Markdown
Member

@hebasto hebasto commented Jun 28, 2022

This PR adds a CMake-based build system.

Added build instructions and examples to the README.md file.

Ways to integrate with downstream CMake-based projects:

Added a few toolchain files for easy cross compiling.

Discussions on IRC:


Related PRs:


Implementation notes

Minimum required CMake version is 3.1. This was required to provide C_STANDARD property.

In turn, this choice of CMake version implies it is not possible to build with default CMake on Debian 8, which has CMake v3.0.2 only.

Also see:


Autotools -- CMake Feature Parity Tables

1. Configuration options

Autotool-based build system features being listed according to the ./configure --help output.

Autotools CMake
--prefix -DCMAKE_INSTALL_PREFIX
--enable-shared -DSECP256K1_BUILD_SHARED
--enable-static -DSECP256K1_BUILD_STATIC
--enable-dev-mode hidden N/A, see #1113 (comment)
--enable-benchmark -DSECP256K1_BUILD_BENCHMARK
--enable-coverage -DCMAKE_BUILD_TYPE=Coverage
--enable-tests -DSECP256K1_BUILD_TESTS
--enable-ctime-tests -DSECP256K1_BUILD_CTIME_TESTS
--enable-experimental -DSECP256K1_EXPERIMENTAL
--enable-exhaustive-tests -DSECP256K1_BUILD_EXHAUSTIVE_TESTS
--enable-examples -DSECP256K1_BUILD_EXAMPLES
--enable-module-ecdh -DSECP256K1_ENABLE_MODULE_ECDH
--enable-module-recovery -DSECP256K1_ENABLE_MODULE_RECOVERY
--enable-module-extrakeys -DSECP256K1_ENABLE_MODULE_EXTRAKEYS
--enable-module-schnorrsig -DSECP256K1_ENABLE_MODULE_SCHNORRSIG
--enable-external-default-callbacks -DSECP256K1_USE_EXTERNAL_DEFAULT_CALLBACKS
--with-test-override-wide-multiply hidden -DSECP256K1_TEST_OVERRIDE_WIDE_MULTIPLY
--with-asm -DSECP256K1_ASM
--with-ecmult-window -DSECP256K1_ECMULT_WINDOW_SIZE
--with-ecmult-gen-precision -DSECP256K1_ECMULT_GEN_PREC_BITS
--with-valgrind -DSECP256K1_VALGRING

A screenshot of grouped options from cmake-gui:
image

2. make targets

Autotools CMake
make make
make check make check
make install make install *
  • Installation of lib/pkgconfig/libsecp256k1.pc not implemented.

Loading
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.

6 participants