kstenerud / iOS-Universal-Framework

An XCode project template to build universal frameworks (arm7, arm7s, and simulator) for iOS / iPhone.
2.95k stars 473 forks source link

Public headers folder path contains unwanted sub-directories #79

Closed avrahamshukron closed 11 years ago

avrahamshukron commented 11 years ago

Hi!

I'm building a real embedded framework. My source directory is organized in multi-level hierarchy: -Source Dir: ---Model ------ObjectA --------ObjectA.h --------ObjectA.m ------ObjectB ------etc. ---ViewControllers ------ViewControllerA ---Views etc.

Now, when I build the framework, all the public headers are copied into the public headers folder path, but the preserve their original path relative to the source directory. e.g:

--Headers ----Model -------ObjectA ----------ObjectA.h -------ObjectA ----------ObjectB.h

This is annoying because this means that I can no longer just use #import <MyFramework/ObjectA.h>. Rather I have to use the full path relative to the headers dir:

import <MyFramework/Model/ObjectA/ObjectA.h>.

Is there any way to tell Xcode to remove this hierarchy from the Headers dir and just copy all the public headers to the same level?

BTW - Any header that is outside the $(SRCROOT), but is part of the framework is copied as expected, regardless his location in the file system.

kstenerud commented 11 years ago

You can turn off this behavior by disabling the second Run Script build phase in your framework:

# Disable this script
exit 0

# Original script contents
HEADERS_ROOT=$SRCROOT/$PRODUCT_NAME
FRAMEWORK_HEADERS_DIR="$BUILT_PRODUCTS_DIR/$WRAPPER_NAME/Versions/$FRAMEWORK_VERSION/Headers"
...

Mk 8 (in the beta branch) makes this behavior and others configurable.

avrahamshukron commented 11 years ago

Wow thanks!

May I ask - What is the advantage of this configuration in the first place?

kstenerud commented 11 years ago

Most C libraries use a deep header hierarchy, so that's what people tend to be used to. Xcode is the exception in that it flattens everything to the same level, which can cause problems with codebases from other systems.

I've made it configurable in Mk 8 so that you can choose whichever makes more sense for your framework.

avrahamshukron commented 11 years ago

Thanks! Great work!

shahabejaz commented 11 years ago

Thanks alot....

sherlockyao commented 11 years ago

Thanks, i had the same problem now solved