How to distribute Static libraries?

2019-07-07 06:45发布

问题:

My question is : which is the correct way to release a compiled library for public use? OpenFeint for example release a single static Fat library (And source code too) How do they manage Release or Debug version ?

I'd like to understand how many version of my library i have to produce, i would be sure that users are free to choose how to import my library, and i think that a good solution could be compile and distribute these versions:

  • Release - Device
  • Release - Simulator
  • Release - Fat (device + simulator)
  • Debug - Device
  • Debug - Simulator
  • Debug - Fat (device + simulator)

What do you think about? How do you prefer to work with third party libs ?

回答1:

Debug/Release

Definitely, you don't want people to be able to view symbols in your library. So don't worry with distributing a Debug build, people won't want to debug your own library.

Simulator/iOS/Fat

The compiler will automatically pick up the relevant "part" of a fat library. For instance, when you'll build an ARM binary, only the ARM part of your fat static lib will be embedded. So just go the "fat" route.

So, long story short : just distribute a fat, release version of your library !

Side note : if that is possible, please also distribute the source. From my personal experience, I'm very reluctant to add an "opaque" library to my projects.