[cmake-developers] Patch: install universal iOS libraries

Ruslan Baratov ruslan_baratov at yahoo.com
Wed Oct 7 20:37:00 EDT 2015


On 07-Oct-15 16:57, Gregor Jasny wrote:
> Hello,
>
> thank you for working on this. This is really hairy stuff.
>
> On 24/09/15 11:10, Ruslan Baratov via cmake-developers wrote:
>> Patches help to install universal iOS (device + simulator) libraries by
>> triggering some extra instructions (build + fuse) after "regular"
>> library installation finished. This behavior controlled by CMake
>> variable CMAKE_IOS_INSTALL_UNIVERSAL_LIBS.
> some general remarks:
>
> * iOS is not the only platform where the simulator / device situation is
> problematic. Others are now watchOS and the upcoming tvOS (see
> xcodebuild -showsdks). So it would make sense to replace the ios naming
> in the method signatures with something more general.
It cames from PlatformIsAppleIos.
>
> * Does the patches handle Bundles and Frameworks properly?
No. At least for now it's designed to be used only for libraries 
(cmInstall_{STATIC,SHARED,MODULE}_LIBRARY). I don't think it make sense 
to extend this feature for Bundles (simulator architectures are useless 
in AppStore and will be rejected). If Bundle use Framework with 
simulator architectures it will be rejected too. Though it make sense to 
create "development" version of Framework with simulator archs but we 
need to resign it after fuse procedure (libs are not signed).

I'm planning to try to make such patches for Frameworks next.
>
> * This functionality should be limited to XCODE Generator
Fixed.
>
> 0001-
>
> * Could you make the CMAKE_IOS_INSTALL_UNIVERSAL_LIBS a two staged
> property like CMAKE_INSTALL_RPATH / INSTALL_RPATH. That way one would be
> able to enable this behavior for only some targets
Implemented. But I'm not sure it make sense. Can you describe scenario 
when it can be helpful?
>
> 0002-CMake-module-for-universal-iOS-library-install
>
> * Could you avoid to hard-code architecture names like i386 or armv7 in
> the module?

Ok. Added function to get "real" architectures by parsing `lipo -info`. 
If it's not equal to the one specified by SDK then needless archs removed.

>
> * In Xcode 7 (and maybe earlier) I see the following environment
> variables when I install for Device:
>
>> export CORRESPONDING_SIMULATOR_PLATFORM_NAME=iphonesimulator
>> export CORRESPONDING_SIMULATOR_SDK_NAME=iphonesimulator9.0
>> export SUPPORTED_PLATFORMS="iphonesimulator iphoneos"
>> export SDK_NAME=iphoneos9.0
> for Simulator:
>
>> export CORRESPONDING_DEVICE_PLATFORM_NAME=iphoneos
>> export CORRESPONDING_DEVICE_SDK_NAME=iphoneos9.0
>> export SDK_NAME=iphonesimulator9.0
> Could you use those variables to avoid hardcoding iphoneos/simulator in
> the module?
I see CORRESPONDING_*_SDK_NAME variables in Xcode 7.0 but not in 6.4.
>
>> +  install_universal_ios_remove_arch("${dev_libpath}" "i386")
>> +  install_universal_ios_remove_arch("${dev_libpath}" "x86_64")
> Doing it the other way round (keeping only what's needed) looks saner to me.
>
>> +  install_universal_ios_remove_arch("${dev_libpath}" ...)
>> +
>> +  install_universal_ios_remove_arch("${sim_libpath}" ...)
>> +
>> +  set(cmd lipo -create ${src} ${dst} -output ${dst})
> Would it be possible to just add selected architectures from src to dst
> (via lipo -replace)? That way you would save some disk i/o and would
> make the pruning step for src superfluous.
This is kind of "unusual" situation. In most cases this command will 
just exit with "no such architecture" error (and ignored). I've added a 
warning message if unexpected arch detected.

Rebased version of patches attached.
Github fork: https://github.com/ruslo/CMake/commits/pr.ios.universal.2

Thanks, Ruslo
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Get-target-name-for-universal-iOS-library-install.patch
Type: text/x-patch
Size: 2610 bytes
Desc: not available
URL: <http://public.kitware.com/pipermail/cmake-developers/attachments/20151008/af50ea83/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-CMake-module-for-universal-iOS-library-install.patch
Type: text/x-patch
Size: 11912 bytes
Desc: not available
URL: <http://public.kitware.com/pipermail/cmake-developers/attachments/20151008/af50ea83/attachment-0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0003-Universal-iOS-library-install.patch
Type: text/x-patch
Size: 2833 bytes
Desc: not available
URL: <http://public.kitware.com/pipermail/cmake-developers/attachments/20151008/af50ea83/attachment-0002.bin>


More information about the cmake-developers mailing list