File tree Expand file tree Collapse file tree 2 files changed +20
-1
lines changed Expand file tree Collapse file tree 2 files changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -562,7 +562,7 @@ endfunction()
562
562
# ---------------------------------------------------------------------------
563
563
564
564
function (nanobind_add_stub name )
565
- cmake_parse_arguments (PARSE_ARGV 1 ARG "VERBOSE;INCLUDE_PRIVATE;EXCLUDE_DOCSTRINGS;INSTALL_TIME;EXCLUDE_FROM_ALL" "MODULE;OUTPUT;MARKER_FILE;COMPONENT;PATTERN_FILE" "PYTHON_PATH;DEPENDS" )
565
+ cmake_parse_arguments (PARSE_ARGV 1 ARG "VERBOSE;INCLUDE_PRIVATE;EXCLUDE_DOCSTRINGS;INSTALL_TIME;EXCLUDE_FROM_ALL" "MODULE;OUTPUT;MARKER_FILE;COMPONENT;PATTERN_FILE" "PYTHON_PATH;DLL_PATH; DEPENDS" )
566
566
567
567
if (EXISTS ${NB_DIR} /src/stubgen.py)
568
568
set (NB_STUBGEN "${NB_DIR} /src/stubgen.py" )
@@ -590,6 +590,10 @@ function (nanobind_add_stub name)
590
590
list (APPEND NB_STUBGEN_ARGS -i "${TMP} " )
591
591
endforeach ()
592
592
593
+ foreach (TMP IN LISTS ARG_DLL_PATH)
594
+ list (APPEND NB_STUBGEN_ARGS -L "${TMP} " )
595
+ endforeach ()
596
+
593
597
if (ARG_PATTERN_FILE)
594
598
list (APPEND NB_STUBGEN_ARGS -p "${ARG_PATTERN_FILE} " )
595
599
endif ()
Original file line number Diff line number Diff line change @@ -1210,6 +1210,16 @@ def parse_options(args: List[str]) -> argparse.Namespace:
1210
1210
help = "add the directory to the Python import path (can specify multiple times)" ,
1211
1211
)
1212
1212
1213
+ parser .add_argument (
1214
+ "-L" ,
1215
+ "--dll-path" ,
1216
+ action = "append" ,
1217
+ metavar = "PATH" ,
1218
+ dest = "dll_paths" ,
1219
+ default = [],
1220
+ help = "add directory to DLL search path (ignored on non-Windows, can specify multiple times)" ,
1221
+ )
1222
+
1213
1223
parser .add_argument (
1214
1224
"-m" ,
1215
1225
"--module" ,
@@ -1342,6 +1352,7 @@ def add_pattern(query: str, lines: List[str]):
1342
1352
1343
1353
def main (args : Optional [List [str ]] = None ) -> None :
1344
1354
import sys
1355
+ import os
1345
1356
1346
1357
# Ensure that the current directory is on the path
1347
1358
if "" not in sys .path and "." not in sys .path :
@@ -1362,6 +1373,10 @@ def main(args: Optional[List[str]] = None) -> None:
1362
1373
for i in opt .imports :
1363
1374
sys .path .insert (0 , i )
1364
1375
1376
+ if os .name == 'nt' :
1377
+ for dll_path in opt .dll_paths :
1378
+ os .add_dll_directory (dll_path )
1379
+
1365
1380
for i , mod in enumerate (opt .modules ):
1366
1381
if not opt .quiet :
1367
1382
if i > 0 :
You can’t perform that action at this time.
0 commit comments