SFML community forums

Help => General => Topic started by: Ceylo on December 23, 2017, 02:45:57 pm

Title: How to know indirect dependencies when dynamically linking (macOS frameworks)
Post by: Ceylo on December 23, 2017, 02:45:57 pm
Hello!

In a project based on SFML I want to run tests on macOS using the provided frameworks. I don't want to install the frameworks, but instead set rpath correctly and put the frameworks next to my executable, so that I can check that I'm able to provide a fully self-contained package without depending on any installation.  Right now this means I need to copy these frameworks next to my executable:
FLAC.framework
OpenAL.framework
SFML.framework
freetype.framework
ogg.framework
sfml-audio.framework
sfml-graphics.framework
sfml-network.framework
sfml-system.framework
sfml-window.framework
vorbis.framework
vorbisenc.framework
vorbisfile.framework

My project is based on CMake and I want this to be automatic, so I use the provided FindSFML.cmake which provides these variables after doing a find_package(SFML):
SFML_LIBRARIES:    the list of all libraries corresponding to the required modules
SFML_FOUND:        true if all the required modules are found
SFML_INCLUDE_DIR:  the path where SFML headers are located (the directory containing the SFML/Config.hpp file)
SFML_DEPENDENCIES: the list of libraries SFML depends on, in case of static linking

However SFML_LIBRARIES only contains the direct dependencies (ie. the sfml-audio, sfml-graphics, sfml-network, sfml-system and sfml-window frameworks). So I could copy these next to my executable. But SFML_DEPENDENCIES is empty when using frameworks, most likely on purpose because it states that it's only for static linking. But then I don't know how I can get the path to the other frameworks just with a correct SFML_ROOT and find_package(SFML). Is it possible at the moment?

In the worst case I can probably hardcode the other paths but I would really like to avoid this if possible. This looks wrong and instead changes in FindSFML.cmake would probably be better.

Thanks,
Ceylo
Title: Re: How to know indirect dependencies when dynamically linking (macOS frameworks)
Post by: eXpl0it3r on December 24, 2017, 04:57:27 pm
From what I can tell from the FindSFML.cmake file, is that it just will search in the standard paths for the compiler/linker.

Hiura could give you a better answer.
Title: Re: How to know indirect dependencies when dynamically linking (macOS frameworks)
Post by: Hiura on January 03, 2018, 05:19:25 pm
TBH I'm not sure I understand/remember how rpath works ATM with SFML/Cmake. I know cmake changed a few things regarding rpath since a few versions, we also got some contributions into SFML on that, ... And I think at some point what you requested used to work. So, feel free to change anything to make it work again (including the framework themselves). :-)
Title: Re: How to know indirect dependencies when dynamically linking (macOS frameworks)
Post by: Ceylo on January 04, 2018, 12:54:51 am
No no rpath is working great, no problem on that side :D
My issue is with the paths to all the frameworks I should bundle in my application. As SFML_LIBRARIES doesn’t reference all of them ; it misses the indirect dependencies.