I am attempting to integrate OpenCV into the Android.mk file of one of my projects and am running into severe difficulties there.
Our build policies mandate that all external libraries are to be built from source. Besides, it's good practice to do so.
In any case, I would naively *expect* to have to do something along the lines of the following steps:
1. clone the OpenCV repository (in my case **git clone https://github.com/Itseez/opencv.git 3.0.0**, or alternatively using tag **2.4.11**),
2. locate a maintained Android.mk file that I can reference from my Android.mk,
3. call ndk-build using my own Android.mk.
4. The architectures to build (as well as the standard library to use) are then determined by the contents of my Application.mk.
This seems to be not the case, as I could not find a suitable Android.mk file in the source distribution. The [official documentation](http://docs.opencv.org/2.4/doc/tutorials/introduction/android_binary_package/dev_with_OCV_on_Android.html#native-c) refers to an OpenCV.mk file which simply does not exist in this source distribution. Also, the include directories seem to be scattered around the module directories, making it difficult to refer to exactly one base include directory. (This seems to be a questionable design decision.)
There appears to be an official "SDK" for Android, which only distributes some binary files, i.e. that is not a complete source distribution. It is unclear to me how to build **exactly** this SDK distribution from the source distribution.
I have found [this unmaintained page](http://code.opencv.org/projects/opencv/wiki/Building_OpenCV4Android_from_trunk) ("Building OpenCV4Android from trunk"), which seems to explain exactly this step, and I can successfully complete all the steps described there in the section 'Linux (Ubuntu) and Mac OS (10.6.7)'. But:
- the resulting *build_android_arm* directory is far from identical with the downloadable "SDK" distribution;
- it seems that only libraries for armeabi-v7a are being built (I need armeabi-v7a-hard, armv8, x86 and x86_64)
- there is still no ready-to-use include directory.
My questions are the following:
1. How can I build OpenCV static libraries for all my required architectures, without resorting to hacks like string changes in the CMake cache?
2. How can I get a distribution-ready include directory?
3. After solving 1. and 2., is the generated OpenCV.mk file inside the build_android_arm folder ready to use? Does it apply to all build architectures?
Thanks for any help!
↧