Skip to content

Commit

Permalink
Support custom libs on MacOS
Browse files Browse the repository at this point in the history
  • Loading branch information
andreArtelt committed May 31, 2024
1 parent 52e3bb8 commit 594f963
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions epyt_flow/simulation/scenario_simulator.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,14 +95,19 @@ def __init__(self, f_inp_in: str = None, f_msx_in: str = None,

custom_epanet_lib = None
custom_epanetmsx_lib = None
if sys.platform.startswith("linux"):
if sys.platform.startswith("linux") or sys.platform.startswith("darwin") :
path_to_custom_libs = os.path.join(pathlib.Path(__file__).parent.resolve(),
"..", "customlibs")

if os.path.isfile(os.path.join(path_to_custom_libs, "libepanet2_2.so")):
custom_epanet_lib = os.path.join(path_to_custom_libs, "libepanet2_2.so")
if os.path.isfile(os.path.join(path_to_custom_libs, "libepanetmsx2_2_0.so")):
custom_epanetmsx_lib = os.path.join(path_to_custom_libs, "libepanetmsx2_2_0.so")
libepanet_name = "libepanet2_2.so" if sys.platform.startswith("linux") \
else "libepanet2_2.dylib"
libepanetmsx_name = "libepanetmsx2_2_0.so" if sys.platform.startswith("linux") \
else "libepanetmsx2_2_0.dylib"

if os.path.isfile(os.path.join(path_to_custom_libs, libepanet_name)):
custom_epanet_lib = os.path.join(path_to_custom_libs, libepanet_name)
if os.path.isfile(os.path.join(path_to_custom_libs, libepanetmsx_name)):
custom_epanetmsx_lib = os.path.join(path_to_custom_libs, libepanetmsx_name)

self.epanet_api = epanet(self.__f_inp_in, ph=self.__f_msx_in is None,
customlib=custom_epanet_lib, loadfile=True,
Expand Down

0 comments on commit 594f963

Please sign in to comment.