[cmake-developers] Patch: install universal iOS libraries

Gregor Jasny gjasny at googlemail.com
Wed Oct 7 09:57:03 EDT 2015


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.

* Does the patches handle Bundles and Frameworks properly?

* This functionality should be limited to XCODE Generator

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

0002-CMake-module-for-universal-iOS-library-install

* Could you avoid to hard-code architecture names like i386 or armv7 in
the module?

* 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?

> +  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.

Thanks,
Gregor


More information about the cmake-developers mailing list