Skip to content

Commit 7d52166

Browse files
committed
build: detect arm32 assembly by default
1 parent 18ea93e commit 7d52166

File tree

2 files changed

+10
-13
lines changed

2 files changed

+10
-13
lines changed

CMakeLists.txt

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -90,25 +90,22 @@ mark_as_advanced(FORCE SECP256K1_TEST_OVERRIDE_WIDE_MULTIPLY)
9090
set(SECP256K1_ASM "AUTO" CACHE STRING "Assembly to use: \"AUTO\", \"OFF\", \"x86_64\" or \"arm32\" (experimental). [default=AUTO]")
9191
set_property(CACHE SECP256K1_ASM PROPERTY STRINGS "AUTO" "OFF" "x86_64" "arm32")
9292
check_string_option_value(SECP256K1_ASM)
93-
if(SECP256K1_ASM STREQUAL "arm32")
93+
if(NOT SECP256K1_ASM STREQUAL "OFF")
9494
enable_language(ASM)
95+
include(CheckX86_64Assembly)
9596
include(CheckArm32Assembly)
97+
check_x86_64_assembly()
9698
check_arm32_assembly()
97-
if(HAVE_ARM32_ASM)
98-
add_compile_definitions(USE_EXTERNAL_ASM=1)
99-
else()
99+
if(SECP256K1_ASM STREQUAL "arm32" AND NOT HAVE_ARM32_ASM)
100100
message(FATAL_ERROR "ARM32 assembly requested but not available.")
101+
elseif(SECP256K1_ASM STREQUAL "x86_64" AND NOT HAVE_X86_64_ASM)
102+
message(FATAL_ERROR "x86_64 assembly requested but not available.")
101103
endif()
102-
elseif(NOT SECP256K1_ASM STREQUAL "OFF")
103-
include(CheckX86_64Assembly)
104-
check_x86_64_assembly()
105104
if(HAVE_X86_64_ASM)
106-
set(SECP256K1_ASM "x86_64")
107105
add_compile_definitions(USE_ASM_X86_64=1)
108-
elseif(SECP256K1_ASM STREQUAL "AUTO")
109-
set(SECP256K1_ASM "OFF")
110-
else()
111-
message(FATAL_ERROR "x86_64 assembly requested but not available.")
106+
elseif(HAVE_ARM32_ASM)
107+
add_compile_definitions(USE_EXTERNAL_ASM=1)
108+
set(SECP256K1_USE_EXTERNAL_ASM TRUE)
112109
endif()
113110
endif()
114111

src/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ add_library(secp256k1_objs INTERFACE)
6464
target_sources(secp256k1_objs INTERFACE $<TARGET_OBJECTS:secp256k1> $<TARGET_OBJECTS:secp256k1_precomputed>)
6565

6666
add_library(secp256k1_asm INTERFACE)
67-
if(SECP256K1_ASM STREQUAL "arm32")
67+
if(SECP256K1_USE_EXTERNAL_ASM)
6868
add_library(secp256k1_asm_arm OBJECT EXCLUDE_FROM_ALL)
6969
target_sources(secp256k1_asm_arm PUBLIC
7070
asm/field_10x26_arm.s

0 commit comments

Comments
 (0)