Skip to content

Commit c32715b

Browse files
committed
cmake, move-only: Move module option processing to src/CMakeLists.txt
This change simplifies the following commit.
1 parent 201b2b8 commit c32715b

File tree

2 files changed

+34
-34
lines changed

2 files changed

+34
-34
lines changed

CMakeLists.txt

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -52,40 +52,6 @@ option(SECP256K1_ENABLE_MODULE_SCHNORRSIG "Enable schnorrsig module." ON)
5252
option(SECP256K1_ENABLE_MODULE_MUSIG "Enable musig module." ON)
5353
option(SECP256K1_ENABLE_MODULE_ELLSWIFT "Enable ElligatorSwift module." ON)
5454

55-
# Processing must be done in a topological sorting of the dependency graph
56-
# (dependent module first).
57-
if(SECP256K1_ENABLE_MODULE_ELLSWIFT)
58-
add_compile_definitions(ENABLE_MODULE_ELLSWIFT=1)
59-
endif()
60-
61-
if(SECP256K1_ENABLE_MODULE_MUSIG)
62-
if(DEFINED SECP256K1_ENABLE_MODULE_SCHNORRSIG AND NOT SECP256K1_ENABLE_MODULE_SCHNORRSIG)
63-
message(FATAL_ERROR "Module dependency error: You have disabled the schnorrsig module explicitly, but it is required by the musig module.")
64-
endif()
65-
set(SECP256K1_ENABLE_MODULE_SCHNORRSIG ON)
66-
add_compile_definitions(ENABLE_MODULE_MUSIG=1)
67-
endif()
68-
69-
if(SECP256K1_ENABLE_MODULE_SCHNORRSIG)
70-
if(DEFINED SECP256K1_ENABLE_MODULE_EXTRAKEYS AND NOT SECP256K1_ENABLE_MODULE_EXTRAKEYS)
71-
message(FATAL_ERROR "Module dependency error: You have disabled the extrakeys module explicitly, but it is required by the schnorrsig module.")
72-
endif()
73-
set(SECP256K1_ENABLE_MODULE_EXTRAKEYS ON)
74-
add_compile_definitions(ENABLE_MODULE_SCHNORRSIG=1)
75-
endif()
76-
77-
if(SECP256K1_ENABLE_MODULE_EXTRAKEYS)
78-
add_compile_definitions(ENABLE_MODULE_EXTRAKEYS=1)
79-
endif()
80-
81-
if(SECP256K1_ENABLE_MODULE_RECOVERY)
82-
add_compile_definitions(ENABLE_MODULE_RECOVERY=1)
83-
endif()
84-
85-
if(SECP256K1_ENABLE_MODULE_ECDH)
86-
add_compile_definitions(ENABLE_MODULE_ECDH=1)
87-
endif()
88-
8955
option(SECP256K1_USE_EXTERNAL_DEFAULT_CALLBACKS "Enable external default callback functions." OFF)
9056
if(SECP256K1_USE_EXTERNAL_DEFAULT_CALLBACKS)
9157
add_compile_definitions(USE_EXTERNAL_DEFAULT_CALLBACKS=1)

src/CMakeLists.txt

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,40 @@
11
# Must be included before CMAKE_INSTALL_INCLUDEDIR is used.
22
include(GNUInstallDirs)
33

4+
# Processing must be done in a topological sorting of the dependency graph
5+
# (dependent module first).
6+
if(SECP256K1_ENABLE_MODULE_ELLSWIFT)
7+
add_compile_definitions(ENABLE_MODULE_ELLSWIFT=1)
8+
endif()
9+
10+
if(SECP256K1_ENABLE_MODULE_MUSIG)
11+
if(DEFINED SECP256K1_ENABLE_MODULE_SCHNORRSIG AND NOT SECP256K1_ENABLE_MODULE_SCHNORRSIG)
12+
message(FATAL_ERROR "Module dependency error: You have disabled the schnorrsig module explicitly, but it is required by the musig module.")
13+
endif()
14+
set(SECP256K1_ENABLE_MODULE_SCHNORRSIG ON)
15+
add_compile_definitions(ENABLE_MODULE_MUSIG=1)
16+
endif()
17+
18+
if(SECP256K1_ENABLE_MODULE_SCHNORRSIG)
19+
if(DEFINED SECP256K1_ENABLE_MODULE_EXTRAKEYS AND NOT SECP256K1_ENABLE_MODULE_EXTRAKEYS)
20+
message(FATAL_ERROR "Module dependency error: You have disabled the extrakeys module explicitly, but it is required by the schnorrsig module.")
21+
endif()
22+
set(SECP256K1_ENABLE_MODULE_EXTRAKEYS ON)
23+
add_compile_definitions(ENABLE_MODULE_SCHNORRSIG=1)
24+
endif()
25+
26+
if(SECP256K1_ENABLE_MODULE_EXTRAKEYS)
27+
add_compile_definitions(ENABLE_MODULE_EXTRAKEYS=1)
28+
endif()
29+
30+
if(SECP256K1_ENABLE_MODULE_RECOVERY)
31+
add_compile_definitions(ENABLE_MODULE_RECOVERY=1)
32+
endif()
33+
34+
if(SECP256K1_ENABLE_MODULE_ECDH)
35+
add_compile_definitions(ENABLE_MODULE_ECDH=1)
36+
endif()
37+
438
add_library(secp256k1_precomputed OBJECT EXCLUDE_FROM_ALL
539
precomputed_ecmult.c
640
precomputed_ecmult_gen.c

0 commit comments

Comments
 (0)