When building static libraries you must add the following for bitcode generation:
-fembed-bitcode
for a dynamic library you need to additionally link with
-fembed-bitcode
Note: This command is only available with Xcode7+
In regards to the accepted answer of using -fembed-bitcode-marker
You should be aware that a normal build with the
-fembed-bitcode-marker option will produce minimal size embedded bitcode sections without any real content. This is done as a way of
testing the bitcode-related aspects of your build without slowing down
the build process. The actual bitcode content is included when you do
an Archive build.
bwilson Apple Staff.
https://forums.developer.apple.com/thread/3971#12225
To be more specific:
-fembed-bitcode-marker
simply marks where the bitcode would be in the binary after an archive build.-fembed-bitcode
actually does the full bitcode generation and embedding, so this is what you need to use for building static libraries.- Xcode itself builds with
-fembed-bitcode-marker
for regular builds (like deploy to simulator) - Xcode only builds with
-fembed-bitcode
for archive builds / production builds (as this is only needed for Apple).