Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Properly link to xpress loader even is coin is disabled #915

Merged
merged 2 commits into from
Sep 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions src/cpp/multisolver_interface/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -53,17 +53,19 @@ target_include_directories (solvers
${xpansion_interfaces_path}
)


target_link_libraries(solvers
PUBLIC
${CMAKE_DL_LIBS}
)

#CLP-CBC
if(COIN_OR)
target_link_libraries (solvers
PUBLIC
PRIVATE
Coin::Clp
Coin::Cgl
Coin::CoinUtils
Coin::Osi
Coin::Cbc
${CMAKE_DL_LIBS}
)
endif()
7 changes: 5 additions & 2 deletions src/cpp/multisolver_interface/environment.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@
#include <sstream>
#include <string>

namespace Solver {
class DynamicLibrary;
}
namespace LoadXpress {

#define STRINGIFY2(X) #X
Expand Down Expand Up @@ -141,7 +144,7 @@ std::function<int(XPRSprob prob, int attrib, int* p_value)> XPRSgetintattrib =
XpressLoader::XpressLoader(std::shared_ptr<ILoggerXpansion> logger)
: logger_(std::move(logger)) {}

bool XpressLoader::LoadXpressFunctions(DynamicLibrary* xpress_dynamic_library) {
bool XpressLoader::LoadXpressFunctions(Solver::DynamicLibrary* xpress_dynamic_library) {
// This was generated with the parse_header_xpress.py script.
// See the comment at the top of the script.

Expand Down Expand Up @@ -299,7 +302,7 @@ bool XpressLoader::LoadXpressDynamicLibrary(std::string& xpresspath) {
static std::string xpress_lib_path;
static std::once_flag xpress_loading_done;
static bool ret;
static DynamicLibrary xpress_library;
static Solver::DynamicLibrary xpress_library;
// static std::mutex mutex;

// mutex.lock();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#include <dlfcn.h>
#endif

namespace Solver {
class DynamicLibrary {
static constexpr size_t kMaxFunctionsNotFound = 10;

Expand Down Expand Up @@ -111,5 +112,6 @@ class DynamicLibrary {
}
};
};
}

#endif // OR_TOOLS_BASE_DYNAMIC_LIBRARY_H_
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class XpressLoader {
std::vector<std::string> XpressDynamicLibraryPotentialPaths();
std::string GetXpressVarFromEnvironmentVariables(const char* XPRESS_var,
bool verbose = true);
bool LoadXpressFunctions(DynamicLibrary* xpress_dynamic_library);
bool LoadXpressFunctions(Solver::DynamicLibrary* xpress_dynamic_library);
int loadLicence(const std::string& lib_path, bool verbose);
};

Expand Down
Loading