mirror of https://github.com/davisking/dlib.git
paths instead of relying on CUDA_PATH to be set.pull/2118/head
parent
1515adc744
commit
2a3cb83afc
@ -1,13 +0,0 @@
|
||||
# Copyright (C) 2020 Davis E. King (davis@dlib.net)
|
||||
# License: Boost Software License See LICENSE.txt for the full license.
|
||||
|
||||
try:
|
||||
import os
|
||||
# On windows you must call os.add_dll_directory() to allow linking to external DLLs. See
|
||||
# https://docs.python.org/3.8/whatsnew/3.8.html#bpo-36085-whatsnew.
|
||||
os.add_dll_directory(os.path.join(os.environ['CUDA_PATH'], 'bin'))
|
||||
except (AttributeError,KeyError):
|
||||
pass
|
||||
|
||||
from _dlib_pybind11 import *
|
||||
from _dlib_pybind11 import __version__, __time_compiled__
|
@ -0,0 +1,20 @@
|
||||
# Copyright (C) 2020 Davis E. King (davis@dlib.net)
|
||||
# License: Boost Software License See LICENSE.txt for the full license.
|
||||
|
||||
def add_lib_to_dll_path(path):
|
||||
""" On windows you must call os.add_dll_directory() to allow linking to external DLLs. See
|
||||
https://docs.python.org/3.8/whatsnew/3.8.html#bpo-36085-whatsnew. This function adds the folder
|
||||
containing path to the dll search path.
|
||||
"""
|
||||
try:
|
||||
import os
|
||||
os.add_dll_directory(os.path.dirname(path))
|
||||
except (AttributeError,KeyError):
|
||||
pass
|
||||
|
||||
if '@DLIB_USE_CUDA@' == 'ON':
|
||||
add_lib_to_dll_path('@cudnn@')
|
||||
add_lib_to_dll_path('@CUDA_CUDART_LIBRARY@')
|
||||
|
||||
from _dlib_pybind11 import *
|
||||
from _dlib_pybind11 import __version__, __time_compiled__
|
Loading…
Reference in new issue