I’m trying to make a Blender package for the MacPorts package manager. They prefer that all libraries are dynamically linked to their packages, rather than statically linked. The documentation on Library Dependencies implies that dynamically-linked libraries are only officially supported on Linux, but I wondered if it’s possible to use them on macOS, too?
My questions are:
How can I find out which libraries are needed for macOS specifically? I found versions.cmake, but that seems to be all libraries regardless of which platforms actually use them.
Is there an easy-ish way to compile with dynamically linked libraries instead of statically linked ones? How do I tell the compiler where to find the libraries?
The build system on macOS is not set up to work with anything else than the precompiled libraries in lib/. Making it work with package managers too (as on Linux) may be a significant amount of work to implement and maintain.
There would need to be a good motivation for it and it’s not obvious this is something the Blender project wants to invest time in supporting otherwise. I don’t know what the decision would be, but something to be aware of.
Regarding the specific question, I don’t think there are many assumptions about static linking specifically in the code and many libraries use dynamic linking. The problem is more hardcoded assumptions about using libraries from lib/. In general the code in platform_apple.cmake could be refactored to work more like the one in platform_unix.cmake, relying more on find_package. And in general there is ongoing work to use cmake configs rather than our own find modules, which can help too.
To see which libraries Blender uses, you could look at the macOS precompiled libraries folder.