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)