From e0ae595d4ae31882a69b12b1d017e0421d47f7ab Mon Sep 17 00:00:00 2001 From: Corentin Le Molgat Date: Fri, 31 Jan 2025 06:18:29 -0800 Subject: [PATCH] fix test_xprs_interface build --- ortools/xpress/CMakeLists.txt | 4 ++++ ortools/xpress/environment.h | 29 +++++++++++++++-------------- 2 files changed, 19 insertions(+), 14 deletions(-) diff --git a/ortools/xpress/CMakeLists.txt b/ortools/xpress/CMakeLists.txt index 51ae702b99..add1ace6ac 100644 --- a/ortools/xpress/CMakeLists.txt +++ b/ortools/xpress/CMakeLists.txt @@ -21,6 +21,10 @@ set_target_properties(${NAME} PROPERTIES CXX_EXTENSIONS OFF POSITION_INDEPENDENT_CODE ON ) +if(MSVC AND BUILD_SHARED_LIBS) + target_compile_definitions(${NAME} PUBLIC "OR_BUILD_DLL") + target_compile_definitions(${NAME} PRIVATE "OR_EXPORT") +endif() target_include_directories(${NAME} PRIVATE ${PROJECT_SOURCE_DIR} ${PROJECT_BINARY_DIR}) diff --git a/ortools/xpress/environment.h b/ortools/xpress/environment.h index fc075b0dd4..e066ad94a3 100644 --- a/ortools/xpress/environment.h +++ b/ortools/xpress/environment.h @@ -20,6 +20,7 @@ #include #include "absl/status/status.h" +#include "ortools/base/macros.h" extern "C" { typedef struct xo_prob_struct* XPRSprob; @@ -487,21 +488,21 @@ extern std::function XPRSsetintcontr extern std::function XPRSsetintcontrol64; extern std::function XPRSsetdblcontrol; extern std::function XPRSsetstrcontrol; -extern std::function XPRSgetintcontrol; -extern std::function XPRSgetintcontrol64; -extern std::function XPRSgetdblcontrol; -extern std::function XPRSgetstringcontrol; -extern std::function XPRSgetintattrib; -extern std::function XPRSgetdblattrib; +OR_DLL extern std::function XPRSgetintcontrol; +OR_DLL extern std::function XPRSgetintcontrol64; +OR_DLL extern std::function XPRSgetdblcontrol; +OR_DLL extern std::function XPRSgetstringcontrol; +OR_DLL extern std::function XPRSgetintattrib; +OR_DLL extern std::function XPRSgetdblattrib; extern std::function XPRSgetcontrolinfo; extern std::function XPRSloadlp; extern std::function XPRSloadlp64; -extern std::function XPRSgetobj; -extern std::function XPRSgetrhs; -extern std::function XPRSgetrhsrange; -extern std::function XPRSgetlb; -extern std::function XPRSgetub; -extern std::function XPRSgetcoef; +OR_DLL extern std::function XPRSgetobj; +OR_DLL extern std::function XPRSgetrhs; +OR_DLL extern std::function XPRSgetrhsrange; +OR_DLL extern std::function XPRSgetlb; +OR_DLL extern std::function XPRSgetub; +OR_DLL extern std::function XPRSgetcoef; extern std::function XPRSgetduals; extern std::function XPRSgetredcosts; extern std::function XPRSaddrows; @@ -517,8 +518,8 @@ extern std::function XPRSchgobjsense; extern std::function XPRSgetlasterror; extern std::function XPRSgetbasis; extern std::function XPRSwriteprob; -extern std::function XPRSgetrowtype; -extern std::function XPRSgetcoltype; +OR_DLL extern std::function XPRSgetrowtype; +OR_DLL extern std::function XPRSgetcoltype; extern std::function XPRSchgbounds; extern std::function XPRSaddmipsol; extern std::function XPRSgetlpsol;