Skip to content

Commit 121339e

Browse files
AndrewAnnexdnicolodi
authored andcommitted
DOC: shared-libraries: fix and clarify install location example
Fixes #769
1 parent 7efa417 commit 121339e

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

docs/how-to-guides/shared-libraries.rst

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,18 +64,28 @@ A shared library produced by ``library()`` or ``shared_library()`` built like th
6464
6565
is installed to ``libdir`` by default. If the only reason the shared library exists
6666
is to be used inside the Python package being built, then it is best to modify
67-
the install location to be within the Python package itself:
67+
the install location, via the ``install_dir`` argument, to be within
68+
the Python package itself:
6869

69-
.. code-block:: python
70+
.. TODO update the text block below to 'meson' when
71+
.. meson lexer is updated to fix
72+
.. https://github.com/pygments/pygments/issues/2918
7073
71-
install_path: py.get_install_dir() / 'mypkg/subdir'
74+
.. code-block:: text
75+
76+
example_lib = shared_library(
77+
'example',
78+
'examplelib.c',
79+
install: true,
80+
install_dir: py.get_install_dir() / 'mypkg/subdir',
81+
)
7282
7383
Then an extension module in the same install directory can link against the
7484
shared library in a portable manner by using ``install_rpath``:
7585

7686
.. code-block:: meson
7787
78-
py3.extension_module('_extmodule',
88+
py.extension_module('_extmodule',
7989
'_extmodule.c',
8090
link_with: example_lib,
8191
install: true,

0 commit comments

Comments
 (0)