Native: 3rd Party Library Versioning

First, let me say I did find this, and it’s a good start

Unfortunately, I don’t see a way to verfiy the version of the library found. I’m looking for the same kind of functionality provided by CMake’s find_package function, where I can specify a package and version number.

Also, just a generic comment: it would be helpful if Gradle implemented function to replicate this quite verbose logic:

def os = targetPlatform.operatingSystem
def baseDir = "3rd-party-lib/util/build/binaries/utilSharedLibrary/${buildType.name}"
if (os.windows) {
    // Windows uses a .dll file, with a different link file if it exists (not Cygwin or MinGW)
    sharedLibraryFile = file("${baseDir}/util.dll")
    if (file("${baseDir}/util.lib").exists()) {
        sharedLibraryLinkFile = file("${baseDir}/util.lib")
    }
} else if (os.macOsX) {
    sharedLibraryFile = file("${baseDir}/libhello.dylib")
} else {
    sharedLibraryFile = file("${baseDir}/libutil.so")
}

We don’t currently support resolving native dependencies from an external repository (or a filesystem), so Prebuilt libraries is necessarily verbose right now. It’s in the plan to support variant aware dependency resolution after we have dependency management working for JVM components in the software component model.

[quote=“sterling, post:2, topic:11572, full:true”]
We don’t currently support resolving native dependencies from an external repository (or a filesystem), so Prebuilt libraries is necessarily verbose right now[/quote]

A repository will be an incredible addition to the C/C++ community, and I eagerly await that. In the meantime, I was hoping for simply being able to read something like a version.txt file or parse the output of qmake --version or do whatever is required to determine the version for a particular installation of a dependency.

I imagine support for automatic native dependency resolution is quite a ways out. Is there any chance for some temporary solution to make importing 3rd party libs a bit easier (aka, less verbose)? I see that Gradle supports defining custom functions, so that is certainly one option, but I would hope it could be implemented natively in Gradle rather than having to import/define it in every project.

We’ve talked about having a “standard” layout for prebuilt libraries (e.g., something like: libs/[name]/[version]/[name]-[buildType]-[platform].[ext]) that we would assume unless configured differently. That would cut down on the boilerplate.

That’d be fantastic. I like the format you’ve come up with, and the possibility that it could be modified for non-conforming libs.