From e03039d0cee47605463510d7b532fa63d35af02c Mon Sep 17 00:00:00 2001 From: MITSUNARI Shigeo Date: Tue, 16 Apr 2019 20:35:28 +0900 Subject: [PATCH] cmake supports USE_OPENSSL and USE_GMP --- CMakeLists.txt | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index aaa0a8c..e8832d9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -12,6 +12,16 @@ option( "download cybozulib_ext" OFF ) +option( + USE_OPENSSL + "use openssl" + ON +) +option( + USE_GMP + "use gmp" + ON +) set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) @@ -49,7 +59,20 @@ else() set(SRCS ${SRCS} src/asm/x86-64.s src/asm/x86-64.bmi2.s) set(CPU x86-64) endif() - set(LIBS mcl gmp gmpxx crypto) + set(LIBS mcl) + if(USE_GMP) + set(LIBS ${LIBS} gmp gmpxx) + endif() + if(USE_OPENSSL) + set(LIBS ${LIBS} crypto) + endif() +endif() + +if(NOT USE_GMP) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DMCL_USE_VINT -DMCL_VINT_FIXED_BUFFER") +endif() +if(NOT USE_OPENSSL) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DMCL_DONT_USE_OPENSSL") endif() if(DOWNLOAD_SOURCE)