5408efff6841c4be58c2576905e4ebfb63ba9e95
[occt.git] / dox / dev_guides / building / android / android.md
1 Building with CMake and ADT for Android {#occt_dev_guides__building_android}
2 ===================
3
4 @tableofcontents
5
6 This file describes the steps to build OCCT libraries from a complete source package
7 with following tools:
8   - Generation of eclipse project files
9     - CMake v3.0+ http://www.cmake.org/cmake/resources/software.html
10     - Cross-compilation toolchain for CMake https://github.com/taka-no-me/android-cmake
11     - Android NDK rev.10+ https://developer.android.com/tools/sdk/ndk/index.html
12     - Make: MinGW v4.82+ for Windows, GNU Make vXX for Linux. http://sourceforge.net/projects/mingw/files/
13   - Building eclipse project files of OCCT
14     - Android Developer Tools (ADT) v22+ https://developer.android.com/sdk/index.html
15
16 ## Generation of eclipse project files
17 Run GUI tool provided by CMake: cmake-gui
18
19 ### Tools configuration
20   - Specify the root folder of OCCT (<i>$CASROOT</i>, which contains *CMakelists.txt* file) by clicking **Browse Source**.
21   - Specify the location (build folder) for Cmake generated project files by clicking **Browse Build**.
22
23 @figure{/dev_guides/building/android/images/android_image001.png}
24
25 Click **Configure** button. It opens the window with a drop-down list of generators supported by CMake project. - 
26
27 Select "Eclipse CDT4 - MinGW MakeFiles" item from the list
28   - Choose "Specify toolchain file for cross-compiling"
29   - Click "Next"
30 @figure{/dev_guides/building/android/images/android_image002.png}
31   - Specify the Toolchain file at next dialog by android.toolchain.cmake is contained by cross-compilation toolchain for CMake
32   - Click "Finish"
33 @figure{/dev_guides/building/android/images/android_image003.png}
34
35 Add cache entry ANDROID_NDK - path (entry type is PATH) to the NDK folder ("Add Entry" button)
36 @figure{/dev_guides/building/android/images/android_image004.png}
37
38 if there is message "CMake Error: CMake was unable to find a build program corresponding to "MinGW Makefiles".  CMAKE_MAKE_PROGRAM is not set.  You probably need to select a different build tool."  
39 Define CMAKE_MAKE_PROGRAM variable with the file path to mingw32-make executable. 
40 @figure{/dev_guides/building/android/images/android_image005.png}
41
42 ### OCCT Configuration
43
44 How to configure OCCT, see "OCCT Configuration" section of @ref occt_dev_guides__building_cmake "Building with CMake"
45 taking into account the specific configuration variables for android:
46   - ANDROID_ABI = armeabi-v7a
47   - ANDROID_NATIVE_API_LEVEL = 15
48   - ANDROID_NDK_LAYOUT is equal to BUILD_CONFIGURATION variable 
49   - CMAKE_ECLIPSE_VERSION is equal to installed eclipse version (e.g., 4.2)
50
51 Configure parallel building:
52   - CMAKE_ECLIPSE_MAKE_ARGUMENTS = -jN where N = your numbers of CPU cores (threads)
53
54 @figure{/dev_guides/building/android/images/android_image006.png}
55
56 ### Generation of eclipse projects files
57
58 Click **Generate** button and wait until the generation process is finished. 
59 Then the eclipse project files will appear in the build folder (e.g. <i> D:/android-build-eclipse-api-15 </i>).
60
61 ## Building eclipse project files of OCCT
62
63   - Open eclipse (downloaded ADT bundle contains it)
64   @figure{/dev_guides/building/android/images/android_image007.png}
65   - Import "Existing project into Workspace"
66   @figure{/dev_guides/building/android/images/android_image008.png}
67   @figure{/dev_guides/building/android/images/android_image009.png}
68   - Build ALL
69   @figure{/dev_guides/building/android/images/android_image010.png}
70   
71 When the building process has finished, libraries are located in \<build folder\>/out (e.g. <i> D:/android-build-eclipse-api-15/out </i>).