Keeping directory structure when creating frameworks in xcode Keeping directory structure when creating frameworks in xcode xcode xcode

Keeping directory structure when creating frameworks in xcode


Use Copy Files instead of Copy Headers in the Build Phases UI.

Create a separate Copy Files (Editor -> Add Build Phase) for each output folder needed.


If you cannot use a folder reference because the folders contain non-header-files, too, which you don't want to copy, add a Run Script build phase instead:

cd "${SRCROOT}/path/from/project/root/to/headers"echo 'Copying headers into Framework..'for H in `find . -name "*.h"`;  do    echo "copying ${H} to ${BUILT_PRODUCTS_DIR}/${PUBLIC_HEADERS_FOLDER_PATH}/${H}"    ditto "${H}" "${BUILT_PRODUCTS_DIR}/${PUBLIC_HEADERS_FOLDER_PATH}/${H}"done

That will copy all .h files from the path you cd'd to into YourFramework.framework/Versions/A/Headers just like marking them as public would.


It seems that this is not currently a built in feature of xcode, so you must revert to scripts to copy files recursively (presumably selecting only header files): How can I preserve subgroups when changing role to public in Copy Headers build phase in XCode?

Here's a discussion about how to accomplish just that: http://www.cocoabuilder.com/archive/xcode/259185-copy-headers-that-preserves-subdirectory-structure.html