how to give relative header path inside module map for iOS framework

425 Views Asked by At

I'm trying to embed AdswizzSDK into my swift framework.

The modulemap header works when I give the absolute path.

When I try to give the relative path, it throws the error header file not found.

//This works

module AdswizzSDK {
    header "/Users/venkata.nandamuri/Desktop/MyFramework/Frameworks/AdswizzSDK.framework/Headers/AdswizzSDK.h"
    header "/Users/venkata.nandamuri/Desktop/MyFramework /Frameworks/AdswizzSDK.framework/Headers/AdswizzCompanionViewDelegate.h"
    export *
}

This doesnt work

module AdswizzSDK {
    header "$(SRCROOT)/Frameworks/AdswizzSDK.framework/Headers/AdswizzSDK.h"
    header "$(SRCROOT)/Frameworks/AdswizzSDK.framework/Headers/AdswizzCompanionViewDelegate.h"
    export *
}

Is there a way to embed AdswizzSDK into my custom framework ?

1

There are 1 best solutions below

0
On

In the Scheme of your target, you can define Pre-Actions; add a run script pre-action with:

echo "module Heap [system] {" > ${SRCROOT}/Heap/iphoneos.modulemap
echo "    header \"${SRCROOT}/Pods/Headers/Public/Heap/Heap.h\"" >> 
${SRCROOT}/Heap/iphoneos.modulemap
echo "    export *" >> ${SRCROOT}/Heap/iphoneos.modulemap
echo "}" >> ${SRCROOT}/Heap/iphoneos.modulemap

Replacing the paths within the echo command and in the standard output redirect with your appropriate paths. You will likely want to replace the "module Heap" with "module AdswizzSDK" too.

Also ensure to provide the build settings from one of your target to the pre-actions so the SRCROOT and other build variables are defined.