kenmo wrote:Nice solution! That .app seems to work without installing the SDL2 framework (at least it works on OSX 10.9, I would like to test back to maybe 10.5).
Yes, it works with Mac OS X 10.5 and newer. Older OS are not supported.
For your Reference:
Mac Developer Library: Run-Path Dependent LibrariesIn OS X v10.5 and later the linker and dynamic loader offer a simple way of allowing multiple executables in an application suite directory to share dependent libraries while providing the suite’s users
the option of relocating the suite directory. Using run-path dependent libraries you can create a directory structure containing executables and dependent libraries that users can relocate without breaking it.
kenmo wrote:About that commandline action... I don't really know HOW it works. First I assumed it added some information to the .plist, but I was wrong, nothing seems to be added there.
Does it modify the executable? Does it store the Framework path in a hidden file within the .app? Does the OS cache that information elsewhere? Or is it just Mac Magic?

It is directly added to the Loader information within the executable. You can show the loader commands with otool, option (lowercase) "-l":
Code: Select all
otool -l ./SDL_Test.app/Contents/MacOS/SDL_Test
It lists the loader commands for the executable, and you will see something like that:
Code: Select all
[...]
Load command 14
cmd LC_LOAD_DYLIB
cmdsize 64
name @rpath/SDL2.framework/Versions/A/SDL2 (offset 24)
time stamp 2 Thu Jan 1 01:00:02 1970
current version 3.1.0
compatibility version 1.0.0
[...]
Load command 24
cmd LC_RPATH
cmdsize 44
path @executable_path/../Frameworks (offset 12)
The loader command LC_RPATH adds the internal Frameworks directory to the path
where the loader looks for libraries/frameworks that start with "@rpath", see otool with option (uppercase) "-L":
Code: Select all
otool -L ./SDL_Test.app/Contents/MacOS/SDL_Test