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()
562562# ---------------------------------------------------------------------------
563563
564564function (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" )
566566
567567 if (EXISTS ${NB_DIR} /src/stubgen.py)
568568 set (NB_STUBGEN "${NB_DIR} /src/stubgen.py" )
@@ -590,6 +590,10 @@ function (nanobind_add_stub name)
590590 list (APPEND NB_STUBGEN_ARGS -i "${TMP} " )
591591 endforeach ()
592592
593+ foreach (TMP IN LISTS ARG_DLL_PATH)
594+ list (APPEND NB_STUBGEN_ARGS -L "${TMP} " )
595+ endforeach ()
596+
593597 if (ARG_PATTERN_FILE)
594598 list (APPEND NB_STUBGEN_ARGS -p "${ARG_PATTERN_FILE} " )
595599 endif ()
Original file line number Diff line number Diff line change @@ -1210,6 +1210,16 @@ def parse_options(args: List[str]) -> argparse.Namespace:
12101210 help = "add the directory to the Python import path (can specify multiple times)" ,
12111211 )
12121212
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+
12131223 parser .add_argument (
12141224 "-m" ,
12151225 "--module" ,
@@ -1342,6 +1352,7 @@ def add_pattern(query: str, lines: List[str]):
13421352
13431353def main (args : Optional [List [str ]] = None ) -> None :
13441354 import sys
1355+ import os
13451356
13461357 # Ensure that the current directory is on the path
13471358 if "" not in sys .path and "." not in sys .path :
@@ -1362,6 +1373,10 @@ def main(args: Optional[List[str]] = None) -> None:
13621373 for i in opt .imports :
13631374 sys .path .insert (0 , i )
13641375
1376+ if os .name == 'nt' :
1377+ for dll_path in opt .dll_paths :
1378+ os .add_dll_directory (dll_path )
1379+
13651380 for i , mod in enumerate (opt .modules ):
13661381 if not opt .quiet :
13671382 if i > 0 :
You can’t perform that action at this time.
0 commit comments