<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Word 14 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
pre
        {mso-style-priority:99;
        mso-style-link:"HTML Preformatted Char";
        margin:0cm;
        margin-bottom:.0001pt;
        font-size:10.0pt;
        font-family:"Courier New";}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
span.HTMLPreformattedChar
        {mso-style-name:"HTML Preformatted Char";
        mso-style-priority:99;
        mso-style-link:"HTML Preformatted";
        font-family:"Courier New";}
.MsoChpDefault
        {mso-style-type:export-only;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal">Hello,<o:p></o:p></p>
<p class="MsoNormal">I am trying to integrate VTK 8.1 in a Java application. Base example is the JavaVTK example using gradle.<o:p></o:p></p>
<p class="MsoNormal">The only change compared to the original one is that I am using gradle as build system with CMake. The VTK libraries are prebuilt static libraries.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">I compiled the libraries separately on my system and put them in the jniLibs directory.<o:p></o:p></p>
<p class="MsoNormal">I am able to compile and run the APK on my device (Android 7.0)<o:p></o:p></p>
<p class="MsoNormal">But VTK is crashing on the first native call : <i>vtkRenderWindow *renWin = vtkRenderWindow::New();<o:p></o:p></i></p>
<p class="MsoNormal">I was able to track it to a call to vtkAtomic call<o:p></o:p></p>
<p class="MsoNormal">Unfortunately I am unable to debug correctly in C++ on my installation.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Hereunder is my CmakeLists for info<o:p></o:p></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white"><span style="font-size:9.0pt;font-family:"Courier New";color:black"><o:p> </o:p></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white"><span style="color:black">Could somebody help me ? I am probably doing something wrong.<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white"><span style="color:black">Thanks,<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white"><span style="color:black">Benoit Callebaut<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white"><span style="font-size:9.0pt;font-family:"Courier New";color:black"># For more information about using CMake with Android Studio, read the<br>
# documentation: https://d.android.com/studio/projects/add-native-code.html<br>
<br>
# Sets the minimum version of CMake required to build the native library.<br>
<br>
cmake_minimum_required(VERSION 3.4.1)<br>
<br>
# Creates and names a library, sets it as either STATIC<br>
# or SHARED, and provides the relative paths to its source code.<br>
# You can define multiple libraries, and CMake builds them for you.<br>
# Gradle automatically packages shared libraries with your APK.<br>
<br>
set(JNIBASE ${CMAKE_CURRENT_SOURCE_DIR}/src/main/jniLibs/armeabi-v7a)<br>
<br>
add_library( # Sets the name of the library.<br>
             native-lib<br>
<br>
             # Sets the library as a shared library.<br>
             SHARED<br>
<br>
             # Provides a relative path to your source file(s).<br>
             src/main/cpp/native-lib.cpp )<br>
<br>
# Searches for a specified prebuilt library and stores the path as a<br>
# variable. Because CMake includes system libraries in the search path by<br>
# default, you only need to specify the name of the public NDK library<br>
# you want to add. CMake verifies that the library exists before<br>
# completing its build.<br>
find_library( # Sets the name of the path variable.<br>
              log-lib<br>
<br>
              # Specifies the name of the NDK library that<br>
              # you want CMake to locate.<br>
              log )<br>
find_library( # Sets the name of the path variable.<br>
              dl<br>
<br>
              # Specifies the name of the NDK library that<br>
              # you want CMake to locate.<br>
              dl )<br>
find_library( # Sets the name of the path variable.<br>
              z<br>
<br>
              # Specifies the name of the NDK library that<br>
              # you want CMake to locate.<br>
              z )<br>
find_library( # Sets the name of the path variable.<br>
              android<br>
<br>
              # Specifies the name of the NDK library that<br>
              # you want CMake to locate.<br>
              android )<br>
find_library( # Sets the name of the path variable.<br>
              EGL<br>
<br>
              # Specifies the name of the NDK library that<br>
              # you want CMake to locate.<br>
              EGL )<br>
find_library( # Sets the name of the path variable.<br>
              GLESv2<br>
<br>
              # Specifies the name of the NDK library that<br>
              # you want CMake to locate.<br>
              GLESv2 )<br>
<br>
<br>
# Specifies libraries CMake should link to your target library. You<br>
# can link multiple libraries, such as libraries you define in this<br>
# build script, prebuilt third-party libraries, or system libraries.<br>
<br>
add_library( vtkalglib-8.1 STATIC IMPORTED )<br>
set_target_properties(vtkalglib-8.1 PROPERTIES IMPORTED_LOCATION ${JNIBASE}/libvtkalglib-8.1.a)<br>
add_library( vtkCommonColor-8.1 STATIC IMPORTED )<br>
set_target_properties(vtkCommonColor-8.1 PROPERTIES IMPORTED_LOCATION ${JNIBASE}/libvtkCommonColor-8.1.a)<br>
add_library( vtkComputationalGeometry-8.1 STATIC IMPORTED )<br>
set_target_properties(vtkComputationalGeometry-8.1 PROPERTIES IMPORTED_LOCATION ${JNIBASE}/libvtkCommonComputationalGeometry-8.1.a)<br>
add_library( vtkCommonCore-8.1 STATIC IMPORTED )<br>
set_target_properties(vtkCommonCore-8.1 PROPERTIES IMPORTED_LOCATION ${JNIBASE}/libvtkCommonCore-8.1.a)<br>
add_library( vtkCommonDataModel-8.1 STATIC IMPORTED )<br>
set_target_properties(vtkCommonDataModel-8.1 PROPERTIES IMPORTED_LOCATION ${JNIBASE}/libvtkCommonDataModel-8.1.a)<br>
add_library( vtkCommonExecutionModel-8.1 STATIC IMPORTED )<br>
set_target_properties(vtkCommonExecutionModel-8.1 PROPERTIES IMPORTED_LOCATION ${JNIBASE}/libvtkCommonExecutionModel-8.1.a)<br>
add_library( vtkCommonMath-8.1 STATIC IMPORTED )<br>
set_target_properties(vtkCommonMath-8.1 PROPERTIES IMPORTED_LOCATION ${JNIBASE}/libvtkCommonMath-8.1.a)<br>
add_library( vtkCommonMisc-8.1 STATIC IMPORTED )<br>
set_target_properties(vtkCommonMisc-8.1 PROPERTIES IMPORTED_LOCATION ${JNIBASE}/libvtkCommonMisc-8.1.a)<br>
add_library( vtkCommonSystem-8.1 STATIC IMPORTED )<br>
set_target_properties(vtkCommonSystem-8.1 PROPERTIES IMPORTED_LOCATION ${JNIBASE}/libvtkCommonsystem-8.1.a)<br>
add_library( vtkCommonTransforms-8.1 STATIC IMPORTED )<br>
set_target_properties(vtkCommonTransforms-8.1 PROPERTIES IMPORTED_LOCATION ${JNIBASE}/libvtkCommonTransforms-8.1.a)<br>
add_library( vtkDICOMParser-8.1 STATIC IMPORTED )<br>
set_target_properties(vtkDICOMParser-8.1 PROPERTIES IMPORTED_LOCATION ${JNIBASE}/libvtkDICOMParser-8.1.a)<br>
add_library( vtkexpat-8.1 STATIC IMPORTED )<br>
set_target_properties(vtkexpat-8.1 PROPERTIES IMPORTED_LOCATION ${JNIBASE}/libvtkexpat-8.1.a)<br>
add_library( vtkFiltersCore-8.1 STATIC IMPORTED )<br>
set_target_properties(vtkFiltersCore-8.1 PROPERTIES IMPORTED_LOCATION ${JNIBASE}/libvtkFiltersCore-8.1.a)<br>
add_library( vtkFiltersExtraction-8.1 STATIC IMPORTED )<br>
set_target_properties(vtkFiltersExtraction-8.1 PROPERTIES IMPORTED_LOCATION ${JNIBASE}/libvtkFiltersExtraction-8.1.a)<br>
add_library( vtkFiltersGeneral-8.1 STATIC IMPORTED )<br>
set_target_properties(vtkFiltersGeneral-8.1 PROPERTIES IMPORTED_LOCATION ${JNIBASE}/libvtkFiltersGeneral-8.1.a)<br>
add_library( vtkFiltersGeometry-8.1 STATIC IMPORTED )<br>
set_target_properties(vtkFiltersGeometry-8.1 PROPERTIES IMPORTED_LOCATION ${JNIBASE}/libvtkFiltersGeometry-8.1.a)<br>
add_library( vtkFiltersModeling-8.1 STATIC IMPORTED )<br>
set_target_properties(vtkFiltersModeling-8.1 PROPERTIES IMPORTED_LOCATION ${JNIBASE}/libvtkFiltersModeling-8.1.a)<br>
add_library( vtkFiltersSources-8.1 STATIC IMPORTED )<br>
set_target_properties(vtkFiltersSources-8.1 PROPERTIES IMPORTED_LOCATION ${JNIBASE}/libvtkFiltersSources-8.1.a)<br>
add_library( vtkFiltersStatistics-8.1 STATIC IMPORTED )<br>
set_target_properties(vtkFiltersStatistics-8.1 PROPERTIES IMPORTED_LOCATION ${JNIBASE}/libvtkFiltersStatistics-8.1.a)<br>
add_library( vtkfreetype-8.1 STATIC IMPORTED )<br>
set_target_properties(vtkfreetype-8.1 PROPERTIES IMPORTED_LOCATION ${JNIBASE}/libvtkfreetype-8.1.a)<br>
add_library( vtkImagingCore-8.1 STATIC IMPORTED )<br>
set_target_properties(vtkImagingCore-8.1 PROPERTIES IMPORTED_LOCATION ${JNIBASE}/libvtkImagingCore-8.1.a)<br>
add_library( vtkImagingFourier-8.1 STATIC IMPORTED )<br>
set_target_properties(vtkImagingFourier-8.1 PROPERTIES IMPORTED_LOCATION ${JNIBASE}/libvtkImagingFourier-8.1.a)<br>
add_library( vtkImagingMath-8.1 STATIC IMPORTED )<br>
set_target_properties(vtkImagingMath-8.1 PROPERTIES IMPORTED_LOCATION ${JNIBASE}/libvtkImagingMath-8.1.a)<br>
add_library( vtkInfovisCore-8.1 STATIC IMPORTED )<br>
set_target_properties(vtkInfovisCore-8.1 PROPERTIES IMPORTED_LOCATION ${JNIBASE}/libvtkInfovisCore-8.1.a)<br>
add_library( vtkInteractionStyle-8.1 STATIC IMPORTED )<br>
set_target_properties(vtkInteractionStyle-8.1 PROPERTIES IMPORTED_LOCATION ${JNIBASE}/libvtkInteractionStyle-8.1.a)<br>
add_library( vtkIOCore-8.1 STATIC IMPORTED )<br>
set_target_properties(vtkIOCore-8.1 PROPERTIES IMPORTED_LOCATION ${JNIBASE}/libvtkIOCore-8.1.a)<br>
add_library( vtkIOGeometry-8.1 STATIC IMPORTED )<br>
set_target_properties(vtkIOGeometry-8.1 PROPERTIES IMPORTED_LOCATION ${JNIBASE}/libvtkIOGeometry-8.1.a)<br>
add_library( vtkIOImage-8.1 STATIC IMPORTED )<br>
set_target_properties(vtkIOImage-8.1 PROPERTIES IMPORTED_LOCATION ${JNIBASE}/libvtkIOImage-8.1.a)<br>
add_library( vtkIOInfovis-8.1 STATIC IMPORTED )<br>
set_target_properties(vtkIOInfovis-8.1 PROPERTIES IMPORTED_LOCATION ${JNIBASE}/libvtkIOInfovis-8.1.a)<br>
add_library( vtkIOLegacy-8.1 STATIC IMPORTED )<br>
set_target_properties(vtkIOLegacy-8.1 PROPERTIES IMPORTED_LOCATION ${JNIBASE}/libvtkIOLegacy-8.1.a)<br>
add_library( vtkIOPLY-8.1 STATIC IMPORTED )<br>
set_target_properties(vtkIOPLY-8.1 PROPERTIES IMPORTED_LOCATION ${JNIBASE}/libvtkIOPLY-8.1.a)<br>
add_library( vtkRenderingPLY-8.1 STATIC IMPORTED )<br>
add_library( vtkIOXML-8.1 STATIC IMPORTED )<br>
set_target_properties(vtkIOXML-8.1 PROPERTIES IMPORTED_LOCATION ${JNIBASE}/libvtkIOXML-8.1.a)<br>
add_library( vtkIOXMLParser-8.1 STATIC IMPORTED )<br>
set_target_properties(vtkIOXMLParser-8.1 PROPERTIES IMPORTED_LOCATION ${JNIBASE}/libvtkIOXMLParser-8.1.a)<br>
add_library( vtkjpeg-8.1 STATIC IMPORTED )<br>
set_target_properties(vtkjpeg-8.1 PROPERTIES IMPORTED_LOCATION ${JNIBASE}/libvtkjpeg-8.1.a)<br>
add_library( vtklibxml2-8.1 STATIC IMPORTED )<br>
set_target_properties(vtklibxml2-8.1 PROPERTIES IMPORTED_LOCATION ${JNIBASE}/libvtklibxml2-8.1.a)<br>
add_library( vtklz4-8.1 STATIC IMPORTED )<br>
set_target_properties(vtklz4-8.1 PROPERTIES IMPORTED_LOCATION ${JNIBASE}/libvtklz4-8.1.a)<br>
add_library( vtkmetaio-8.1 STATIC IMPORTED )<br>
set_target_properties(vtkmetaio-8.1 PROPERTIES IMPORTED_LOCATION ${JNIBASE}/libvtkmetaio-8.1.a)<br>
add_library( vtkParallelCore-8.1 STATIC IMPORTED )<br>
set_target_properties(vtkParallelCore-8.1 PROPERTIES IMPORTED_LOCATION ${JNIBASE}/libvtkParallelCore-8.1.a)<br>
add_library( vtkpng-8.1 STATIC IMPORTED )<br>
set_target_properties(vtkpng-8.1 PROPERTIES IMPORTED_LOCATION ${JNIBASE}/libvtkpng-8.1.a)<br>
add_library( vtkRenderingCore-8.1 STATIC IMPORTED )<br>
set_target_properties(vtkRenderingCore-8.1 PROPERTIES IMPORTED_LOCATION ${JNIBASE}/libvtkRenderingCore-8.1.a)<br>
add_library( vtkRenderingFreeType-8.1 STATIC IMPORTED )<br>
set_target_properties(vtkRenderingFreeType-8.1 PROPERTIES IMPORTED_LOCATION ${JNIBASE}/libvtkRenderingFreeType-8.1.a)<br>
add_library( vtkRenderingOpenGL2-8.1 STATIC IMPORTED )<br>
set_target_properties(vtkRenderingOpenGL2-8.1 PROPERTIES IMPORTED_LOCATION ${JNIBASE}/libvtkRenderingOpenGL2-8.1.a)<br>
add_library( vtkRenderingVolume-8.1 STATIC IMPORTED )<br>
set_target_properties(vtkRenderingVolume-8.1 PROPERTIES IMPORTED_LOCATION ${JNIBASE}/libvtkRenderingVolume-8.1.a)<br>
add_library( vtkRenderingVolumeOpenGL2-8.1 STATIC IMPORTED )<br>
set_target_properties(vtkRenderingVolumeOpenGL2-8.1 PROPERTIES IMPORTED_LOCATION ${JNIBASE}/libvtkRenderingVolumeOpenGL2-8.1.a)<br>
add_library( vtkglew-8.1 STATIC IMPORTED )<br>
set_target_properties(vtkglew-8.1 PROPERTIES IMPORTED_LOCATION ${JNIBASE}/libvtkglew-8.1.a)<br>
add_library( vtksys-8.1 STATIC IMPORTED )<br>
set_target_properties(vtksys-8.1 PROPERTIES IMPORTED_LOCATION ${JNIBASE}/libvtksys-8.1.a)<br>
add_library( vtkTestingRendering-8.1 STATIC IMPORTED )<br>
set_target_properties(vtkTestingRendering-8.1 PROPERTIES IMPORTED_LOCATION ${JNIBASE}/libvtkTestingRendering-8.1.a)<br>
add_library( vtktiff-8.1 STATIC IMPORTED )<br>
set_target_properties(vtktiff-8.1 PROPERTIES IMPORTED_LOCATION ${JNIBASE}/libvtktiff-8.1.a)<br>
add_library( vtkzlib-8.1 STATIC IMPORTED )<br>
set_target_properties(vtkzlib-8.1 PROPERTIES IMPORTED_LOCATION ${JNIBASE}/libvtkzlib-8.1.a)<br>
<br>
<br>
<br>
target_link_libraries(<br>
            native-lib<br>
<br>
            vtkCommonMath-8.1<br>
            vtkRenderingCore-8.1<br>
            vtkCommonMath-8.1<br>
            vtkCommonTransforms-8.1<br>
            vtkImagingCore-8.1<br>
            vtkFiltersCore-8.1<br>
            vtkFiltersSources-8.1<br>
            vtkRenderingOpenGL2-8.1<br>
            vtkRenderingCore-8.1<br>
            vtkFiltersGeneral-8.1<br>
            vtkCommonExecutionModel-8.1<br>
            vtkCommonDataModel-8.1<br>
            vtkCommonMath-8.1<br>
            vtkCommonCore-8.1<br>
            vtkCommonMisc-8.1<br>
<br>
            vtksys-8.1<br>
            vtkCommonColor-8.1<br>
            vtkCommonSystem-8.1<br>
<br>
           # included in the NDK.<br>
           ${dl}<br>
           ${z}<br>
           ${android}<br>
           ${EGL}<br>
           ${GLSESv2}<br>
           ${log-lib}<br>
   )<br>
<br>
include_directories(native-lib PUBLIC   ${CMAKE_CURRENT_SOURCE_DIR}/src/main/cpp)<br>
include_directories(native-lib PUBLIC   ${CMAKE_CURRENT_SOURCE_DIR}/src/main/cpp/vtk-8.1)<br>
include_directories(native-lib PUBLIC   ${CMAKE_CURRENT_SOURCE_DIR}/src/main/cpp/vtk-8.1/vtklibxml2/libxml)<br>
include_directories(native-lib PUBLIC   ${CMAKE_CURRENT_SOURCE_DIR}/src/main/cpp/vtk-8.1/vtkzlib)<br>
include_directories(native-lib PUBLIC   ${CMAKE_CURRENT_SOURCE_DIR}/src/main/cpp/vtk-8.1/vtklz4)<o:p></o:p></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><o:p></o:p></p>
</div>
<br>
<font face="Verdana" color="Black" size="1">*********************************************************************************************<br>
Worldline SA/NV - Chaussee de Haecht 1442 Haachtsesteenweg<br>
- 1130 Brussels - Belgium<br>
RPM-RPR Bruxelles-Brussel - TVA-BTW BE 0418.547.872<br>
Bankrekening-Compte Bancaire-Bank Account 310-0269424-44<br>
BIC BBRUBEBB - IBAN BE55 3100 2694 2444<br>
<br>
"The information contained in this e-mail and any attachment there to be confidential and may contain information which is protected by intellectual property rights.<br>
This information is intended for the exclusive use of the recipient(s) named above.<br>
This e-mail does not constitute any binding relationship or offer toward any of the addressees.<br>
If you are not one of the addressees , one of their employees or a proxy holder entitled to hand over this message to the addressee(s), any use of the information contained herein (e.g. reproduction, divulgation, communication or distribution,...) is prohibited.<br>
If you have received this message in error, please notify the sender and destroy it immediately after.<br>
The integrity and security of this message cannot be guaranteed and it may be subject to data corruption, interception and unauthorized amendment, for which we accept no liability."<br>
</font>
</body>
</html>