diff --git a/CMakeLists.txt b/CMakeLists.txt index 1bb3095bd1ae1b02a292bc564612e85f47ec9102..60891ed9373d3d9396ccda32aae49b3a71912a2b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -33,6 +33,13 @@ option(WERROR "Warning as error (Default: OFF)" OFF) option(TEST "Enable tests (Default: ON)" ON) option(COVERAGE "Enable coverage (Default: OFF)" OFF) option(ENABLE_ASAN "Enable ASan (AddressSanitizer) for runtime analysis of memory use (over/underflow, memory leak, ...) (Default: OFF)" OFF) +option(SHARED_LIBRARY "${module_name} created library will be shared, if off, it will be an archive (Default: OFF)" OFF) + +if(SHARED_LIBRARY) + set(LIB_TYPE SHARED) +else(SHARED_LIBRARY) + set(LIB_TYPE STATIC) +endif(SHARED_LIBRARY) ############################################## # Import utils CMakeLists @@ -90,7 +97,7 @@ enable_language(CUDA) file(GLOB_RECURSE src_files "src/*.cpp" "src/*.cu") file(GLOB_RECURSE inc_files "include/*.hpp") -add_library(${module_name} ${src_files} ${inc_files}) +add_library(${module_name} ${LIB_TYPE} ${src_files} ${inc_files}) # PYTHON BINDING if (PYBIND) diff --git a/setup.py b/setup.py index 706fc53ca08319ee487ef789ebc85f0d513ab25b..c5d7f13b2895cb6472ee2d7c1a2b1ac3435bedc8 100644 --- a/setup.py +++ b/setup.py @@ -75,6 +75,7 @@ class CMakeBuild(build_ext): *build_gen, str(cwd), "-DTEST=OFF", + "-DSHARED_LIB=OFF" f"-DCMAKE_INSTALL_PREFIX:PATH={install_path}", f"-DCMAKE_BUILD_TYPE={compile_type}", "-DPYBIND=ON",