Posted in Developer Zone, Programming, Second Life, Viewers

Adding new libraries to a custom Viewer

As part of my private build of Firestorm, the Open Source third-party viewer for Second Life from Linden Lab, I have added new library dependencies for something I am working on (adding metadata to snapshots).

This blog post details how I added them, making use of CMake and modifying various files.

I present it in the hope that it may prove useful to others.

NOTE: This article assumes that you have a working private build of Firestorm. If you have not, then please see this article first.

This isn’t the totally correct way of doing things as it doesn’t use autobuild.xml, but it works well enough for my purposes for now.

The procedure I have adopted is to build your new libraries separately to Firestorm as a pre-build step, and then inject them as dependencies into the Firestorm build. But, as I said, this isn’t really the correct way to do things.

NOTE: The following is all for the 64-bit Windows build. It may well break the Linux build. Also, it is a self-confessed unholy hack. I may update this post if I find a more refined way of doing things.

For my purposes, I have added a dependency on exiv2, which itself has dependencies on zlib and expat (Or, rather, did at the time of writing but those dependencies have now been removed and are no longer required.)

Building these is beyond the scope of this article.

Once built, the new libraries need to be copied into the build directory. Ordinarily, autobuild would handle this but for now I use a small batch file which I run manually:


xcopy ..\exiv2-0.27.2\include\exiv2\*.* .\build-vc150-64\packages\include\exiv2\ /Y
xcopy ..\exiv2-0.27.2\build\*.h .\build-vc150-64\packages\include\exiv2\ /Y
xcopy ..\exiv2-0.27.2\build\lib\Release\exiv2.lib .\build-vc150-64\packages\lib\release\ /Y
xcopy ..\exiv2-0.27.2\build\bin\*.dll .\build-vc150-64\packages\lib\release\ /Y

This assumes that the exiv2 directory is located at the same level as 3p-fmodstudio and the firestorm source, with the batch file itself in the firestorm source directory. It also assumes you are building the 64-bit Windows version of Firestorm.

NOTE: This is a horrid hack. A much better way of doing things would be to have the build process copy the files over automatically. Perhaps I will do that at some stage.

Unless you delete your build-vc120-64 folder or change your libraries, you shouldn’t need to do this again.

So, with that out of the way, here are my changes. They are all relative to the root of the Firestorm source tree.

The first is:



The next change is:



This adds the new DLLs to the list of input dependencies.

The next change is:



Finally, now that the libraries are available:



This adds the import library for exiv2 to the llimage module, since this is where I am actually using the exiv2 library.

Update: Actually, don’t specify the .lib extension, as it is implied and it will break Linux builds. Also, it would be far better to use something like find_library() and do things properly.

If you are adding different libraries then your mileage may vary, but this should give you a good starting point for adding extra dependencies to Firestorm.

I haven’t yet worked out how to leverage autobuild.xml, although I assume it is going to be not dissimilar to how FModStudio and the other libraries work. If you can work it out then please drop me a comment below and let me know what you did.

One thought on “Adding new libraries to a custom Viewer

  1. Thank you very much beccapet definitely an amazing post, it’s a very useful one to customize the viewer using third party libraries.

Let me know what you think!

This site uses Akismet to reduce spam. Learn how your comment data is processed.