View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0015833CMakeCMakepublic2015-11-05 11:292016-06-06 13:37
ReporterBartosz 
Assigned ToGregor Jasny 
PrioritynormalSeverityminorReproducibilityalways
StatusclosedResolutionfixed 
PlatformOSXOSOS Version
Product Version 
Target VersionCMake 3.5Fixed in VersionCMake 3.5 
Summary0015833: Support creating of Framework for iOS
DescriptionThe framework from Apple is specific directory structure.

For OS X it is using versioned directory structue.
The directory structure looks like:
MyFramework.framework/
    MyFramework -> Versions/Current/MyFramework
    Resources -> Versions/Current/Resources
    Versions/
        A/
            MyFramework
            Headers
            Resources/
                English.lproj/
                    InfoPlist.strings
                Info.plist
        Current -> A


More info:
https://developer.apple.com/library/mac/documentation/MacOSX/Conceptual/BPFrameworks/Concepts/FrameworkAnatomy.html#//apple_ref/doc/uid/20002253-BAJEJJAB [^]


These structure is used when you specify following target variables:
set_target_properties(MyFramework PROPERTIES
  FRAMEWORK TRUE
  FRAMEWORK_VERSION A
  MACOSX_FRAMEWORK_IDENTIFIER com.cmake.myframework
)


For iOS the "flat" directory structure is used.
It looks like:
iOSFramework.framework/
      iOSFramework
      Info.plist
      Headers
      Resources/
            English.lproj/
                 InfoPlist.strings

Currently it is not possible to create "flat" directory structure which could be used for iOS.

Solution proposal:
Allow possibility to create "flat" framework.
The flat framework will be produced when IOS_FRAMEWORK will be set to TRUE
For example:

set_target_properties(MyFramework PROPERTIES
  IOS_FRAMEWORK TRUE
  MACOSX_FRAMEWORK_IDENTIFIER com.cmake.myframework
)

I would like to implement that, and provide patches to cmake.
I need some architectural support from you.


Additional InformationMaybe also I could fix:
https://public.kitware.com/Bug/view.php?id=15820 [^]
TagsNo tags attached.
Attached Filespatch file icon iOS-Dynamic_Framework_support.patch [^] (670 bytes) 2015-11-06 11:03 [Show Content]
zip file icon cmake_shared_ios_framework.zip [^] (6,095 bytes) 2015-11-06 11:06
patch file icon 0001-Add-support-for-iOS-Frameworks-bug-15833.patch [^] (3,501 bytes) 2015-11-09 17:20 [Show Content]
patch file icon 0001-Fix-iOS-Framework-directory-structure-15833.patch [^] (5,590 bytes) 2015-11-12 03:26 [Show Content]

 Relationships
related to 0015843closedGregor Jasny Documentation is not mention about support for iOS Application Bundle and iOS Framework Bundle 

  Notes
(0039840)
Bartosz (reporter)
2015-11-06 03:29

I just notified that flat directory structure is created (for iOS), when cmMakefile::PlatformIsAppleIos() is return true.

It seems that it returns true when CMAKE_OSX_SYSROOT is set to:
  "appletvos", "appletvsimulator",
  "iphoneos", "iphonesimulator",
  "watchos", "watchsimulator",
(0039845)
Bartosz (reporter)
2015-11-06 11:12
edited on: 2015-11-06 11:12

In attachment you could find the patch for support Dynamic Frameworks for iOS.
I tested it with my small custom project (see attachment), and by manually checking "ID" of the shared library:
  
otool -L shared_empty/mul/mul.framework/mul
shared_empty/mul/mul.framework/mul:
    @rpath/mul.framework/mul (compatibility version 0.0.0, current version 0.0.0)
    /usr/lib/libSystem.dylib (compatibility version 1.0.0, current version 1226.10.1)

It is very important for Xcode signing, to have properly set "id" (first line).

I was using following CMakeLists.txt script to generate Framework for iOS:

set_property(SOURCE module.modulemap
  PROPERTY MACOSX_PACKAGE_LOCATION "Modules")
set(CMAKE_MACOSX_RPATH ON)
# add the main library
add_library(mul SHARED
            mul.c
            mul.h
            module.modulemap)
