I tried this approach and works when I build it with XCode 11 beta (either targeting MacOS or iOS). however, strangely, it does not work when using swift build from command-line (on MacOS or Linux). It can't find the libxml2 includes when run from the command-line:
$ swift build
/Users/mremond/devel/swift/XMPP/Sources/CXML/include/CXML.h:4:10: note: while building module 'libxml2' imported from /Users/mremond/devel/swift/XMPP/Sources/CXML/include/CXML.h:4:
#include <libxml2/libxml/tree.h>
^
<module-includes>:1:9: note: in file included from <module-includes>:1:
#import "libxml/HTMLparser.h"
^
/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/include/libxml2/libxml/HTMLparser.h:15:10: error: 'libxml/xmlversion.h' file not found
#include <libxml/xmlversion.h>
^
<module-includes>:1:9: note: in file included from <module-includes>:1:
#import "/Users/mremond/devel/swift/XMPP/Sources/CXML/include/CXML.h"
^
...
I commited my attempt here: XMPP/Package.swift at master · FluuxIO/XMPP · GitHub
Any idea?