[cmake-developers] Create subdirectories in Resource directory for Frameworks and Application bundle.

Bartosz Kosiorek gang65 at poczta.onet.pl
Fri Dec 11 13:44:17 EST 2015


Hi

Because there is difference between OS X and iOS Bundles directory
structure (see: Apple specification
https://developer.apple.com/library/mac/documentation/CoreFoundation/Conceptual/CFBundles/BundleTypes/BundleTypes.html),

in trunk (In CMake 3.5) RESOURCE property create corresponding directory
structure.
I have already fix that with:
https://public.kitware.com/Bug/view.php?id=15848

So RESOURCE gives you a level of abstraction:
For OSX:
it will create "Resource" directory

For iOS it will create "flat" directory structure.

In your example "Resource" directory will be created in both cases (for OSX
and iOS).
Which is wrong:
For OSX: it should  create "Resource" directory
For iOS it will create "flat" directory structure.

I could provide patch to fix that issue, if you agree with that.
What do you think about that?
Do you think the same should be applied to "Headers"?

Best Regards
Bartosz



2015-12-11 19:06 GMT+01:00 Clinton Stimpson <clinton at elemtech.com>:

>
>
> On Friday, December 11, 2015 05:01:41 PM Bartosz Kosiorek wrote:
> > Thanks Clint
> >
> > Unfortunately MACOSX_PACKAGE_LOCATION is not working correctly with
> RESOURCE
> > property. For every resource which is marked as RESOURCE, will be placed
> in
> > root "Resources" directory.
> >
> > The CMake code below create following directory structure for OS X:
> >
> > ── mul.framework
> >     ├── Headers -> Versions/Current/Headers
> >     ├── Resources -> Versions/Current/Resources
> >     ├── Versions
> >     │   ├── A
> >     │   │   ├── Headers
> >     │   │   │   └── mul.h
> >     │   │   ├── Modules
> >     │   │   │   └── module.modulemap
> >     │   │   ├── Resources
> >     │   │   │   ├── Info.plist
> >     │   │   │   ├── mulres.txt
> >     │   │   │   ├── pl.txt
> >     │   │   │   └── resourcefile.txt
> >     │   │   ├── lang
> >     │   │   │   └── en.txt
> >     │   │   └── mul
> >     │   └── Current -> A
> >     └── mul -> Versions/Current/mul
> >
> >
> > As you can see eveything which is marked as "RESOURCE" will be placed in
> > Versions/A/ directory My expectation will be that lang/pl.txt and
> > lang/en.txt should be in Resources/lang/ directory. Here is complete
> > directory structure:
> >
> > ── mul.framework
> >     ├── Headers -> Versions/Current/Headers
> >     ├── Resources -> Versions/Current/Resources
> >     ├── Versions
> >     │   ├── A
> >     │   │   ├── Headers
> >     │   │   │   └── mul.h
> >     │   │   ├── Modules
> >     │   │   │   └── module.modulemap
> >     │   │   ├── Resources
> >     │   │   │   ├── Info.plist
> >     │   │   │   ├── mulres.txt
> >     │   │   │   ├── lang
> >     │   │   │   │   └── pl.txt
> >     │   │   │   │   └── en.txt
> >     │   │   │   └── resourcefile.txt
> >     │   │   ├── lang
> >     │   │   │   └── en.txt
> >     │   │   └── mul
> >     │   └── Current -> A
> >     └── mul -> Versions/Current/mul
> >
> >
> > What do you think about that?
> >
> > Here is the source code:
> >
> > set_property(SOURCE module.modulemap
> >   PROPERTY MACOSX_PACKAGE_LOCATION "Modules")
> >
> > set_property(
> >   SOURCE lang/en.txt lang/pl.txt
> >   PROPERTY MACOSX_PACKAGE_LOCATION "lang")
> >
> > set(RESLIST
> >     mulres.txt
> >     lang/pl.txt
> >     resourcefile.txt
> >     )
> >
> > add_library(mul SHARED
> >             mul.c
> >             mul.h
> >             module.modulemap
> >             lang/pl.txt
> >             lang/en.txt
> >             resourcefile.txt
> >             mulres.txt)
> >
> > # Create an iOS Framework bundle
> > set_target_properties(mul PROPERTIES
> >   FRAMEWORK TRUE
> >   MACOSX_FRAMEWORK_IDENTIFIER org.cmake.mul
> >   MACOSX_FRAMEWORK_SHORT_VERSION_STRING 42
> >   MACOSX_FRAMEWORK_BUNDLE_VERSION 3.2.10
> >   XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "iPhone Developer"
> >   PUBLIC_HEADER mul.h
> >   RESOURCE "${RESLIST}"
> > )
>
>
> Here is a CMakeLists.txt that will give you the desired layout.
> I also see that MACOSX_PACKAGE_LOCATION doesn't work with RESOURCE.
>
>
> set_property(SOURCE module.modulemap
>   PROPERTY MACOSX_PACKAGE_LOCATION "Modules")
>
> set_property(
>   SOURCE lang/pl.txt lang/en.txt
>   PROPERTY MACOSX_PACKAGE_LOCATION "Resources/lang")
>
> set(RESLIST
>     mulres.txt
>     resourcefile.txt
>     )
>
> add_library(mul SHARED
>             mul.c
>             mul.h
>             module.modulemap
>             lang/pl.txt
>             lang/en.txt
>             resourcefile.txt
>             mulres.txt)
>
> # Create an iOS Framework bundle
> set_target_properties(mul PROPERTIES
>   FRAMEWORK TRUE
>   MACOSX_FRAMEWORK_IDENTIFIER org.cmake.mul
>   MACOSX_FRAMEWORK_SHORT_VERSION_STRING 42
>   MACOSX_FRAMEWORK_BUNDLE_VERSION 3.2.10
>   XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "iPhone Developer"
>   PUBLIC_HEADER mul.h
>   RESOURCE "${RESLIST}"
> )
>
>
> Now I'm wondering what does the RESOURCE target property do that
> MACOSX_PACKAGE_LOCATION doesn't already support?
>
> Clint
> --
>
> Powered by www.kitware.com
>
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Kitware offers various services to support the CMake community. For more
> information on each offering, please visit:
>
> CMake Support: http://cmake.org/cmake/help/support.html
> CMake Consulting: http://cmake.org/cmake/help/consulting.html
> CMake Training Courses: http://cmake.org/cmake/help/training.html
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/cmake-developers
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake-developers/attachments/20151211/cc8817c6/attachment-0001.html>


More information about the cmake-developers mailing list