Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Define custom module map file in cocoapods Podspec

I made a custom module map file to handle the libxml import in a swift project. (non-modular include error)

It's working great if I do it manually, but cocoapods won't find / resolve the module when I try to pod lint a simple project containing an import from this custom module.

I tried s.module_map = "module/module.modulemap" along with

core.xcconfig = {
  'HEADER_SEARCH_PATHS' => '$(SDKROOT)/usr/include/libxml2 $(SRCROOT)/module $(SDKROOT)/usr/include/libresolv',
  'OTHER_LDFLAGS' => '"-lxml2"',
  'CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES' => 'YES',
  'ENABLE_BITCODE' => 'NO',
  "SWIFT_INCLUDE_PATHS" => "$(SRCROOT)/module"
}

Any help would be appreciated.

like image 202
Loegic Avatar asked Aug 28 '15 14:08

Loegic


1 Answers

I managed to fix this issue by setting the pod_target_xcconfig property. The complete part looks like that :

s.preserve_path = 'module/module.modulemap'
s.module_map = 'module/module.modulemap'

core.pod_target_xcconfig = { 'HEADER_SEARCH_PATHS' => '$(PODS_ROOT)/mypod/module' }
core.xcconfig = { 'HEADER_SEARCH_PATHS' => '$(SDKROOT)/usr/include/libxml2 $(PODS_ROOT)/mypod/module' }
like image 162
Loegic Avatar answered Sep 29 '22 04:09

Loegic