Python: Don't bake rpath into executable
Vicki Pfau vi@endrift.com
Sat, 12 Aug 2017 19:01:17 -0700
2 files changed,
8 insertions(+),
4 deletions(-)
M
src/platform/python/CMakeLists.txt
→
src/platform/python/CMakeLists.txt
@@ -40,7 +40,15 @@ DEPENDS ${BINARY_NAME}-pylib ${CMAKE_CURRENT_BINARY_DIR}/build/lib/${BINARY_NAME}/__init__.py)
file(GLOB TESTS ${CMAKE_CURRENT_SOURCE_DIR}/test_*.py) foreach(TEST IN LISTS TESTS) + if(APPLE) + set(PATH DYLD_LIBRARY_PATH) + elseif(WIN32) + set(PATH PATH) + else() + set(PATH LD_LIBRARY_PATH) + endif() string(REPLACE "${CMAKE_CURRENT_SOURCE_DIR}/test_" "" TEST_NAME "${TEST}") string(REPLACE ".py" "" TEST_NAME "${TEST_NAME}") add_test(python-${TEST_NAME} ${PYTHON} ${CMAKE_CURRENT_BINARY_DIR}/setup.py pytest --addopts ${TEST}) + set_tests_properties(python-${TEST_NAME} PROPERTIES ${PATH} "${BINDIR}") endforeach()
M
src/platform/python/_builder.py
→
src/platform/python/_builder.py
@@ -12,11 +12,8 @@ bindir = os.environ.get("BINDIR", os.path.join(os.getcwd(), ".."))
cpp = shlex.split(os.environ.get("CPP", "cc -E")) cppflags = shlex.split(os.environ.get("CPPFLAGS", "")) -ldflags = shlex.split(os.environ.get("LDFLAGS", "")) if __name__ == "__main__": cppflags.extend(sys.argv[1:]) -if sys.platform == 'darwin': - ldflags.append('-Wl,-rpath,' + bindir) cppflags.extend(["-I" + incdir, "-I" + srcdir, "-I" + bindir]) ffi.set_source("mgba._pylib", """@@ -49,7 +46,6 @@ #include "platform/python/vfs-py.h"
#undef PYEXPORT """, include_dirs=[incdir, srcdir], extra_compile_args=cppflags, - extra_link_args=ldflags, libraries=["mgba"], library_dirs=[bindir], sources=[os.path.join(pydir, path) for path in ["vfs-py.c", "core.c", "log.c", "sio.c"]])