Changeset View
Changeset View
Standalone View
Standalone View
src/secp256k1/CMakeLists.txt
Show First 20 Lines • Show All 67 Lines • ▼ Show 20 Lines | |||||
add_library(secp256k1 src/secp256k1.c) | add_library(secp256k1 src/secp256k1.c) | ||||
target_include_directories(secp256k1 PUBLIC include) | target_include_directories(secp256k1 PUBLIC include) | ||||
set(SECP256K1_PUBLIC_HEADERS | set(SECP256K1_PUBLIC_HEADERS | ||||
include/secp256k1.h | include/secp256k1.h | ||||
include/secp256k1_preallocated.h | include/secp256k1_preallocated.h | ||||
) | ) | ||||
option(SECP256K1_ENABLE_BIGNUM "Use the GMP bignum implementation" OFF) | |||||
if(SECP256K1_ENABLE_BIGNUM) | |||||
# We need to link in GMP | |||||
find_package(GMP REQUIRED) | |||||
target_link_libraries(secp256k1 GMP::gmp) | |||||
set(USE_NUM_GMP 1) | |||||
set(USE_FIELD_INV_NUM 1) | |||||
set(USE_SCALAR_INV_NUM 1) | |||||
else() | |||||
set(USE_NUM_NONE 1) | |||||
set(USE_FIELD_INV_BUILTIN 1) | |||||
set(USE_SCALAR_INV_BUILTIN 1) | |||||
endif() | |||||
# Guess the target architecture, within the ones with supported ASM. | # Guess the target architecture, within the ones with supported ASM. | ||||
# First check if the CMAKE_C_COMPILER_TARGET is set (should be when | # First check if the CMAKE_C_COMPILER_TARGET is set (should be when | ||||
# cross compiling), then CMAKE_SYSTEM_PROCESSOR as a fallback if meaningful | # cross compiling), then CMAKE_SYSTEM_PROCESSOR as a fallback if meaningful | ||||
# (this is not the case for ARM as the content is highly non standard). | # (this is not the case for ARM as the content is highly non standard). | ||||
if(CMAKE_C_COMPILER_TARGET MATCHES "x86_64" OR CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64") | if(CMAKE_C_COMPILER_TARGET MATCHES "x86_64" OR CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64") | ||||
set(SECP256K1_ASM_BUILD_TARGET "x86_64") | set(SECP256K1_ASM_BUILD_TARGET "x86_64") | ||||
set(SECP256K1_DEFAULT_USE_ASM ON) | set(SECP256K1_DEFAULT_USE_ASM ON) | ||||
elseif(CMAKE_C_COMPILER_TARGET MATCHES "arm-linux-gnueabihf") | elseif(CMAKE_C_COMPILER_TARGET MATCHES "arm-linux-gnueabihf") | ||||
▲ Show 20 Lines • Show All 297 Lines • Show Last 20 Lines |