Open barracuda156 opened 1 month ago
libpapilo
is a library with an API that lets you set up an LP or MIP and get it solved via SCIP and SoPlex, as far as I see. It is only build if SCIP and SoPlex are found. However, for this library, -DBUILD_SHARED_LIBS=ON
should have an effect.
But libpapilo-core
and libclusol
are defined to be always build as static libraries. I don't know the history, e.g., whether these libs were initially meant not to be installed. Also, I'm not sure whether the classes in methods in libpapilo-core were even meant to be part of a public API. They are no attributes in the source that declare what should be visible in a shared/dynamic library. By default, all symbols there have visibility=hidden, which is ok for static libs, but makes them unusable in shared libs. Therefore, if you need to build these as shared libs, you will have to remove this too:
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -29,8 +29,6 @@ include(GNUInstallDirs)
# path to e.g. findGMP module
list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake/Modules/)
-set(CMAKE_CXX_VISIBILITY_PRESET hidden)
-set(CMAKE_VISIBILITY_INLINES_HIDDEN 1)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
# disable fused floating point contraction to enhance reproducibility across compilers and architectures
@@ -211,7 +209,7 @@ endif()
if(CMAKE_Fortran_COMPILER AND BLAS_FOUND)
enable_language(Fortran)
- add_library(clusol STATIC
+ add_library(clusol
src/papilo/external/lusol/src/lusol6b.f
src/papilo/external/lusol/src/lusol7b.f
src/papilo/external/lusol/src/lusol8b.f
@@ -257,7 +255,7 @@ else()
set(PAPILO_USE_STANDARD_HASHMAP 1)
endif()
-add_library(papilo-core STATIC
+add_library(papilo-core
src/papilo/core/VariableDomains.cpp
src/papilo/core/SparseStorage.cpp
src/papilo/core/ConstraintMatrix.cpp
I can then get these libs are shared libs when setting -DBUILD_SHARED_LIBS=ON
on my Linux system.
I have some doubt that it would be sufficient to build usable Windows DLLs though, since there nothing is exported in a DLL unless it got an explicit dllexport
attribute (or via .def
file).
How to build
libpapilo
as a dynamic lib? Standard-DBUILD_SHARED_LIBS=ON
fails to have an effect, only static libs get built:P. S. Original issue: https://github.com/lgottwald/PaPILO/issues/56