Hi,
I am trying to include a third-party library (named “Eigen”) in a project using gradle. However, Eigen’s interface headers are organized in several level deep tree with the upper levels headers not having .h extensions. I can recursively search the tree and add all the directories, but I couldn’t figure out how to handle the extensionless headers. Here is a subset of the structure of Eigen:
Eigen/
├── Array
├── Cholesky
├── Dense
…
├── src
│ ├── Cholesky
│ │ ├── LDLT.h
│ │ ├── LLT.h
│ │ └── LLT_MKL.h
The top-level files e.g. Eigen/Array, Eigen/Dense etc. are what is typically used in #include statements, but are ignored by gradle. Here is a build.gradle snippet that tried to add the top-level as exportedHeaders:
model {
components {
eigen(NativeLibrarySpec) {
sources.cpp {
exportedHeaders {
srcDir "Eigen"
include "**/*"
}
}
}
stellarEvolution(NativeLibrarySpec) {
sources.cpp {
lib library: "alglib"
source {
srcDir "StellarEvolution"
include "**/*.cpp"
}
exportedHeaders {
srcDir "StellarEvolution"
}
}
}
}
}
This, however, does not result in the Eigen directory added to the header search path when compiling StellarEvolution. I based my build.gradle on: gradle-3.1/samples/native-binaries/cpp, which seems to work, hence my assumption that the extension free header files are the problem.
I tried to find examples of how to do this but failed. Could someone help?