Python: Don't bake rpath into executable

This commit is contained in:
Vicki Pfau 2017-08-12 19:01:17 -07:00
parent 65a7233d5f
commit bbb74a47a1
2 changed files with 8 additions and 4 deletions

View File

@ -40,7 +40,15 @@ add_custom_target(${BINARY_NAME}-py ALL
file(GLOB TESTS ${CMAKE_CURRENT_SOURCE_DIR}/test_*.py) file(GLOB TESTS ${CMAKE_CURRENT_SOURCE_DIR}/test_*.py)
foreach(TEST IN LISTS TESTS) 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 "${CMAKE_CURRENT_SOURCE_DIR}/test_" "" TEST_NAME "${TEST}")
string(REPLACE ".py" "" TEST_NAME "${TEST_NAME}") string(REPLACE ".py" "" TEST_NAME "${TEST_NAME}")
add_test(python-${TEST_NAME} ${PYTHON} ${CMAKE_CURRENT_BINARY_DIR}/setup.py pytest --addopts ${TEST}) 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() endforeach()

View File

@ -12,11 +12,8 @@ bindir = os.environ.get("BINDIR", os.path.join(os.getcwd(), ".."))
cpp = shlex.split(os.environ.get("CPP", "cc -E")) cpp = shlex.split(os.environ.get("CPP", "cc -E"))
cppflags = shlex.split(os.environ.get("CPPFLAGS", "")) cppflags = shlex.split(os.environ.get("CPPFLAGS", ""))
ldflags = shlex.split(os.environ.get("LDFLAGS", ""))
if __name__ == "__main__": if __name__ == "__main__":
cppflags.extend(sys.argv[1:]) cppflags.extend(sys.argv[1:])
if sys.platform == 'darwin':
ldflags.append('-Wl,-rpath,' + bindir)
cppflags.extend(["-I" + incdir, "-I" + srcdir, "-I" + bindir]) cppflags.extend(["-I" + incdir, "-I" + srcdir, "-I" + bindir])
ffi.set_source("mgba._pylib", """ ffi.set_source("mgba._pylib", """
@ -49,7 +46,6 @@ ffi.set_source("mgba._pylib", """
#undef PYEXPORT #undef PYEXPORT
""", include_dirs=[incdir, srcdir], """, include_dirs=[incdir, srcdir],
extra_compile_args=cppflags, extra_compile_args=cppflags,
extra_link_args=ldflags,
libraries=["mgba"], libraries=["mgba"],
library_dirs=[bindir], library_dirs=[bindir],
sources=[os.path.join(pydir, path) for path in ["vfs-py.c", "core.c", "log.c", "sio.c"]]) sources=[os.path.join(pydir, path) for path in ["vfs-py.c", "core.c", "log.c", "sio.c"]])