Cross platfrom non-java binary dependency

I need to create plugin that will do things similar to protubuf - it will generate java code from another type of files. To do that it needs to have certain tool in path.

What’s the best solution to specify dependency on such a tool?

Right now current version is doing crazy things like every user of a plugin specifies compileOnly dependency on zip archive with tool distribution, then some task which entire build is dependsOn will unzip all zip from all dependencies into specific folder and user should specify PATH and LD_LIBRARY_PATH correctly in the task that is generating java code.
This sounds ridiculously complex to me.

If anything this zip should be plugin dependency, not the plugin user dependency. I could probably come up with some stupid solution like unzip the tool into some hidden folder etc etc, but maybe there are other cross-platform ways?