build: Add CMake-based build system#1113
Merged
sipa merged 3 commits intobitcoin-core:masterfrom Mar 8, 2023
Merged
Conversation
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds a CMake-based build system.
Added build instructions and examples to the
README.mdfile.Ways to integrate with downstream CMake-based projects:
secp256k1is a subtree (including Bitcoin Core project) --add_subdirectory(secp256k1)secp256k1has been installed --find_package(secp256k1 0.2.1 CONFIG), see https://github.com/hebasto/secp256k1-CMake-exampleAdded 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_STANDARDproperty.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 --helpoutput.--prefix-DCMAKE_INSTALL_PREFIX--enable-shared-DSECP256K1_BUILD_SHARED--enable-static-DSECP256K1_BUILD_STATIC--enable-dev-modehidden--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-multiplyhidden-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_VALGRINGA screenshot of grouped options from

cmake-gui:2.
maketargetsmakemakemake checkmake checkmake installmake install*lib/pkgconfig/libsecp256k1.pcnot implemented.