@@ -311,10 +311,12 @@ def __init__(
311
311
metadata : Metadata ,
312
312
manifest : Dict [str , List [Tuple [pathlib .Path , str ]]],
313
313
limited_api : bool ,
314
+ shared_libs_win32 : bool ,
314
315
) -> None :
315
316
self ._metadata = metadata
316
317
self ._manifest = manifest
317
318
self ._limited_api = limited_api
319
+ self ._shared_libs_win32 = shared_libs_win32
318
320
319
321
@property
320
322
def _has_internal_libs (self ) -> bool :
@@ -430,6 +432,9 @@ def _install_path(self, wheel_file: mesonpy._wheelfile.WheelFile, origin: Path,
430
432
431
433
if self ._has_internal_libs :
432
434
if _is_native (origin ):
435
+ if sys .platform == 'win32' and not self ._shared_libs_win32 :
436
+ raise NotImplementedError (f'Bundling libraries in wheel is not supported on { sys .platform } ' )
437
+
433
438
# When an executable, libray, or Python extension module is
434
439
# dynamically linked to a library built as part of the project,
435
440
# Meson adds a library load path to it pointing to the build
@@ -566,6 +571,7 @@ def _string_or_path(value: Any, name: str) -> str:
566
571
scheme = _table ({
567
572
'meson' : _string_or_path ,
568
573
'limited-api' : _bool ,
574
+ 'shared-libs-win32' : _bool ,
569
575
'args' : _table ({
570
576
name : _strings for name in _MESON_ARGS_KEYS
571
577
}),
@@ -757,6 +763,10 @@ def __init__(
757
763
if not value :
758
764
self ._limited_api = False
759
765
766
+ # Shared library support on Windows requires collaboration
767
+ # from the package, make sure the developpers aknowledge this.
768
+ self ._shared_libs_win32 = pyproject_config .get ('shared-libs-win32' , False )
769
+
760
770
def _run (self , cmd : Sequence [str ]) -> None :
761
771
"""Invoke a subprocess."""
762
772
# Flush the line to ensure that the log line with the executed
@@ -920,13 +930,13 @@ def sdist(self, directory: Path) -> pathlib.Path:
920
930
def wheel (self , directory : Path ) -> pathlib .Path :
921
931
"""Generates a wheel in the specified directory."""
922
932
self .build ()
923
- builder = _WheelBuilder (self ._metadata , self ._manifest , self ._limited_api )
933
+ builder = _WheelBuilder (self ._metadata , self ._manifest , self ._limited_api , self . _shared_libs_win32 )
924
934
return builder .build (directory )
925
935
926
936
def editable (self , directory : Path ) -> pathlib .Path :
927
937
"""Generates an editable wheel in the specified directory."""
928
938
self .build ()
929
- builder = _EditableWheelBuilder (self ._metadata , self ._manifest , self ._limited_api )
939
+ builder = _EditableWheelBuilder (self ._metadata , self ._manifest , self ._limited_api , self . _shared_libs_win32 )
930
940
return builder .build (directory , self ._source_dir , self ._build_dir , self ._build_command , self ._editable_verbose )
931
941
932
942
0 commit comments