Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Copy header files into include folder with CocoaPods

I developing a library and I have next use case. For instance, I have project A that has dependency on project B. I want to setup my pod in project B, so both project A and project B have access to my pod functions. So dependency chain will look like:

My Lib
  |
  B
  |
  A

Actual code will be compiled and available in runtime in project A almost automatically, but I can't compile it because project A does not see header files from my library. The header files places in Pods/MyLib/MyLib/CustomIdentifier directory (because s.header_dir = 'CustomIdentifier' to have access with import like: #import <CustomIdentifier/Header.h>).

I don't want to specify in project A direct path to header file (I do not want user have to do additional action to install my lib). I want CocoaPods to copy my header files or links to them into Products/../include folder so they will be available automatically.

How can I do it? Preferably with podspec file.

Thank you for you help!

like image 277
Ossir Avatar asked Mar 04 '14 13:03

Ossir


1 Answers

Looks like it has to do with folder paths

Quoting from docs:

header_mappings_dir A directory from where to preserve the folder structure for the headers files. If not provided the headers files are flattened.

Examples:

spec.header_mappings_dir = 'src/include'

Helped me with a similar issue.

s.header_mappings_dir = 'armadillo-4.200.0/include/' #allows any folders in here to be avail from project. Namely the folder of headers, armadillo_bits

http://guides.cocoapods.org/syntax/podspec.html#header_mappings_dir

like image 138
atlex2 Avatar answered Oct 21 '22 13:10

atlex2