# Create an iOS Framework bundle
set_target_properties(mul PROPERTIES
  FRAMEWORK TRUE
  MACOSX_FRAMEWORK_IDENTIFIER com.cmake.mul
  MACOSX_FRAMEWORK_SHORT_VERSION_STRING 42
  MACOSX_FRAMEWORK_BUNDLE_VERSION 3.2.10
  XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "iPhone Developer"
  #FRAMEWORK_VERSION 42 #We don’t need version for iOS Framework
  PUBLIC_HEADER mul.h
)


I would like to test it more on our production code (I will do that on Monday).
Please take a look at this patch, and tell me if my solution is correct.

(0039848)
Bartosz (reporter)
2015-11-09 03:45
edited on: 2015-11-09 05:05

Unfortunately I didn't attached correct patch (sic!).
I will fix that later today.

Meantime I would like to add support for creation of iOS application support.
For iOS systems, the directory structure for Application/Bundle is wrong and it is unable to run on iOS Device/Simulator.

(0039853)
Bartosz (reporter)
2015-11-10 04:33

I just noticed that for CMake 3.4.0 RC3 the Application Bundle for iOS is generated properly!
Thanks.

Unfortunately still iOS Frameworks Bundle is created versioning.
Could you please apply this patch to fix that issue?
(0039859)
Brad King (manager)
2015-11-10 13:15

Corresponding mailing list thread:

 http://thread.gmane.org/gmane.comp.programming.tools.cmake.devel/14908 [^]
(0039868)
Gregor Jasny (developer)
2015-11-13 08:06

Pushed to non-xcode-framework-layout topic and merged to next
(0039871)
Brad King (manager)
2015-11-16 09:21

Re 0015833:0039868: For reference, the changes in that topic are:

 Fix iOS Framework directory structure
 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=9f053763 [^]

 Add test for OSX/iOS Framework directory structure
 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f6f03ed4 [^]
(0039872)
Bartosz (reporter)
2015-11-16 10:01

Thanks Brad.

Can we also push documentation update:
https://cmake.org/Bug/view.php?id=15843 [^]
?
(0039962)
Bartosz (reporter)
2015-12-09 15:04

We could close this ticket. The solution is already pushed into next branch
(0039964)
Brad King (manager)
2015-12-09 15:10

The changes linked by 0015833:0039871 are now in 'master'.
(0040981)
Robert Maynard (manager)
2016-05-02 08:30

Closing resolved issues that have not been updated in more than 4 months.

 Issue History
Date Modified Username Field Change
2015-11-05 11:29 Bartosz New Issue
2015-11-06 03:29 Bartosz Note Added: 0039840
2015-11-06 11:03 Bartosz File Added: iOS-Dynamic_Framework_support.patch
2015-11-06 11:06 Bartosz File Added: cmake_shared_ios_framework.zip
2015-11-06 11:12 Bartosz Note Added: 0039845
2015-11-06 11:12 Bartosz Note Edited: 0039845
2015-11-09 03:45 Bartosz Note Added: 0039848
2015-11-09 05:05 Bartosz Note Edited: 0039848
2015-11-09 17:20 Bartosz File Added: 0001-Add-support-for-iOS-Frameworks-bug-15833.patch
2015-11-10 04:33 Bartosz Note Added: 0039853
2015-11-10 08:37 Brad King Assigned To => Gregor Jasny
2015-11-10 08:37 Brad King Status new => assigned
2015-11-10 08:37 Brad King Target Version => CMake 3.5
2015-11-10 13:15 Brad King Note Added: 0039859
2015-11-12 03:26 Bartosz File Added: 0001-Fix-iOS-Framework-directory-structure-15833.patch
2015-11-13 08:06 Gregor Jasny Note Added: 0039868
2015-11-16 09:21 Brad King Note Added: 0039871
2015-11-16 10:01 Bartosz Note Added: 0039872
2015-11-16 10:14 Brad King Relationship added related to 0015843
2015-12-09 15:04 Bartosz Note Added: 0039962
2015-12-09 15:10 Brad King Note Added: 0039964
2015-12-09 15:10 Brad King Status assigned => resolved
2015-12-09 15:10 Brad King Resolution open => fixed
2015-12-09 15:10 Brad King Fixed in Version => CMake 3.5
2016-05-02 08:30 Robert Maynard Note Added: 0040981
2016-05-02 08:30 Robert Maynard Status resolved => closed
2016-06-06 13:37 Brad King View Status private => public


Copyright © 2000 - 2018 MantisBT Team