user sees just dirs of libs, shared libs and headers of 3rdparty products documentation updated 3rdparty search priority was fixed: 1. user paths; 2. system paths 3rdparty debug usage fixed vtk search introduced occt information, generated by wok, was divided onto two files: occt_toolkits.cmake and occt_inc_toolkits.cmake additional behavior of cmake search for freetype 2.5.1 and above CMake (version < 3.0) don't know about new place of config/ftheader.h in freetype 2.5.1. There are cases when cmake seeks config/ftheader.h in defined place (3RDPARTY_FREETYPE_DIR variable), doesn't find it and start new search in system places. If system has own freetype header- cmake will find it and 3RDPARTY_FREETYPE* variables will point to different places. This situation is avoided tcl, freetype, vtk are checked before usage of it (CSF variables usage) tbb search mechanism was refactored freetype search is processed by default cmake mechanism tcl search is processed by default cmake mechanism 3rdparty macro seeks debug libraries (and release if debug ones aren't found); 3rdparty dll is sought in win case only ADD_SUBDIRECTORY preferred to SUBDIRS gendoc.bat search for tclsh.exe in user's system 0025141: CMake / MinGW: link recipe fails due to long command 0025146: Porting to Android OCCT documentation updated. "Building with CMake and ADT for Android" article added [CMAKE] custom.sh.in uses library variables instead unused dll ones. -DDEBUG remove from CMAKE_CXX_FLAGS_DEBUG and CMAKE_C_FLAGS_DEBUG hide unused 3rdparty in android case also messages of freetype search mechanism slightly updated
3.5 KiB
Building with CMake and ADT for Android
@tableofcontents
This file describes the steps to build OCCT libraries from a complete source package with following tools:
- Generation of eclipse project files
- CMake v3.0+ http://www.cmake.org/cmake/resources/software.html
- Cross-compilation toolchain for CMake https://github.com/taka-no-me/android-cmake
- Android NDK rev.10+ https://developer.android.com/tools/sdk/ndk/index.html
- Make: MinGW v4.82+ for Windows, GNU Make vXX for Linux. http://sourceforge.net/projects/mingw/files/
- Building eclipse project files of OCCT
- Android Developer Tools (ADT) v22+ https://developer.android.com/sdk/index.html
Generation of eclipse project files
Run GUI tool provided by CMake: cmake-gui
Tools configuration
- Specify the root folder of OCCT ($CASROOT, which contains CMakelists.txt file) by clicking Browse Source.
- Specify the location (build folder) for Cmake generated project files by clicking Browse Build.
@figure{/dev_guides/building/android/images/android_image001.png}
Click Configure button. It opens the window with a drop-down list of generators supported by CMake project. -
Select "Eclipse CDT4 - MinGW MakeFiles" item from the list
- Choose "Specify toolchain file for cross-compiling"
- Click "Next" @figure{/dev_guides/building/android/images/android_image002.png}
- Specify the Toolchain file at next dialog by android.toolchain.cmake is contained by cross-compilation toolchain for CMake
- Click "Finish" @figure{/dev_guides/building/android/images/android_image003.png}
Add cache entry ANDROID_NDK - path (entry type is PATH) to the NDK folder ("Add Entry" button) @figure{/dev_guides/building/android/images/android_image004.png}
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."
Define CMAKE_MAKE_PROGRAM variable with the file path to mingw32-make executable.
@figure{/dev_guides/building/android/images/android_image005.png}
OCCT Configuration
How to configure OCCT, see "OCCT Configuration" section of @ref occt_dev_guides__building_cmake "Building with CMake" taking into account the specific configuration variables for android:
- ANDROID_ABI = armeabi-v7a
- ANDROID_NATIVE_API_LEVEL = 15
- ANDROID_NDK_LAYOUT is equal to BUILD_CONFIGURATION variable
- CMAKE_ECLIPSE_VERSION is equal to installed eclipse version (e.g., 4.2)
Configure parallel building:
- CMAKE_ECLIPSE_MAKE_ARGUMENTS = -jN where N = your numbers of CPU cores (threads)
@figure{/dev_guides/building/android/images/android_image006.png}
Generation of eclipse projects files
Click Generate button and wait until the generation process is finished. Then the eclipse project files will appear in the build folder (e.g. D:/android-build-eclipse-api-15 ).
Building eclipse project files of OCCT
- Open eclipse (downloaded ADT bundle contains it) @figure{/dev_guides/building/android/images/android_image007.png}
- Import "Existing project into Workspace" @figure{/dev_guides/building/android/images/android_image008.png} @figure{/dev_guides/building/android/images/android_image009.png}
- Build ALL @figure{/dev_guides/building/android/images/android_image010.png}
When the building process has finished, libraries are located in <build folder>/out (e.g. D:/android-build-eclipse-api-15/out ).