Changeset View
Changeset View
Standalone View
Standalone View
src/secp256k1/CMakeLists.txt
Show First 20 Lines • Show All 59 Lines • ▼ Show 20 Lines | if(SECP256K1_ENABLE_BIGNUM) | ||||
set(USE_FIELD_INV_NUM 1) | set(USE_FIELD_INV_NUM 1) | ||||
set(USE_SCALAR_INV_NUM 1) | set(USE_SCALAR_INV_NUM 1) | ||||
else() | else() | ||||
set(USE_NUM_NONE 1) | set(USE_NUM_NONE 1) | ||||
set(USE_FIELD_INV_BUILTIN 1) | set(USE_FIELD_INV_BUILTIN 1) | ||||
set(USE_SCALAR_INV_BUILTIN 1) | set(USE_SCALAR_INV_BUILTIN 1) | ||||
endif() | endif() | ||||
set(SECP256K1_USE_ASM "x86_64" CACHE STRING "Attempt to use the target ASM implementation. Can be x86_64 or ARM") | |||||
if(SECP256K1_USE_X86_64_ASM AND SECP256K1_USE_ARM_ASM) | |||||
message(FATAL_ERROR "SECP256K1_USE_X86_64_ASM and SECP256K1_USE_ARM_ASM are mutually exclusive but both are enabled.") | |||||
endif() | |||||
# We check if amd64 asm is supported. | # We check if amd64 asm is supported. | ||||
option(SECP256K1_USE_ASM "Use assembly if available" ON) | if(SECP256K1_USE_ASM MATCHES "x86_64") | ||||
if($SECP256K1_USE_ASM) | |||||
check_c_source_compiles(" | check_c_source_compiles(" | ||||
#include <stdint.h> | #include <stdint.h> | ||||
int main() { | int main() { | ||||
uint64_t a = 11, tmp; | uint64_t a = 11, tmp; | ||||
__asm__ __volatile__(\"movq \$0x100000000,%1; mulq %%rsi\" : \"+a\"(a) : \"S\"(tmp) : \"cc\", \"%rdx\"); | __asm__ __volatile__(\"movq \$0x100000000,%1; mulq %%rsi\" : \"+a\"(a) : \"S\"(tmp) : \"cc\", \"%rdx\"); | ||||
return 0; | return 0; | ||||
} | } | ||||
" USE_ASM_X86_64) | " USE_ASM_X86_64) | ||||
else() | elseif(SECP256K1_USE_ASM MATCHES "ARM") | ||||
set(USE_ASM_X86_64 0) | enable_language(ASM) | ||||
set(USE_EXTERNAL_ASM 1) | |||||
add_library(secp256k1_common src/asm/field_10x26_arm.s) | |||||
target_link_libraries(secp256k1 secp256k1_common) | |||||
endif() | endif() | ||||
# We make sure __int128 is defined | # We make sure __int128 is defined | ||||
include(CheckTypeSize) | include(CheckTypeSize) | ||||
check_type_size(__int128 SIZEOF___INT128) | check_type_size(__int128 SIZEOF___INT128) | ||||
if(SIZEOF___INT128 EQUAL 16) | if(SIZEOF___INT128 EQUAL 16) | ||||
set(HAVE___INT128 1) | set(HAVE___INT128 1) | ||||
else() | else() | ||||
▲ Show 20 Lines • Show All 267 Lines • Show Last 20 Lines |