Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add properties jniinclude and jnicinclude #689

Closed
wants to merge 2 commits into from

Conversation

HGuillemet
Copy link
Contributor

Add new properties for declaring separately the list of headers to parse and the list of headers to include in JNI code.

@saudet
Copy link
Member

saudet commented Jun 13, 2023

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.

@HGuillemet
Copy link
Contributor Author

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 ?

@saudet
Copy link
Member

saudet commented Jun 13, 2023

The init() method gets called as part of Loader.loadProperties(), at the very beginning of Parser.parse(), same for Generator.

@HGuillemet
Copy link
Contributor Author

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 ?

@saudet
Copy link
Member

saudet commented Jun 13, 2023

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.

@HGuillemet HGuillemet closed this Jan 1, 2024
@HGuillemet HGuillemet deleted the jniinclude branch January 1, 2024 23:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants