Merge pull request #244 from michaeltryby/dev
Fixes python wrapper build
This commit is contained in:
@@ -75,12 +75,11 @@ source_group("Library" FILES ${EPANET_LIB_ALL})
|
||||
|
||||
|
||||
# the shared library
|
||||
add_library(epanet SHARED ${EPANET_SOURCES}) #${EPANET_API_HEADER})
|
||||
add_library(epanet SHARED ${EPANET_SOURCES})
|
||||
target_include_directories(epanet PUBLIC ${PROJECT_SOURCE_DIR}/include)
|
||||
|
||||
|
||||
# create export lib so we can link against dll using Visual Studio
|
||||
add_definitions(-D WITH_GENX)
|
||||
include(GenerateExportHeader)
|
||||
GENERATE_EXPORT_HEADER(epanet
|
||||
BASE_NAME epanet
|
||||
|
||||
@@ -30,9 +30,7 @@
|
||||
#define EN_API_FLOAT_TYPE float
|
||||
#endif
|
||||
|
||||
#ifdef WITH_GENX
|
||||
#include "epanet_export.h"
|
||||
#else
|
||||
#ifdef NO_GENX
|
||||
// --- define WINDOWS
|
||||
#undef WINDOWS
|
||||
#ifdef _WIN32
|
||||
@@ -62,6 +60,8 @@
|
||||
#define DLLEXPORT
|
||||
#endif
|
||||
#endif
|
||||
#else
|
||||
#include "epanet_export.h"
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
@@ -19,7 +19,6 @@ source_group("CLI" FILES ${EPANET_CLI_SOURCES})
|
||||
|
||||
|
||||
# Creates the EPANET command line executable
|
||||
add_definitions(-D WITH_GENX)
|
||||
add_executable(runepanet ${EPANET_CLI_SOURCES})
|
||||
if(NOT WIN32)
|
||||
target_link_libraries(runepanet LINK_PUBLIC epanet m)
|
||||
|
||||
@@ -132,7 +132,7 @@ execute function x and set the error code equal to its return value.
|
||||
|
||||
// This single global variable is used only when the library is called
|
||||
// in "legacy mode" with the 2.1-style API.
|
||||
EN_Project *_defaultModel;
|
||||
void *_defaultModel;
|
||||
|
||||
|
||||
// Local functions
|
||||
@@ -164,12 +164,15 @@ void errorLookup(int errcode, char *errmsg, int len);
|
||||
int DLLEXPORT ENepanet(const char *f1, const char *f2, const char *f3, void (*pviewprog)(char *))
|
||||
{
|
||||
int errcode = 0;
|
||||
EN_Project *p = NULL;
|
||||
|
||||
ERRCODE(EN_createproject(&_defaultModel));
|
||||
ERRCODE(EN_open(_defaultModel, f1, f2, f3));
|
||||
_defaultModel->viewprog = pviewprog;
|
||||
|
||||
if (_defaultModel->out_files.Hydflag != USE) {
|
||||
p = (EN_Project*)(_defaultModel);
|
||||
p->viewprog = pviewprog;
|
||||
|
||||
if (p->out_files.Hydflag != USE) {
|
||||
ERRCODE(EN_solveH(_defaultModel));
|
||||
}
|
||||
|
||||
|
||||
@@ -21,9 +21,9 @@ Find /i "x86" < checkOS.tmp > StringCheck.tmp
|
||||
If %ERRORLEVEL% == 1 (
|
||||
CALL "%SDK_PATH%bin\"SetEnv.cmd /x64 /release
|
||||
rem : create EPANET2.DLL
|
||||
cl -o epanet2.dll epanet.c util\errormanager.c hash.c hydraul.c hydcoeffs.c hydstatus.c hydsolver.c inpfile.c input1.c input2.c input3.c mempool.c output.c quality.c report.c rules.c smatrix.c genmmd.c /I ..\include /I ..\run /link /DLL
|
||||
cl -o epanet2.dll /D NO_GENX epanet.c util\errormanager.c hash.c hydraul.c hydcoeffs.c hydstatus.c hydsolver.c inpfile.c input1.c input2.c input3.c mempool.c output.c quality.c report.c rules.c smatrix.c genmmd.c /I ..\include /I ..\run /link /DLL
|
||||
rem : create EPANET2.EXE
|
||||
cl -o epanet2.exe epanet.c util\errormanager.c ..\run\main.c hash.c hydraul.c hydcoeffs.c hydstatus.c hydsolver.c inpfile.c input1.c input2.c input3.c mempool.c output.c quality.c report.c rules.c smatrix.c genmmd.c /I ..\include /I ..\run /I ..\src /link
|
||||
cl -o epanet2.exe /D NO_GENX epanet.c util\errormanager.c ..\run\main.c hash.c hydraul.c hydcoeffs.c hydstatus.c hydsolver.c inpfile.c input1.c input2.c input3.c mempool.c output.c quality.c report.c rules.c smatrix.c genmmd.c /I ..\include /I ..\run /I ..\src /link
|
||||
md "%Build_PATH%"\64bit
|
||||
move /y "%SRC_PATH%"\*.dll "%Build_PATH%"\64bit
|
||||
move /y "%SRC_PATH%"\*.exe "%Build_PATH%"\64bit
|
||||
@@ -35,9 +35,9 @@ rem : 32 bit with DEF
|
||||
CALL "%SDK_PATH%bin\"SetEnv.cmd /x86 /release
|
||||
echo "32 bit with epanet2.def mapping"
|
||||
rem : create EPANET2.DLL
|
||||
cl -o epanet2.dll epanet.c util\errormanager.c hash.c hydraul.c hydcoeffs.c hydstatus.c hydsolver.c inpfile.c input1.c input2.c input3.c mempool.c output.c quality.c report.c rules.c smatrix.c genmmd.c /I ..\include /I ..\run /link /DLL /def:..\win_build\WinSDK\epanet2.def /MAP
|
||||
cl -o epanet2.dll /D NO_GENX epanet.c util\errormanager.c hash.c hydraul.c hydcoeffs.c hydstatus.c hydsolver.c inpfile.c input1.c input2.c input3.c mempool.c output.c quality.c report.c rules.c smatrix.c genmmd.c /I ..\include /I ..\run /link /DLL /def:..\win_build\WinSDK\epanet2.def /MAP
|
||||
rem : create EPANET2.EXE
|
||||
cl -o epanet2.exe epanet.c util\errormanager.c ..\run\main.c hash.c hydraul.c hydcoeffs.c hydstatus.c hydsolver.c inpfile.c input1.c input2.c input3.c mempool.c output.c quality.c report.c rules.c smatrix.c genmmd.c /I ..\include /I ..\run /I ..\src /link
|
||||
cl -o epanet2.exe /D NO_GENX epanet.c util\errormanager.c ..\run\main.c hash.c hydraul.c hydcoeffs.c hydstatus.c hydsolver.c inpfile.c input1.c input2.c input3.c mempool.c output.c quality.c report.c rules.c smatrix.c genmmd.c /I ..\include /I ..\run /I ..\src /link
|
||||
md "%Build_PATH%"\32bit
|
||||
move /y "%SRC_PATH%"\*.dll "%Build_PATH%"\32bit
|
||||
move /y "%SRC_PATH%"\*.exe "%Build_PATH%"\32bit
|
||||
|
||||
Reference in New Issue
Block a user