Skip to content

Commit 614c663

Browse files
authored
configure libOMSimulator relative dll path (#1272)
1 parent 3ad5213 commit 614c663

2 files changed

Lines changed: 12 additions & 1 deletion

File tree

src/OMSimulatorPython/CMakeLists.txt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,17 @@ ELSE ()
1010
set(OMSIMULATORLIB_STRING "libOMSimulator.so")
1111
ENDIF ()
1212

13+
## If OMSimulator is being built as part of OpenModelica and that is set by "OPENMODELICA_NEW_CMAKE_BUILD"
14+
## account for the "omc" directory added in the lib dir (lib/omc/OMSimulator versus lib/OMSimulator)
15+
## currently this sets the path only for windows
16+
## TODO fix the paths for linux
17+
if(OPENMODELICA_NEW_CMAKE_BUILD)
18+
set(OMSIMULATOR_PYTHON_RELATIVE_DLL_DIR "../../../bin")
19+
else()
20+
set(OMSIMULATOR_PYTHON_RELATIVE_DLL_DIR "../../bin")
21+
endif()
22+
23+
1324
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/__init__.py" "${CMAKE_CURRENT_BINARY_DIR}/__init__.py" @ONLY)
1425
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/capi.py" "${CMAKE_CURRENT_BINARY_DIR}/capi.py" @ONLY)
1526
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/OMSimulatorPython3.in" "${CMAKE_CURRENT_BINARY_DIR}/OMSimulatorPython3" @ONLY)

src/OMSimulatorPython/capi.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ def __init__(self):
1010
omslib = os.path.join(dirname, "..", "@OMSIMULATORLIB_STRING@")
1111

1212
if os.name == 'nt': # Windows
13-
omslib = os.path.join(dirname, "../../bin/", "@OMSIMULATORLIB_STRING@")
13+
omslib = os.path.join(dirname, "@OMSIMULATOR_PYTHON_RELATIVE_DLL_DIR@", "@OMSIMULATORLIB_STRING@")
1414
dllDir = os.add_dll_directory(os.path.dirname(omslib))
1515
self.obj=ctypes.CDLL(omslib)
1616
if os.name == 'nt': # Windows

0 commit comments

Comments
 (0)