diff --git a/SRC_engines/include/epanet2.h b/SRC_engines/include/epanet2.h index 19c9c67..97fce76 100644 --- a/SRC_engines/include/epanet2.h +++ b/SRC_engines/include/epanet2.h @@ -36,20 +36,18 @@ function in epanet2_2.h. #define EN_API_FLOAT_TYPE float #endif -#ifndef DLLEXPORT - #ifdef _WIN32 - #ifdef epanet2_EXPORTS - #define DLLEXPORT __declspec(dllexport) __stdcall - #else - #define DLLEXPORT __declspec(dllimport) __stdcall - #endif - #elif defined(__CYGWIN__) - #define DLLEXPORT __stdcall - #else - #define DLLEXPORT - #endif + +// --- define WINDOWS + +#undef WINDOWS +#ifdef _WIN32 + #define WINDOWS +#endif +#ifdef __WIN32__ + #define WINDOWS #endif +#include "epanet2_export.h" #include "epanet2_enums.h" // --- Declare the EPANET toolkit functions diff --git a/SRC_engines/include/epanet2_2.h b/SRC_engines/include/epanet2_2.h index cbfece3..adb0b9e 100644 --- a/SRC_engines/include/epanet2_2.h +++ b/SRC_engines/include/epanet2_2.h @@ -18,24 +18,8 @@ #ifndef EPANET2_2_H #define EPANET2_2_H -#ifdef epanet_py_EXPORTS - #define DLLEXPORT -#else - #ifndef DLLEXPORT - #ifdef _WIN32 - #ifdef epanet2_EXPORTS - #define DLLEXPORT __declspec(dllexport) __stdcall - #else - #define DLLEXPORT __declspec(dllimport) __stdcall - #endif - #elif defined(__CYGWIN__) - #define DLLEXPORT __stdcall - #else - #define DLLEXPORT - #endif - #endif -#endif +#include "epanet2_export.h" #include "epanet2_enums.h" // --- Declare the EPANET toolkit functions diff --git a/SRC_engines/src/solver/CMakeLists.txt b/SRC_engines/src/solver/CMakeLists.txt index 5e05922..67aff90 100644 --- a/SRC_engines/src/solver/CMakeLists.txt +++ b/SRC_engines/src/solver/CMakeLists.txt @@ -73,6 +73,19 @@ target_include_directories(epanet2 $ ) +include(GenerateExportHeader) +generate_export_header(epanet2 + BASE_NAME epanet2 + EXPORT_MACRO_NAME DLLEXPORT + EXPORT_FILE_NAME epanet2_export.h + STATIC_DEFINE SHARED_EXPORTS_BUILT_AS_STATIC +) + +file(COPY ${CMAKE_CURRENT_BINARY_DIR}/epanet2_export.h + DESTINATION ${PROJECT_SOURCE_DIR}/include +) + + if(APPLE) set(LIB_ROOT "@loader_path") else() diff --git a/SRC_engines/src/solver/version.h b/SRC_engines/src/solver/version.h index d816303..2eec942 100644 --- a/SRC_engines/src/solver/version.h +++ b/SRC_engines/src/solver/version.h @@ -22,12 +22,12 @@ #define VERSION_MAJOR 2 #define VERSION_MINOR 2 #define VERSION_PATCH 0 -#define GIT_HASH "5480e100e626b479a866da4bdd867f69400b4e31" +#define GIT_HASH "c2224b3c1a85ec9f35cca1f6ddfec3d4bdf6465c" #define PLATFORM "Windows" #define COMPILER "MSVC" #define COMPILER_VERSION "19.37.32825.0" -#define BUILD_ID "2023-11-13T22:04:14Z" +#define BUILD_ID "2023-11-15T13:41:19Z" static inline int get_version_legacy() { \