ReadMe.md
1Qt: 3D Viewer (C++|QtQuick|QML) {#samples_qml_android_occt}
2==================
3
4This sample demonstrates a simple way of using OCCT libraries in Android application written using Qt/Qml.
5The sample could be found within OCCT repository in folder `/samples/qt/AndroidQt/`.
6
7The connection between Qt/Qml and OCCT (C++) level is provided by proxy library, libAndroidQt.so, written in C++.
8The proxy library contains single C++ class AndroidQt encapsulating OCCT viewer and providing functionality to manipulate this viewer
9and to import OCCT shapes from supported format of CAD file (BREP).
10
11@figure{samples_qml_android_occt.jpg}
12
13Requirements for building sample:
14* Java Development Kit 1.7 or higher
15* Qt 5.3 or higher
16* Android SDK from 2014.07.02 or newer
17* Android NDK r9d or newer
18* Apache Ant 1.9.4 or higher
19* OCCT compiled under Android platform and placed in directories:
20 * occt/libs/armeabi-v7a/\*.so and occt/inc/\*.hxx (libraries and include files of OCCT install)
21 * android/assets/opencascade/shared/Shaders/\* (Shaders folder of OCCT install: /share/opencascade/resources/Shaders)
22 * 3rdparty/include/freetype2/\*, 3rdparty/include/FreeImage.h and 3rdparty/libs/armeabi-v7a/libFreeImage.so and 3rdparty/libs/armeabi-v7a/libfreetype.so
23
24It is also possible to to correct OCCT.pri file an get resources from another tree of directories.
25
26When AndroidQt will be started, it may be helpful to have some default data files(BRep) on Device for opening in AndroidQt.
27Copy these files into "android\assets\opencascade\shared" and it will be installed to device during compilation procedure.
28
29Having prepared all these products, configure AndroidQt project for building sample:
30
31In QtCreator, open AndroidQt.pro project-file:
32~~~~
33 File -> Open file or Project...
34~~~~
35
36Specify Android configurations:
37~~~~
38Tools->Options->Android
39~~~~
40* In JDK location specify path to Java Development Kit
41* In Android SDK location specify path to Android SDK
42* In Android NDK location specify path to Android NDK
43(During this location definition, warning is possible and OK:
44 "Qt version for architecture mips is missing. To add the Qt version, select Options > Build & Run > Qt Versins.")
45* In Ant executable specify path to ant.bat file located in Apache Ant bin directory
46
47Make sure that "Android for armeabi-v7a" kit has been detected (present in the list).
48~~~~
49Tools->Options->Build & Run
50~~~~
51
52also or it can be checked or corrected in:
53~~~~
54Projects->Android for armeabi-v7a option should be checked
55~~~~
56
57Switch On device, connect it to PC and define it in Qt Creator:
58~~~~
59Projects->Manage Kits...->Devices->Device: Run on Android
60~~~~
61Check that "Current state" is "Ready to use" on this page.
62
63~~~~
64Projects->Build Settings->General: Shadow build is switched OFF
65~~~~
66
67Start configuration:
68
69~~~~
70Call Build -> Run qmake
71~~~~
72Check content of "Compile Output" view.
73
74In order to perform qmake correctly, for example if you have the following error:
75~~~~
76Running steps for project AndroidQt...
77Could not start process "<qt_dir>\android_armv7\bin\qmake.exe" <occt_dir>\samples\qt\AndroidQt\AndroidQt.pro -r -spec android-g++ "CONFIG+=debug" "CONFIG+=declarative_debug" "CONFIG+=qml_debug"
78Error while building/deploying project AndroidQt (kit: Android for armeabi-v7a (GCC 4.9, Qt 5.3.2))
79When executing step "qmake"
80~~~~
81
82~~~~
83Projects->Build Settings->General: switch OFF Shadow build
84Build->Build Project "Android Qt"
85Build->Run
86~~~~
87
88Dialog to "Select Android Device" is shown. Select Compatible Device, Ok.
89In case of any error, see log in "Application Output" view.
90
91After successful build the application can be deployed to device or emulator.
92