Closed HGuillemet closed 8 months ago
This looks OK, but I don't think I'm going to merge it because I realized we can already do what you want by modifying the platform.include property inside an init()
method like this one here: https://github.com/bytedeco/javacpp-presets/blob/master/pytorch/src/main/java/org/bytedeco/pytorch/presets/torch.java#L1795
In your case, I'd put the top-level header files in @Platform(include=...
and leave it there when init()
gets called by the Generator, but modify it as required when it gets called by the Parser. We can literally code anything in there, including calling clang from the LLVM presets, so it's a lot more flexible than an annotation value.
I considered this option, but currently allIncludes
is filled from include properties before init is called.
And I don't think init()
is called by Generator. is it ?
The init() method gets called as part of Loader.loadProperties(), at the very beginning of Parser.parse(), same for Generator.
Ok. I'll load this include list from a resource file from init(). How to know if init is called from parser or from generator ?
We might want to add something for that, but just checking the stack with Loader.getCallerClass() or something should suffice, so if that works I'm inclined to use that.
Add new properties for declaring separately the list of headers to parse and the list of headers to include in JNI code.