Dub option for specifying importC include paths

Ben Jones fake at fake.fake
Wed Sep 13 22:48:01 UTC 2023


I'm trying to build a wrapper around a lib written in C by having 
importC compile the .c files, and then providing a nice D API on 
top.  My dub config file seems to be finding the C files to 
compile without issue, but it's not passing the include dirs for 
the preprocessor to find headers.  Is there an option I'm missing 
or is there some way to get DUB to do this for me aside from 
passing like -cpp flags via dflags?

 From my dub.json:

```
     "cSourcePaths": [
         "source/libgit2/src/",
         "source/libgit2/src/util/"
     ],
     "cImportPaths" : [
         "source/libgit2/src/util/",
         "source/libgit2/src/libgit2/"
     ],
     "importPaths" : [
         "source/libgit2/src/util/",
     ],

     "excludedSourceFiles" : [
         "source/libgit2/src/cli/*.c"
     ],
```

And the what dub's actually running when it preprocesses the 
first .c file:

```
/usr/bin/cc -fno-blocks -dD -Wno-builtin-macro-redefined -E 
-include 
/opt/homebrew/Cellar/ldc/1.34.0/include/dlang/ldc/importc.h 
source/libgit2/src/libgit2/annotated_commit.c -o 
/var/folders/p3/6fcprxgn0xb77hzb031vm1_m0000gn/T/itmp-ldc-de8fa3/annotated_commit.i
```

Which has doesn't specify any -I flags


More information about the Digitalmars-d-learn mailing list