Reputation: 31
I am building an universal library on mac. My library uses openssl
functions and links against openssl
libraries. I can get the openssl
code compiled for i386 and x86_64 separately and then create a fat library to make it a universal library for i386 and x86_64.
My library is compiled via cmake
by setting CMAKE_OSX_ARCHITECTURES=i386;x86_64
to make it universal between i386 and x86_64
The openssl
headers generated for i386 and x86_64 are different. How do I make cmake
select different headers for i386 and x86_64?
Upvotes: 3
Views: 444
Reputation: 102205
including different headers for i386 and x86_64 when compiling universal libraries for mac ...
I don't believe you can do it for a universal or fat library.
In this case, where you want different headers for architectures, you might need to leap to a framework because a framework allows multiple sets of headers. But I don't think I have seen it used for architecture independence.
The Introduction to Framework Programming Guide discusses the on disk layout of the bundle under Anatomy of Framework Bundles, Additional Directories:
Directory | Description
--------------+---------------------------------------------------------------------------------
Headers | Contains any public headers you want to make available to external developers.
--------------+---------------------------------------------------------------------------------
Documentation | Contains HTML or PDF files describing the framework interfaces. Typically,
| documentation directories do not reside at the top level of your framework.
| Instead, they reside inside your language-specific resource directories.
--------------+---------------------------------------------------------------------------------
Libraries | Contains any secondary dynamic libraries your framework requires.
Upvotes: 0
Reputation: 85025
AFAIK, the current openssl build process does not support OS X universal builds directly. One way to do it is to just compile each architecture separately and then afterwards combine the two variants of each library file into a combined universal file by using lipo -combine
. See man 1 lipo
. There is an example here: https://gist.github.com/tmiz/1441111
Upvotes: 1