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