Skip to content

Commit

Permalink
Add library path with os.add_dll_directory() (#3473)
Browse files Browse the repository at this point in the history
* Add library path with os.add_dll_directory()

* Update path for Visual Studio
  • Loading branch information
peastman committed Feb 19, 2022
1 parent e2e7b31 commit 4142e19
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ jobs:
env:
CMAKE_FLAGS: ${{ matrix.CMAKE_FLAGS }}
run: |
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x64
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x64
mkdir build
cd build
cmake -G "NMake Makefiles JOM" ^
Expand All @@ -403,7 +403,7 @@ jobs:
- name: "Build OpenMM"
shell: cmd /C call {0}
run: |
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x64
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x64
cd build
jom -j 2
if errorlevel 1 exit 1
Expand All @@ -414,7 +414,7 @@ jobs:
shell: cmd /C call {0}
if: ${{ !contains(matrix.CMAKE_FLAGS, 'OPENMM_BUILD_PYTHON_WRAPPERS=OFF') }}
run: |
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x64
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x64
cd build
jom -j 2 PythonInstall
Expand Down
4 changes: 4 additions & 0 deletions wrappers/python/openmm/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@
_path = os.environ['PATH']
os.environ['PATH'] = '%(lib)s;%(lib)s\plugins;%(path)s' % {
'lib': version.openmm_library_path, 'path': _path}
try:
os.add_dll_directory(version.openmm_library_path)
except:
pass

from openmm.openmm import *
from openmm.vec3 import Vec3
Expand Down

0 comments on commit 4142e19

Please sign in to comment.