@@ -24,22 +24,22 @@ this ``libdir`` in this guide) or to a location in ``site-packages`` within the
24
24
Python package install tree. All these scenarios are (or will be) supported,
25
25
with some caveats:
26
26
27
- +-----------------------+------------------+---------+-------+-------+
28
- | shared library source | install location | Windows | macOS | Linux |
29
- +=======================+==================+=========+=======+=======+
30
- | internal | libdir | no (1) | ✓ | ✓ |
31
- +-----------------------+------------------+---------+-------+-------+
32
- | internal | site-packages | ✓ | ✓ | ✓ |
33
- +-----------------------+------------------+---------+-------+-------+
34
- | external | n/a | ✓ (2) | ✓ | ✓ |
35
- +-----------------------+------------------+---------+-------+-------+
27
+ +-----------------------+------------------+------------ +-------+-------+
28
+ | shared library source | install location | Windows | macOS | Linux |
29
+ +=======================+==================+============ +=======+=======+
30
+ | internal | libdir | ✓ :sup: `1` | ✓ | ✓ |
31
+ +-----------------------+------------------+------------ +-------+-------+
32
+ | internal | site-packages | ✓ | ✓ | ✓ |
33
+ +-----------------------+------------------+------------ +-------+-------+
34
+ | external | --- | ✓ :sup: `2` | ✓ | ✓ |
35
+ +-----------------------+------------------+------------ +-------+-------+
36
36
37
37
.. TODO: add subproject as a source
38
38
39
- 1. Internal shared libraries on Windows cannot be automatically handled
40
- correctly, and currently `` meson-python `` therefore raises an error for them.
41
- ` PR meson-python#551 < https://github.com/mesonbuild/meson-python/pull/551 >`__
42
- may improve that situation in the near future .
39
+ 1. Support for internal shared libraries on Windows is enabled with the
40
+ :option: ` allow-windows-internal-shared-libs ` option and requires cooperation
41
+ from the package to extend the DLL search path or pre-load the required
42
+ libraries. See below for more details .
43
43
44
44
2. External shared libraries require ``delvewheel `` usage on Windows (or some
45
45
equivalent way, like amending the DLL search path to include the directory
@@ -91,23 +91,26 @@ the lack of RPATH support:
91
91
:start-after: start-literalinclude
92
92
:end-before: end-literalinclude
93
93
94
- If an internal shared library is not only used as part of a Python package, but
95
- for example also as a regular shared library in a C/C++ project or as a
96
- standalone library, then the method shown above won't work. The library is
97
- then marked for installation into the system default ``libdir `` location.
98
- Actually installing into ``libdir `` isn't possible with wheels, hence
99
- ``meson-python `` will instead do the following *on platforms other than
100
- Windows *:
94
+ If an internal shared library is not only used as part of a Python package,
95
+ but for example also as a regular shared library then the method shown above
96
+ won't work. The library is then marked for installation into the system
97
+ default ``libdir `` location. Actually installing into ``libdir `` isn't
98
+ possible with wheels, hence ``meson-python `` will instead do the following:
101
99
102
- 1. Install the shared library to `` <project-name>.mesonpy.libs `` (i.e., a
100
+ 1. Install the shared library to the `` . <project-name>.mesonpy.libs ``
103
101
top-level directory in the wheel, which on install will end up in
104
- ``site-packages ``).
105
- 2. Rewrite RPATH entries for install targets that depend on the shared library
106
- to point to that new install location instead.
102
+ ``site-packages ``.
103
+ 2. On platforms other than Windows, rewrite RPATH entries for install targets
104
+ that depend on the shared library to point to that new install location
105
+ instead.
107
106
108
- This will make the shared library work automatically, with no other action needed
109
- from the package author. *However *, currently an error is raised for this situation
110
- on Windows. This is documented also in :ref: `reference-limitations `.
107
+ On platforms other than Windows, this will make the shared library work
108
+ automatically, with no other action needed from the package author. On
109
+ Windows, due to the lack of RPATH support, the ``.<project-name>.mesonpy.libs ``
110
+ location search path needs to be added to the DLL search path, with code
111
+ similar to the one presented above. For this reason, handling of internal
112
+ shared libraries on Windows is conditional to setting the
113
+ :option: `allow-windows-internal-shared-libs ` option.
111
114
112
115
113
116
External shared libraries
@@ -245,7 +248,7 @@ this will look something like:
245
248
foo_dep = foo_subproj.get_variable('foo_dep')
246
249
247
250
Now we can use ``foo_dep `` like a normal dependency, ``meson-python `` will
248
- include it into the wheel in ``<project-name>.mesonpy.libs `` just like an
251
+ include it into the wheel in ``. <project-name>.mesonpy.libs `` just like an
249
252
internal shared library that targets ``libdir `` (see
250
253
:ref: `internal-shared-libraries `).
251
254
*Remember: this method doesn't support Windows (yet)! *
0 commit comments