Skip to content

Commit

Permalink
build: Disable some targets when external callbacks are enabled
Browse files Browse the repository at this point in the history
The benchmarks, constant-time tests and examples are not supposed to be
built when external callbacks are enabled.
  • Loading branch information
hebasto committed May 24, 2023
1 parent 09df0bf commit 1a56bff
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
7 changes: 4 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -150,11 +150,12 @@ if(SECP256K1_VALGRIND)
endif()
endif()

option(SECP256K1_BUILD_BENCHMARK "Build benchmarks." ON)
include(CMakeDependentOption)
cmake_dependent_option(SECP256K1_BUILD_BENCHMARK "Build benchmarks." ON "NOT SECP256K1_USE_EXTERNAL_DEFAULT_CALLBACKS" OFF)
option(SECP256K1_BUILD_TESTS "Build tests." ON)
option(SECP256K1_BUILD_EXHAUSTIVE_TESTS "Build exhaustive tests." ON)
option(SECP256K1_BUILD_CTIME_TESTS "Build constant-time tests." ${SECP256K1_VALGRIND})
option(SECP256K1_BUILD_EXAMPLES "Build examples." OFF)
cmake_dependent_option(SECP256K1_BUILD_CTIME_TESTS "Build constant-time tests." ${SECP256K1_VALGRIND} "NOT SECP256K1_USE_EXTERNAL_DEFAULT_CALLBACKS" OFF)
cmake_dependent_option(SECP256K1_BUILD_EXAMPLES "Build examples." ON "NOT SECP256K1_USE_EXTERNAL_DEFAULT_CALLBACKS" OFF)

# Redefine configuration flags.
# We leave assertions on, because they are only used in the examples, and we want them always on there.
Expand Down
6 changes: 6 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,12 @@ AC_ARG_ENABLE(external_default_callbacks,
AS_HELP_STRING([--enable-external-default-callbacks],[enable external default callback functions [default=no]]), [],
[SECP_SET_DEFAULT([enable_external_default_callbacks], [no], [no])])

if test x"$enable_external_default_callbacks" = x"yes"; then
enable_benchmark="no"
enable_ctime_tests="no"
enable_examples="no"
fi

# Test-only override of the (autodetected by the C code) "widemul" setting.
# Legal values are:
# * int64 (for [u]int64_t),
Expand Down

0 comments on commit 1a56bff

Please sign in to comment.