[vtkusers] Linking Android library with Gradle that depends on VTK 7.0

Brian Miller b1.miller at samsung.com
Thu Aug 11 20:03:04 EDT 2016


FYI:


We got past another one of the hurdles we were facing here.


One of my colleagues found out how to build an Android app (MyApp.apk)

with dependency on VTK 7.0 libraries.


It turns out that the order of VTK libraries matters and is the opposite of the way

we had initially assumed, with common libraries listed last instead of first.


So we now have something like this in our build.gradle file:


...


        ndk {
            moduleName "myLibraryName"
            cppFlags.add("-std=c++11")
            cppFlags.add("-fexceptions")
            cppFlags.add("-frtti")
            cppFlags.add("-I${OTHER_INCLUDE_DIR}".toString())
            cppFlags.add("-I${VTK_INCLUDE_DIR}".toString())

            ldLibs.addAll(["dl", "log", "z", "android", "EGL", "GLESv2"])
            stl "gnustl_shared"
        }


        productFlavors {
            create("arm64-v8a") {
                ndk {
                    abiFilters.add("arm64-v8a")
                    ldFlags.add("-L${OTHER_LIB_DIR}".toString())
                    ldLibs.add("other")
                    ldFlags.add("-L${VTK_LIB_DIR}".toString())
                    ldLibs.add("vtkRenderingOpenGL2-7.0")
                    ldLibs.add("vtkglew-7.0")
                    ldLibs.add("vtkImagingHybrid-7.0")
                    ldLibs.add("vtkRenderingFreeType-7.0")
                    ldLibs.add("vtkfreetype-7.0")
                    ldLibs.add("vtkIOGeometry-7.0")
                    ldLibs.add("vtkIOCore-7.0")
                    ldLibs.add("vtkIOImage-7.0")
                    ldLibs.add("vtkzlib-7.0")
                    ldLibs.add("vtkDICOMParser-7.0")
                    ldLibs.add("vtkmetaio-7.0")
                    ldLibs.add("vtktiff-7.0")
                    ldLibs.add("vtkpng-7.0")
                    ldLibs.add("vtkjpeg-7.0")
                    ldLibs.add("vtkCommonComputationalGeometry-7.0")
                    ldLibs.add("vtkRenderingCore-7.0")
                    ldLibs.add("vtkFiltersCore-7.0")
                    ldLibs.add("vtkFiltersGeneral-7.0")
                    ldLibs.add("vtkFiltersExtraction-7.0")
                    ldLibs.add("vtkFiltersStatistics-7.0")
                    ldLibs.add("vtkalglib-7.0")
                    ldLibs.add("vtkImagingFourier-7.0")

                    ldLibs.add("vtkImagingCore-7.0")
                    ldLibs.add("vtkFiltersSources-7.0")
                    ldLibs.add("vtkFiltersGeometry-7.0")
                    ldLibs.add("vtkCommonColor-7.0")
                    ldLibs.add("vtkCommonTransforms-7.0")
                    ldLibs.add("vtkCommonSystem-7.0")
                    ldLibs.add("vtkCommonMath-7.0")
                    ldLibs.add("vtkCommonExecutionModel-7.0")
                    ldLibs.add("vtkCommonDataModel-7.0")
                    ldLibs.add("vtkCommonMisc-7.0")
                    ldLibs.add("vtkCommonCore-7.0")
                    ldLibs.add("vtksys-7.0")
                }
            }

...


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20160812/8711370f/attachment.html>


More information about the vtkusers mailing list