Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions dpctl/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,10 +129,6 @@
"utils",
]

if hasattr(os, "add_dll_directory"):
# Include folder containing DPCTLSyclInterface.dll to search path
os.add_dll_directory(os.path.dirname(__file__))


def get_include():
r"""
Expand Down
28 changes: 16 additions & 12 deletions dpctl/_init_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,24 @@
import os.path
import sys

is_venv_win32 = (
sys.platform == "win32"
and sys.base_exec_prefix != sys.exec_prefix
and os.path.isfile(os.path.join(sys.exec_prefix, "pyvenv.cfg"))
is_venv = sys.base_exec_prefix != sys.exec_prefix and os.path.isfile(
os.path.join(sys.exec_prefix, "pyvenv.cfg")
)

if is_venv_win32: # pragma: no cover
# For virtual environments on Windows, add folder
# with DPC++ libraries to the DLL search path gh-1745
dll_dir = os.path.join(sys.exec_prefix, "Library", "bin")
if os.path.isdir(dll_dir):
os.add_dll_directory(dll_dir)

del is_venv_win32
if sys.platform == "win32": # pragma: no cover
# Include folder containing DPCTLSyclInterface.dll to search path
os.add_dll_directory(os.path.dirname(__file__))
if is_venv:
# For virtual environments on Windows, add folder
# with DPC++ libraries to the DLL search path gh-1745
dll_dir = os.path.join(sys.exec_prefix, "Library", "bin")
if os.path.isdir(dll_dir):
os.add_dll_directory(dll_dir)
os.environ["PATH"] = os.pathsep.join(
[os.getenv("PATH", ""), dll_dir]
)

del is_venv

is_linux = sys.platform.startswith("linux")

Expand Down
Loading