Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
dlib
Commits
2a3cb83a
Commit
2a3cb83a
authored
Jun 17, 2020
by
Davis King
Browse files
Make dlib/__init__.py know the paths to cuda that cmake used. Use those
paths instead of relying on CUDA_PATH to be set.
parent
1515adc7
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
13 deletions
+21
-13
tools/python/CMakeLists.txt
tools/python/CMakeLists.txt
+1
-0
tools/python/dlib/__init__.py
tools/python/dlib/__init__.py
+0
-13
tools/python/dlib/__init__.py.in
tools/python/dlib/__init__.py.in
+20
-0
No files found.
tools/python/CMakeLists.txt
View file @
2a3cb83a
...
@@ -71,3 +71,4 @@ endif()
...
@@ -71,3 +71,4 @@ endif()
pybind11_add_module
(
_dlib_pybind11
${
python_srcs
}
)
pybind11_add_module
(
_dlib_pybind11
${
python_srcs
}
)
target_link_libraries
(
_dlib_pybind11 PRIVATE dlib::dlib
)
target_link_libraries
(
_dlib_pybind11 PRIVATE dlib::dlib
)
configure_file
(
${
PROJECT_SOURCE_DIR
}
/dlib/__init__.py.in
${
CMAKE_LIBRARY_OUTPUT_DIRECTORY
}
/dlib/__init__.py
)
tools/python/dlib/__init__.py
deleted
100644 → 0
View file @
1515adc7
# 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__
tools/python/dlib/__init__.py.in
0 → 100644
View file @
2a3cb83a
# 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__
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment