-
I have a project where I am building python extensions as well as some other c/c++ executables. project('myproj', 'c', version: '1.0')
py = import('python').find_installation(pure: false)
# Shared lib
mylib = library('mylib', 'my_source.c', install: true)
# Python extension module
py.extension_module('_pyext', 'pyext.c', link_with: mylib, install: true, subdir: 'pyext')
py.install_sources('__init__.py', subdir: 'pyext')
# C executable
executable('myexe', 'main.c', link_with: mylib, install: true) When running pip install mesonpy maps Is there anyway, to correct the rpath for the C executable so it links to |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
Hi @ericgtkb, thanks for the clear example. My first thought is that it's probably better to do one of two things:
(1) is an easier and smaller change than (2) if that's acceptable. If you do need the shared library installed, then you need (2). Both are portable also to Windows, while setting an RPATH is not. I'm also not even sure if the relative path from {bindir} to site-packages is constant for all possible install schemes. |
Beta Was this translation helpful? Give feedback.
Hi @ericgtkb, thanks for the clear example.
My first thought is that it's probably better to do one of two things:
mylib
a static library and link it into the executablesite-packages/myproj
in the same subdirectory. Then add a[project.scripts]
entrypoint inpyproject.toml
to call the executable(1) is an easier and smaller change than (2) if that's acceptable. If you do need the shared library installed, then you need (2). Both are portable also to Windows, while setting an RPATH is not. I'm also not even sure if the relative path from {bindir} to site-packages is constant for all possible install schemes.