Relative Path for Headers in Modulemap

2.2k views Asked by At

Currently i am trying to optimize my modulemap. The problem was that i could not add my framework to my project because i used a obj-c Framework in my swift framework. I added the Obc-c headers in my modulemap and made the module work and could successfull add my framework to my project. The problem is that I cant make it work with realative path to my headers. And using absoute path is only a temp solution and not co worker friendly.

Right not I have to set this kinda absolute path:

header "/Users/me/Documents/framework_project/Folder/OBJC_LIB.framework/Headers/someHeader.h"

I added this modulemap in my framework project as private modulemap. Is there any option to my this work like this?

header "./Folder/OBJC_LIB.framework/Headers/someHeader.h"

Thanks in advance.

2

There are 2 answers

0
Guillaume Laurent On

Having encountered the same problem, I finally found that the HEADER_SEARCH_PATH of the Swift framework must contain the path to the ObjC framework's umbrella header.

0
Roman Podymov On

First of all you need to clarify the location of your modulemap file. Probably it will be in the DerivedData folder (to see the location of this folder press Xcode -> Preferences -> Locations in Xcode 10), path will be similar to /Users/me/Library/Developer/Xcode/DerivedData. In such case you will find the modulemap file inside this folder, full path will be something like /Users/me/Library/Developer/Xcode/DerivedData/framework_project_something/Build/Products/Debug-iphonesimulator/framework_project/framework_project.framework/Modules/module.modulemap. Once you will find this file you will be able to use such declaration inside your modulemap file:

header "../../../../../../../../../../../Documents/framework_project/Folder/OBJC_LIB.framework/Headers/someHeader.h"

I know that this is not exactly what you want but maybe it will help you to find a better answer on this question.