How to build AGS for Mac and include a third party library dylib

Started by edenwaith, Sun 23/06/2024 05:51:45

Previous topic - Next topic

edenwaith

I'm looking into how I can modify the Cmake build process to create a Mac shell app (AGS.app), but also be able to extend it a bit by linking a third party library (in this case, libsteam_api.dylib).

When I run "otool -L" against the executable in a Mac bundle for other games which link against libsteam_api.dylib, I will see a line like this:

@loader_path/libsteam_api.dylib (compatibility version 1.0.0, current version 1.0.0)

I came across some documentation (https://github.com/adventuregamestudio/ags/wiki/Adding-third%E2%80%90party-libraries-to-the-project) which looked promising, unfortunately the Mac section on how to do this hasn't been completed yet. (shrug)

I'm hoping this process is relatively straightforward by playing the dylib in an appropriate folder, add something like a -L option and the appropriate name and path, and also being able to copy the dylib into the app bundle would also be a bonus.  I'm not overly familiar with how everything is put together, so I'm looking for guidance on the necessary files to update for this task.

eri0o

You don't need to rebuild AGS from sources to do this. Ideally you would just grab the AGS releases for macOS (once we have those), create a directory for your own game app, add your plist file and put things inside of it and then you do the signing and notarization on top.

There should be no reason to do anything with the source files.

Now if the issue is that a plugin is not finding a dependency of it, we can set RPATH to point to inside the bundle using one of the tools in macOS for this - I think it would be something like this: https://stackoverflow.com/questions/78381702/dynamic-linker-in-mac-is-not-reading-rpath

I say this because, 1 otherwise there would not be closed source engines for macOS and 2, because I would like to make it possible to add a macOS build in the Editor.

In my head it would be something like this, the Editor comes with prebuilt macOS engine, running the build the Editor creates a directory with the bundle dir inside with all things necessary there and a script at top level and then you copy all of this to a macOS computer and run the script and then the bundle would be ready for distribution.

edenwaith

Thanks, I'll give that a try.  I'm taking a look at other games (not even all of them developed using AGS), and the lack of the linked reference to the dylib had me a little concerned.  But I'm delving down a deep rabbit hole here, so these might be blind guesses in what is necessary and what is not.

As an aside, when I built the AGS Mac shell with Xcode, I did see the AGS executable did connect up to the libsteam_api.dylib when I had added and linked that library up in Xcode.  One major difference between the Xcode and cmake builds is that SDL is added as a framework with the Xcode build.  I'm guessing that cmake integrates the various libraries (SDL, ogg, vorbis, etc.) directly into the executable.

SMF spam blocked by CleanTalk