Many of the libraries we have are organized with myLib for C and myLib++ for C++. We cannot convert/rename this scheme.
Directory structure: src/myLib src/myLib/c src/myLib/headers src/myLib++ src/myLib++/cpp src/myLib++/headers
As using “++” in library name does not seem to work and I have to work around it by supplying a different source directory.
My build.gradle script:
apply plugin: 'c'
apply plugin: 'cpp'
model {
platforms {
x64 {
architecture "x86_64"
}
}
toolChains {
gcc(Gcc) {}
}
components {
myLib(NativeLibrarySpec)
myLibCpp(NativeLibrarySpec) {
sources {
cpp {
source {
srcDir "src/myLib++"
include "**/*.cpp"
}
exportedHeaders {
srcDir "src/myLib++"
include "**/*.hpp"
}
}
}
}
}
}
However if I rename directory src/myLib++ to src/myLibCpp and remove sources from build.gradle and use the following libraries, then it works fine.
If I place the src/myLibCpp/cpp and src/myLibCpp/headers within src/myLib/ I have no problems building. However I only get a combined static and shared library for both C++ and C. build/binaries/myLibStaticLibrary/libMyLib.a build/binaries/myLibSharedLibrary/libMyLib.so
What I want is build/binaries/myLibStaticLibrary/libMyLib.a build/binaries/myLibStaticLibrary/libMyLib++.a build/binaries/myLibSharedLibrary/libMyLib.so build/binaries/myLibSharedLibrary/libMyLib++.so