From 6b4220a2ce74fbfce0048dc4f18f3be4d504423d Mon Sep 17 00:00:00 2001 From: Martin Schanzenbach Date: Wed, 4 Dec 2024 08:58:18 +0100 Subject: [PATCH] add RELIC_ARITH CLI option that defaults to `easy`; making gmp an optional dependency. Fixes #12 --- CMakeLists.txt | 3 ++- README.md | 5 +++-- src/CMakeLists.txt | 8 +++++--- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1ab5947..db53469 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -29,6 +29,7 @@ else() message(STATUS "-finline-small-functions not supported.") endif() +SET(RELIC_ARITH "easy" CACHE STRING "The ARITH value for RELIC build") message(STATUS "Relic CFLAGS: ${RELIC_CFLAGS}") include(ExternalProject) @@ -48,7 +49,7 @@ ExternalProject_Add( -DTIMER= -DCHECK=off -DVERBS=off - -DARITH=gmp + -DARITH=${RELIC_ARITH} -DFP_PRIME=381 "-DFP_METHD=BASIC^^COMBA^^COMBA^^MONTY^^MONTY^^JMPDS^^SLIDE" "-DCFLAGS=${RELIC_CFLAGS}" diff --git a/README.md b/README.md index b4d6cd6..fd71976 100644 --- a/README.md +++ b/README.md @@ -10,13 +10,14 @@ Provides a library `libbbs` implementing the `BLS12381-SHA-256` and `BLS12-381-S Dependencies: -- `gmp` - `cmake` (build only) +- `gmp` (optional) ```zsh mkdir build cd build -cmake .. +cmake .. # Without GMP or +cmake -DRELIC_ARITH="gmp" .. # (if you have gmp) ``` ### Installation diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index dce5eb7..3695102 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,6 +1,8 @@ -find_library(GMP_LIB gmp REQUIRED) -find_path(GMP_PATH gmp.h REQUIRED) -message(STATUS "GMP_PATH: ${GMP_PATH}") +if(RELIC_ARITH STREQUAL "gmp") + find_library(GMP_LIB gmp REQUIRED) + find_path(GMP_PATH gmp.h REQUIRED) + message(STATUS "GMP_PATH: ${GMP_PATH}") +endif() add_library(bbs SHARED bbs.c