简体   繁体   中英

Use Xcode Shared Library Project for Static Library

I have a C++ project which is compiled to a universal shared library. Now, I also want a static library for the same. I tried to reuse the shared library Xcode project but the size of static library created is much smaller (~ 3MB) as compared to when I create a separate Xcode Static Library project to compile my code (~19 MB).

Here is what I tried with the shared library project:

xcodebuild -project MyLibrary.xcodeproj build MACH_O_TYPE=staticlib EXECUTABLE_EXTENSION=a GCC_ENABLE_SYMBOL_SEPARATION=NO PACKAGE_TYPE=com.apple.package-type.static-library

I don't want to maintain two Xcode project files just for compilation.

The library generated using above method works fine and is a valid static library.

xcodebuild -project MyLibrary.xcodeproj build MACH_O_TYPE=staticlib EXECUTABLE_EXTENSION=a GCC_ENABLE_SYMBOL_SEPARATION=NO PACKAGE_TYPE=com.apple.package-type.static-library

For details refer Much larger static library generated by xcode

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM