specifying user-defined absolute run path search directories

69 views
Skip to first unread message

Noresources

unread,
Mar 19, 2017, 10:51:19 AM3/19/17
to Premake Development
Some months ago, I introduced the runpathdirs API in premake to specify run path search directories (mostly for Makefiles, on macOS and linux)
(previous discussion here: https://groups.google.com/forum/#!topic/premake-development/h_jWScfbBb0)

For now, all paths are transformed to be relative to the target output directory. The generated -rpath command use system-specific keywords to tell the linker the path is relative ($ORIGIN on linux, @loader_path on macOS)

I recently found a case where i need to specify an absolute path (the homebrew build of SFML on macOS)

Now, I wonder how I should modify the existing code to allow that.

What do you think about something like
runpathdirs { "a/relative/path", "absolute:/usr/local/brew/lib" }

This will ensure backward compatibility and the keyword+colon prefix syntax is similar to other APIs such as filter

starkos

unread,
Mar 20, 2017, 7:26:15 AM3/20/17
to Premake Development
First off, thanks for adding runpathsdir to the documentation wiki, appreciated.

As for the suggestion…that's workable, but kind of ugly. Would it be worth keeping a table of "special" system folders such as `/usr` which are always kept as absolute?

Noresources

unread,
Mar 20, 2017, 3:02:16 PM3/20/17
to Premake Development
The credits for the wiki goes to João Matos. If I have something to add to premake later, I promise I will edit the wiki too.

Unfortunately your solution did not work with my current use case. The library I targeted is located in /opt/brew/..<brew internal tree>/lib (not a user dir, but not really a system dir too)
Also, there is no real way to have an extensive list of system paths on linux and macOS, especially for multi-arch linux distros.

I also thought of using a special keyword.
runpathdirs { "%ORIGIN%/../lib", "/absolute/path" }

where %ORIGIN% (or whatever) is replaced by $ORIGIN or @loader_path depending on system and the rest of the path remain as is. But it completely breaks the current behavior. Maybe better for the long term use...


Reply all
Reply to author
Forward
0 new messages