Skip to content

Commit

Permalink
add RELIC_ARITH CLI option that defaults to easy; making gmp an opt…
Browse files Browse the repository at this point in the history
…ional dependency. Fixes #12
  • Loading branch information
schanzen committed Dec 4, 2024
1 parent 6a8b847 commit 6b4220a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
3 changes: 2 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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}"
Expand Down
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 5 additions & 3 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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
Expand Down

0 comments on commit 6b4220a

Please sign in to comment.