How can I add folder that contains .h and .lib files, which I depend on, so that they are found while compiling / linking? The folder I want to add is stored in LIB_NAME env variable.
I think --info/-i will tell you the command line arguments. For MSVC, this probably isn’t very useful. You can also look in build/tmp//options.txt to see the full list of arguments.
I think the way you can do this currently is to use a PrebuiltLibrary. Here’s an example.
Basically, you want to define a meaningful name and tell Gradle where to find the headers and libraries. Then in your component you add that library as a dependency. We take care of adding the header include paths during compilation and libraries during link.
I tried to adopt the example, but I couldn’t really get it to work. I’m getting this error:
A problem occurred configuring project ‘:native’. > Exception thrown while executing model rule: model.components
Cannot create a ComponentSpec named ‘dokan’ because this container does not
support creating elements by name alone. Please specify which subtype of Compon entSpec to create. Known subtypes are: NativeExecutableSpec, NativeLibrarySpec
Try to keep your component names as valid Java identifiers or enclose them in quotes. I think your “dokan-jni” is being interpreted as dokan (minus) jni and it confuses the compiler.
Inside the prebuilt lib components, you have to select the binaries by type (shared object or static library) because it can have both. So inside ‘dokan {}’ you need a ‘binaries.withType(StaticLibraryBinary) {}’ around staticLibraryFile. That’s similar to what the util library has in the example.