Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: How to know indirect dependencies when dynamically linking (macOS frameworks)  (Read 1995 times)

0 Members and 1 Guest are viewing this topic.

Ceylo

  • Hero Member
  • *****
  • Posts: 2325
    • View Profile
    • http://sfemovie.yalir.org/
    • Email
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
Want to play movies in your SFML application? Check out sfeMovie!

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10815
    • View Profile
    • development blog
    • Email
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.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Hiura

  • SFML Team
  • Hero Member
  • *****
  • Posts: 4321
    • View Profile
    • Email
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). :-)
SFML / OS X developer

Ceylo

  • Hero Member
  • *****
  • Posts: 2325
    • View Profile
    • http://sfemovie.yalir.org/
    • Email
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.
Want to play movies in your SFML application? Check out sfeMovie!