Skip to content

Commit

Permalink
build: Update binaries with structure condusive to multi-platform Dar…
Browse files Browse the repository at this point in the history
…win builds
  • Loading branch information
dbhart committed Dec 14, 2024
1 parent be18e35 commit caa0af2
Show file tree
Hide file tree
Showing 20 changed files with 25 additions and 15 deletions.
Binary file removed wntr/epanet/Darwin/libepanet.dylib
Binary file not shown.
Binary file removed wntr/epanet/Darwin/libepanet2.dylib
Binary file not shown.
Binary file removed wntr/epanet/Darwin/libepanet22.dylib
Binary file not shown.
Binary file removed wntr/epanet/Linux/libepanet22_amd64.so
Binary file not shown.
Binary file removed wntr/epanet/Linux/libepanet2_amd64.so
Binary file not shown.
Binary file removed wntr/epanet/Windows/epanet2.dll
Binary file not shown.
Binary file removed wntr/epanet/Windows/epanet22_amd64.dll
Binary file not shown.
Binary file removed wntr/epanet/Windows/epanet22_win32.dll
Binary file not shown.
Binary file removed wntr/epanet/Windows/epanet2_amd64.dll
Binary file not shown.
Binary file removed wntr/epanet/Windows/epanetmsx.dll
Binary file not shown.
Binary file not shown.
File renamed without changes.
Binary file not shown.
Binary file not shown.
File renamed without changes.
File renamed without changes.
Binary file added wntr/epanet/libepanet/windows-x64/epanet2.dll
Binary file not shown.
Binary file added wntr/epanet/libepanet/windows-x64/epanetmsx.dll
Binary file not shown.
31 changes: 19 additions & 12 deletions wntr/epanet/msx/toolkit.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
licensed under the BSD license. See LICENSE.md for details.
"""
import ctypes
import logging
import os
import os.path
import platform
Expand All @@ -20,29 +21,35 @@
from wntr.epanet.msx.enums import TkObjectType, TkSourceType

from ..toolkit import ENepanet
from .exceptions import MSX_ERROR_CODES, EpanetMsxException, MSXKeyError, MSXValueError
from .exceptions import (MSX_ERROR_CODES, EpanetMsxException, MSXKeyError,
MSXValueError)

logger = logging.getLogger(__name__)

epanet_toolkit = "wntr.epanet.toolkit"

if os.name in ["nt", "dos"]:
libepanet = resource_filename(__name__, "../Windows/epanet2.dll")
libmsx = resource_filename(__name__, "../Windows/epanetmsx.dll")
libepanet = resource_filename(__name__, "../libepanet/windows-x64/epanet2.dll")
libmsx = resource_filename(__name__, "../libepanet/windows-x64/epanetmsx.dll")
elif sys.platform in ["darwin"]:
libepanet = resource_filename(__name__, "../Darwin/libepanet2.dylib")
libmsx = resource_filename(__name__, "../Darwin/libepanetmsx.dylib")
if 'arm' in platform.platform().lower():
libepanet = resource_filename(__name__, "../libepanet/darwin-arm/libepanet.dylib")
libmsx = resource_filename(__name__, "../libepanet/darwin-arm/libepanetmsx.dylib")
else:
libepanet = resource_filename(__name__, "../libepanet/darwin-x64/libepanet.dylib")
libmsx = resource_filename(__name__, "../libepanet/darwin-x64/libepanetmsx.dylib")
else:
libepanet = resource_filename(__name__, "../Linux/libepanet2.so")
libmsx = resource_filename(__name__, "../Linux/libepanetmsx.so")
libepanet = resource_filename(__name__, "../libepanet/linux-x64/libepanet2.so")
libmsx = resource_filename(__name__, "../libepanet/linux-x64/epanetmsx.dll")

dylib_dir = os.environ.get('DYLD_FALLBACK_LIBRARY_PATH','')
if dylib_dir != '':
dylib_dir = dylib_dir + ':' + resource_filename(__name__, "../Darwin")
if 'arm' in platform.platform().lower():
dylib_dir = dylib_dir + ':' + resource_filename(__name__, "../libepanet/darwin-arm")
else:
dylib_dir = dylib_dir + ':' + resource_filename(__name__, "../libepanet/darwin-x64")
os.environ['DYLD_FALLBACK_LIBRARY_PATH'] = dylib_dir

import logging

logger = logging.getLogger(__name__)


class MSXepanet(ENepanet):
def __init__(self, inpfile="", rptfile="", binfile="", msxfile=""):
Expand Down
9 changes: 6 additions & 3 deletions wntr/epanet/toolkit.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,14 @@
epanet_toolkit = "wntr.epanet.toolkit"

if os.name in ["nt", "dos"]:
libepanet = resource_filename(__name__, "Windows/epanet2.dll")
libepanet = resource_filename(__name__, "libepanet/windows-x64/epanet2.dll")
elif sys.platform in ["darwin"]:
libepanet = resource_filename(__name__, "Darwin/libepanet.dylib")
if 'arm' in platform.platform().lower():
libepanet = resource_filename(__name__, "libepanet/darwin-arm/libepanet.dylib")
else:
libepanet = resource_filename(__name__, "libepanet/darwin-x64/libepanet.dylib")
else:
libepanet = resource_filename(__name__, "Linux/libepanet2.so")
libepanet = resource_filename(__name__, "libepanet/linux-x64/libepanet2.so")


def ENgetwarning(code, sec=-1):
Expand Down

0 comments on commit caa0af2

Please sign in to comment.