From b179715d65f597f77bd86b60fba0cfaec4edbe74 Mon Sep 17 00:00:00 2001 From: nindanaoto Date: Tue, 18 Apr 2023 08:49:28 +0000 Subject: [PATCH] Added Shared option --- CMakeLists.txt | 2 ++ src/CMakeLists.txt | 7 ++++++- thirdparties/spqlios/CMakeLists.txt | 6 +++++- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 074f744..3d8f071 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -25,6 +25,8 @@ option(ENABLE_BENCHMARK "Build benchmarks" OFF) option(ENABLE_TUTORIAL "Build tutorial" OFF) option(USE_PERF "Use Google Profiler" OFF) +option(ENABLE_SHARED "Build as shared libraries" OFF) + if(USE_RANDEN) add_compile_definitions(USE_RANDEN) endif() diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index a1d006b..2845c90 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,6 +1,11 @@ file(GLOB tfhe++_sources "*.cpp") -add_library(tfhe++ ${tfhe++_sources}) +if(ENABLE_SHARED) + add_library(tfhe++ SHARED ${tfhe++_sources}) +else() + add_library(tfhe++ STATIC ${tfhe++_sources}) +endif() + target_include_directories( tfhe++ PUBLIC diff --git a/thirdparties/spqlios/CMakeLists.txt b/thirdparties/spqlios/CMakeLists.txt index 52621f2..d493dbf 100644 --- a/thirdparties/spqlios/CMakeLists.txt +++ b/thirdparties/spqlios/CMakeLists.txt @@ -11,6 +11,10 @@ endif() set(SPQLIOS_HEADERS fft_processor_spqlios.h) -add_library(spqlios STATIC ${SRCS_FMA} ${SPQLIOS_HEADERS}) +if(ENABLE_SHARED) + add_library(spqlios SHARED ${SRCS_FMA} ${SPQLIOS_HEADERS}) +else() + add_library(spqlios STATIC ${SRCS_FMA} ${SPQLIOS_HEADERS}) +endif() target_include_directories(spqlios PUBLIC ${PROJECT_SOURCE_DIR}/include)