Skip to content
This repository has been archived by the owner on Mar 9, 2022. It is now read-only.

Setup change: Making headers public on static lib target #56

Open
drekka opened this issue Nov 14, 2012 · 3 comments
Open

Setup change: Making headers public on static lib target #56

drekka opened this issue Nov 14, 2012 · 3 comments

Comments

@drekka
Copy link

drekka commented Nov 14, 2012

Hi, I have not submitted a pull on this because it's a change to the project file and will trigger a merge conflict.

I'm using both CouchCocoa and TouchDB. The technique I'm using is to include them as XCode sub projects of my main project and do workspace builds. This helps with debugging and makes combined builds easier. However my project would not build because it could not find the CouchCocoa and TouchDB headers.

To fix this I did these changes:

  1. Set the Public Headers Folder Path build setting to be include/$PROJECT_NAME in both projects. Doing this in a workspace build means that the headers from the sub project are visible to other projects via the framework style #import <project/header.h> statement. ie. #import <CouchCocoa/CouchCocoa.h>.
  2. I then selected all header files and added them to the Copy Headers build phases of the iOS LIbrary targets.

The result is that the headers are now accessible to the main project.

I think doing this in both projects doesn't effect your normal builds or targets, but makes it really easy to use them as sub projects and therefore have them built as part of the normal build. This saves me having to go through a manual process of building the frameworks and also helps when debugging.

Could this change be make on both CouchCocoa and TouchDB please?

ciao
Derek

@snej
Copy link
Contributor

snej commented Nov 15, 2012

Hm. Is this really necessary? The headers already get copied to the framework's Headers subdirectory, which is where they should be searched by targets that build against the framework. You may just need to add entries to the framework search path of your target so the compiler can find the frameworks.

@drekka
Copy link
Author

drekka commented Nov 15, 2012

That doesn't work in my build because I'm using the static lib targets, not the framework. Hence the headers are not available.

I've been updating the TouchDB inclusion to have the iOS Framework as the Target dependencies so that the headers are copied to the build directories. I then added "${BUILD_DIR}/${CONFIGURATION}-ios-universal/TouchDB.framework/Headers" to the Header Search Paths.

But it's not working. Here is the error I'm getting:

CompileC "/Users/sensis/Library/Developer/Xcode/DerivedData/Yellow_Live-hjonvxmdefkfunfvuxxnhrrtewqe/Build/Intermediates/Yellow Live.build/Debug-iphonesimulator/YellowLive.build/Objects-normal/i386/TouchDBServer.o" classes/TouchDBServer.m normal i386 objective-c com.apple.compilers.llvm.clang.1_0.compiler
cd "/Users/sensis/projects/Yellow live"
setenv LANG en_US.US-ASCII
setenv PATH "/Applications/Xcode46-DP2.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode46-DP2.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Applications/Xcode46-DP2.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -x objective-c -arch i386 -fmessage-length=0 -Wno-trigraphs -fpascal-strings -O0 -Werror=incompatible-pointer-types -Werror-implicit-function-declaration -Wmissing-field-initializers -Wmissing-prototypes -Wreturn-type -Wimplicit-atomic-properties -Wobjc-missing-property-synthesis -Wreceiver-is-weak -Wduplicate-method-match -Wformat -Wmissing-braces -Wparentheses -Wswitch -Wunused-function -Wunused-label -Wno-unused-parameter -Wunused-variable -Wunused-value -Wempty-body -Wuninitialized -Wunknown-pragmas -Wshadow -Wno-four-char-constants -Wconversion -Wconstant-conversion -Wint-conversion -Wsign-compare -Wshorten-64-to-32 -Wpointer-sign -Wno-newline-eof -Wno-selector -Wstrict-selector-match -Wundeclared-selector -Wno-deprecated-implementations -DDEBUG -isysroot /Applications/Xcode46-DP2.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator6.1.sdk -fexceptions -fasm-blocks -fstrict-aliasing -Wprotocol -Wdeprecated-declarations -g -fvisibility=hidden -Wsign-conversion -fobjc-abi-version=2 -fobjc-legacy-dispatch -mios-simulator-version-min=5.0 -iquote "/Users/sensis/Library/Developer/Xcode/DerivedData/Yellow_Live-hjonvxmdefkfunfvuxxnhrrtewqe/Build/Intermediates/Yellow Live.build/Debug-iphonesimulator/YellowLive.build/Yellow Live-generated-files.hmap" "-I/Users/sensis/Library/Developer/Xcode/DerivedData/Yellow_Live-hjonvxmdefkfunfvuxxnhrrtewqe/Build/Intermediates/Yellow Live.build/Debug-iphonesimulator/YellowLive.build/Yellow Live-own-target-headers.hmap" "-I/Users/sensis/Library/Developer/Xcode/DerivedData/Yellow_Live-hjonvxmdefkfunfvuxxnhrrtewqe/Build/Intermediates/Yellow Live.build/Debug-iphonesimulator/YellowLive.build/Yellow Live-all-target-headers.hmap" -iquote "/Users/sensis/Library/Developer/Xcode/DerivedData/Yellow_Live-hjonvxmdefkfunfvuxxnhrrtewqe/Build/Intermediates/Yellow Live.build/Debug-iphonesimulator/YellowLive.build/Yellow Live-project-headers.hmap" -I/Users/sensis/Library/Developer/Xcode/DerivedData/Yellow_Live-hjonvxmdefkfunfvuxxnhrrtewqe/Build/Products/Debug-iphonesimulator/include "-I/Users/sensis/projects/Yellow live/submodules/GRMoustache/include" -I/Users/sensis/Library/Developer/Xcode/DerivedData/Yellow_Live-hjonvxmdefkfunfvuxxnhrrtewqe/Build/Products/Debug-ios-universal/TouchDB.framework/Headers "-I/Users/sensis/Library/Developer/Xcode/DerivedData/Yellow_Live-hjonvxmdefkfunfvuxxnhrrtewqe/Build/Intermediates/Yellow Live.build/Debug-iphonesimulator/YellowLive.build/DerivedSources/i386" "-I/Users/sensis/Library/Developer/Xcode/DerivedData/Yellow_Live-hjonvxmdefkfunfvuxxnhrrtewqe/Build/Intermediates/Yellow Live.build/Debug-iphonesimulator/YellowLive.build/DerivedSources" -F/Users/sensis/Library/Developer/Xcode/DerivedData/Yellow_Live-hjonvxmdefkfunfvuxxnhrrtewqe/Build/Products/Debug-iphonesimulator -include "/Users/sensis/projects/Yellow live/Yellow Live-Prefix.pch" -MMD -MT dependencies -MF "/Users/sensis/Library/Developer/Xcode/DerivedData/Yellow_Live-hjonvxmdefkfunfvuxxnhrrtewqe/Build/Intermediates/Yellow Live.build/Debug-iphonesimulator/YellowLive.build/Objects-normal/i386/TouchDBServer.d" --serialize-diagnostics "/Users/sensis/Library/Developer/Xcode/DerivedData/Yellow_Live-hjonvxmdefkfunfvuxxnhrrtewqe/Build/Intermediates/Yellow Live.build/Debug-iphonesimulator/YellowLive.build/Objects-normal/i386/TouchDBServer.dia" -c "/Users/sensis/projects/Yellow live/classes/TouchDBServer.m" -o "/Users/sensis/Library/Developer/Xcode/DerivedData/Yellow_Live-hjonvxmdefkfunfvuxxnhrrtewqe/Build/Intermediates/Yellow Live.build/Debug-iphonesimulator/YellowLive.build/Objects-normal/i386/TouchDBServer.o"

In file included from /Users/sensis/projects/Yellow live/classes/TouchDBServer.m:11:
In file included from /Users/sensis/projects/Yellow live/classes/TouchDBServer.h:11:
In file included from /Users/sensis/Library/Developer/Xcode/DerivedData/Yellow_Live-hjonvxmdefkfunfvuxxnhrrtewqe/Build/Products/Debug-iphonesimulator/include/CouchCocoa/CouchCocoa.h:29:
/Users/sensis/Library/Developer/Xcode/DerivedData/Yellow_Live-hjonvxmdefkfunfvuxxnhrrtewqe/Build/Products/Debug-iphonesimulator/include/CouchCocoa/CouchDesignDocument_Embedded.h:16:9: fatal error: 'TouchDB/TD_Database+Insertion.h' file not found
#import <TouchDB/TD_Database+Insertion.h>

@snej
Copy link
Contributor

snej commented Nov 15, 2012

Yeah, this sort of thing is why I'm really reluctant to touch the build configuration at all. Any change has a likelihood of triggering this sort of build breakage in the project itself, or in Syncpoint. :(

Linking against the framework is the right approach for your project; the static-library targets are really just internal. I'm not sure why you're getting those errors; check whether the header search path you're using actually expands to the correct path at build time.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants