Anaconda/Python
jacobwilliams opened this issue · 0 comments
jacobwilliams commented
The SWIG-produced Python interface doesn't work on a Mac with an Anaconda distribution of Python.
A workaround is to add -undefined dynamic_lookup
to the linker properties in swig/CMakelists.txt
like so:
Replace:
SWIG_LINK_LIBRARIES(PyOFInterfaceC ${PYTHON_LIBRARY} OpenFrames_Interface_C)
with:
if(APPLE)
# for anaconda
SWIG_LINK_LIBRARIES(PyOFInterfaceC OpenFrames_Interface_C)
SET_TARGET_PROPERTIES(${SWIG_MODULE_PyOFInterfaceC_REAL_NAME} PROPERTIES LINK_FLAGS "-undefined dynamic_lookup")
else()
SWIG_LINK_LIBRARIES(PyOFInterfaceC ${PYTHON_LIBRARY} OpenFrames_Interface_C)
endif()
And this:
SWIG_LINK_LIBRARIES(PyOFInterfaceIFORT ${PYTHON_LIBRARY} OpenFrames_Interface_IFORT)
with this:
if(APPLE)
# for anaconda
SWIG_LINK_LIBRARIES(PyOFInterfaceIFORT OpenFrames_Interface_IFORT)
SET_TARGET_PROPERTIES(${SWIG_MODULE_PyOFInterfaceIFORT_REAL_NAME} PROPERTIES LINK_FLAGS "-undefined dynamic_lookup")
else()
SWIG_LINK_LIBRARIES(PyOFInterfaceIFORT ${PYTHON_LIBRARY} OpenFrames_Interface_IFORT)
endif()
I think this breaks linking with the Python.org distribution though. Ideally, it should work for both.