4

I want to bind OpenSSL to my Swift client code. What I use now is an umbrella header referenced in a module map:

module COpenSSL [system] {
  header "copenssl.h"
  export *
}

That copenssl.h rests in the same directory and it is just a series of inclusions like #include <openssl/conf.h>. With all the needed compiler flags it works flawlessly: I'm able to import COpenSSL and use symbols from it.

However, I am concerned by another level of indirection in my code. I doubt if it's really necessary. If I drop the umbrella header, that copenssl.h, and just paste the inclusions to the module map, like so:

module COpenSSL [system] {
  header "openssl/conf.h"
  /* ...and more */
  export *
}

Then it no longer could find the headers, even though all the flags are the same. It feels like the compiler only searches the module map directory, not honouring the search path settings for the project.

The docs say:

The file can be referenced either by an absolute path or by a path relative to the current map file.

http://clang.llvm.org/docs/Modules.html#module-declaration

But I'm hesitant to hardcoding the paths because it hinders cross-platformity.

Should I just use the umbrella header, or is there any way to ask the compiler to look at -I paths?

Zomagk
  • 349
  • 1
  • 10

0 Answers0