[cmake-developers] Fixing bug #12506 (iOS install)

Ruslan Baratov ruslan_baratov at yahoo.com
Thu Aug 27 10:58:53 EDT 2015


On 26-Aug-15 22:53, Gregor Jasny wrote:
> Hallo,
>
> On 13/08/15 12:56, Ruslan Baratov wrote:
>> On 13-Aug-15 08:46, Gregor Jasny wrote:
>>> On 13/08/15 01:44, Ruslan Baratov via cmake-developers wrote:
>>>> Sending patches with fix. Now it's possible to install simulator
>>>> libraries by:
>>>>
>>>>   > cmake --build _builds --config Release --target install -- -sdk
>>>> iphonesimulator
>>>>
>>>> and device libraries by:
>>>>
>>>>   > cmake --build _builds --config Release --target install -- -sdk
>>>> iphoneos
>>>>
>>>> or from Xcode IDE (build target install).
>>>>
>>>> However this commands will install both libraries to the same location.
>>>> This behaviour can be improved by adding some code that will do lipo of
>>>> all libraries before install (i.e. universal libraries will be
>>>> installed). This can be achieved by using ONLY_ACTIVE_ARCHS=NO while
>>>> running Xcode build. The only question is about making install target
>>>> depends on two type of builds (-sdk iphonesimulator and -sdk iphoneos).
>>> This was my preliminary work:
>>>> https://github.com/gjasny/CMake/commit/978dca25ac387bdec894a1ba2c934317f5f6169f
>>>>
>> This looks great! I've spent several hours trying to figure out how
>> '$(EFFECTIVE_PLATFORM_NAME)' can be set to Xcode and some CMake friendly
>> string to cmake_install.cmake script. I didn't know Xcode understand
>> `${VAR}` syntax (probably it didn't, it's just expanded as an
>> environment variable). I've tested your fix and it works fine for me.
>> Since we don't need to replace string with path manually I think your
>> solution is neater. I've added description to commit and rebased it, see
>> attachment.
> I just pushed the fix-ios-install topic including a test. Basically the
> patch changes the invocation line of the script from
>
> cmake -DBUILD_TYPE=Release-iphoneos -P cmake_install.cmake
>
> to
>
> cmake -DBUILD_TYPE=Release -DEFFECTIVE_PLATFORM_NAME=-iphoneos -P
> cmake_install.cmake
>
> and within the install script
>
> file(INSTALL DESTINATION "${CMAKE_INSTALL_PREFIX}/lib" TYPE
> STATIC_LIBRARY FILES ".../Release/libfoo.a")
>
>
> to
>
> file(INSTALL DESTINATION "${CMAKE_INSTALL_PREFIX}/lib" TYPE
> STATIC_LIBRARY FILES ".../Release${EFFECTIVE_PLATFORM_NAME}/libfoo.a")
>
>
> By keeping the ${EFFECTIVE_PLATFORM_NAME} a variable one is able to use
> the same install script for iphoneos and iphonesimulator SDKs.
>
> Please review and merge.
>
> Thanks,
> Gregor
Works fine for me with rebased version. Though some tests failed:

The following tests FAILED:
    14 - kwsys.testDynamicLoader (Failed)
   372 - RunCMake.FindPkgConfig (Failed)
   392 - FindPackageModeMakefileTest (Failed)

I've tried version without patches (81ad562) and see this failures too, 
so I guess it's not because of iOS fixes.

 From my experience changes expected to be in format of `git 
format-patch` command, so attaching them.

Thanks, Ruslo
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Replace-CMAKE_XCODE_EFFECTIVE_PLATFORMS-with-call-to.patch
Type: text/x-patch
Size: 2482 bytes
Desc: not available
URL: <http://public.kitware.com/pipermail/cmake-developers/attachments/20150827/c1f7a32b/attachment-0003.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-Fix-installation-of-iOS-targets-12506.patch
Type: text/x-patch
Size: 2260 bytes
Desc: not available
URL: <http://public.kitware.com/pipermail/cmake-developers/attachments/20150827/c1f7a32b/attachment-0004.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0003-Xcode-Add-unit-test-for-iOS-project-install-12506.patch
Type: text/x-patch
Size: 2967 bytes
Desc: not available
URL: <http://public.kitware.com/pipermail/cmake-developers/attachments/20150827/c1f7a32b/attachment-0005.bin>


More information about the cmake-developers mailing list