adding cmake based android scripts and a reusable android library - samples to follow - haven't tested yet completely
This commit is contained in:
255
android/changes.diff
Normal file
255
android/changes.diff
Normal file
@@ -0,0 +1,255 @@
|
||||
Index: modules/highgui/CMakeLists.txt
|
||||
===================================================================
|
||||
--- modules/highgui/CMakeLists.txt (revision 3454)
|
||||
+++ modules/highgui/CMakeLists.txt (working copy)
|
||||
@@ -1,3 +1,21 @@
|
||||
+if(ANDROID)
|
||||
+
|
||||
+set(high_gui_android_srcs src/bitstrm.cpp
|
||||
+ src/cap.cpp
|
||||
+ src/grfmt_base.cpp
|
||||
+ src/grfmt_bmp.cpp
|
||||
+ src/grfmt_jpeg.cpp
|
||||
+ src/grfmt_png.cpp
|
||||
+ src/grfmt_tiff.cpp
|
||||
+ src/loadsave.cpp
|
||||
+ src/precomp.cpp
|
||||
+ src/utils.cpp
|
||||
+ src/grfmt_sunras.cpp
|
||||
+ src/grfmt_pxm.cpp
|
||||
+ src/window.cpp )
|
||||
+define_android_manual(highgui "${high_gui_android_srcs}" "$(LOCAL_PATH)/src $(OPENCV_INCLUDES)")
|
||||
+
|
||||
+else()
|
||||
# ----------------------------------------------------------------------------
|
||||
# CMake file for highgui. See root CMakeLists.txt
|
||||
# Some parts taken from version of Hartmut Seichter, HIT Lab NZ.
|
||||
@@ -332,3 +350,5 @@
|
||||
install(FILES ${highgui_ext_hdrs}
|
||||
DESTINATION include/opencv2/highgui
|
||||
COMPONENT main)
|
||||
+
|
||||
+endif()#android
|
||||
Index: modules/core/src/persistence.cpp
|
||||
===================================================================
|
||||
--- modules/core/src/persistence.cpp (revision 3454)
|
||||
+++ modules/core/src/persistence.cpp (working copy)
|
||||
@@ -114,12 +114,12 @@
|
||||
|
||||
namespace cv
|
||||
{
|
||||
-
|
||||
+#ifndef ANDROID
|
||||
string fromUtf16(const WString& str)
|
||||
{
|
||||
cv::AutoBuffer<char> _buf(str.size()*4 + 1);
|
||||
char* buf = _buf;
|
||||
-
|
||||
+
|
||||
size_t sz = wcstombs(buf, str.c_str(), str.size());
|
||||
if( sz == (size_t)-1 )
|
||||
return string();
|
||||
@@ -131,14 +131,14 @@
|
||||
{
|
||||
cv::AutoBuffer<wchar_t> _buf(str.size() + 1);
|
||||
wchar_t* buf = _buf;
|
||||
-
|
||||
+
|
||||
size_t sz = mbstowcs(buf, str.c_str(), str.size());
|
||||
if( sz == (size_t)-1 )
|
||||
return WString();
|
||||
buf[sz] = '\0';
|
||||
return WString(buf);
|
||||
}
|
||||
-
|
||||
+#endif
|
||||
}
|
||||
Index: modules/features2d/src/sift.cpp
|
||||
===================================================================
|
||||
--- modules/features2d/src/sift.cpp (revision 3454)
|
||||
+++ modules/features2d/src/sift.cpp (working copy)
|
||||
@@ -172,6 +172,7 @@
|
||||
typedef Keypoints::iterator KeypointsIter ; ///< Keypoint list iter datatype
|
||||
typedef Keypoints::const_iterator KeypointsConstIter ; ///< Keypoint list const iter datatype
|
||||
|
||||
+#undef _S
|
||||
/** @brief Constructors and destructors */
|
||||
/*@{*/
|
||||
Sift(const pixel_t* _im_pt, int _width, int _height,
|
||||
Index: modules/features2d/CMakeLists.txt
|
||||
===================================================================
|
||||
--- modules/features2d/CMakeLists.txt (revision 3454)
|
||||
+++ modules/features2d/CMakeLists.txt (working copy)
|
||||
@@ -1 +1,2 @@
|
||||
-define_opencv_module(features2d opencv_core opencv_imgproc opencv_calib3d opencv_highgui)
|
||||
\ No newline at end of file
|
||||
+define_opencv_module(features2d opencv_core opencv_imgproc opencv_calib3d opencv_highgui)
|
||||
+
|
||||
Index: modules/CMakeLists.txt
|
||||
===================================================================
|
||||
--- modules/CMakeLists.txt (revision 3454)
|
||||
+++ modules/CMakeLists.txt (working copy)
|
||||
@@ -1,3 +1,7 @@
|
||||
+if(ANDROID)
|
||||
+ configure_file("${CMAKE_SOURCE_DIR}/Android.mk.modules.in" "${CMAKE_CURRENT_BINARY_DIR}/Android.mk")
|
||||
+endif()
|
||||
+
|
||||
add_subdirectory(calib3d)
|
||||
add_subdirectory(core)
|
||||
add_subdirectory(features2d)
|
||||
@@ -20,8 +24,11 @@
|
||||
endif()
|
||||
|
||||
add_subdirectory(video)
|
||||
+
|
||||
+if(!ANDROID)
|
||||
add_subdirectory(haartraining)
|
||||
add_subdirectory(traincascade)
|
||||
+endif()
|
||||
|
||||
|
||||
#add_subdirectory(gpu)
|
||||
Index: 3rdparty/zlib/CMakeLists.txt
|
||||
===================================================================
|
||||
--- 3rdparty/zlib/CMakeLists.txt (revision 3503)
|
||||
+++ 3rdparty/zlib/CMakeLists.txt (working copy)
|
||||
@@ -35,3 +35,5 @@
|
||||
DEBUG_POSTFIX "${OPENCV_DEBUG_POSTFIX}"
|
||||
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/3rdparty/lib"
|
||||
)
|
||||
+
|
||||
+endif()
|
||||
Index: 3rdparty/lapack/CMakeLists.txt
|
||||
===================================================================
|
||||
--- 3rdparty/lapack/CMakeLists.txt (revision 3503)
|
||||
+++ 3rdparty/lapack/CMakeLists.txt (working copy)
|
||||
@@ -2,6 +2,10 @@
|
||||
# CMake file for opencv_lapack. See root CMakeLists.txt
|
||||
#
|
||||
# ----------------------------------------------------------------------------
|
||||
+if(ANDROID)
|
||||
+define_3rdparty_module(opencv_lapack)
|
||||
+else()
|
||||
+
|
||||
project(opencv_lapack)
|
||||
|
||||
# List of C++ files:
|
||||
@@ -57,3 +61,4 @@
|
||||
DEBUG_POSTFIX "${OPENCV_DEBUG_POSTFIX}"
|
||||
ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/3rdparty/lib
|
||||
)
|
||||
+endif() #android
|
||||
Index: 3rdparty/libjasper/CMakeLists.txt
|
||||
===================================================================
|
||||
--- 3rdparty/libjasper/CMakeLists.txt (revision 3503)
|
||||
+++ 3rdparty/libjasper/CMakeLists.txt (working copy)
|
||||
@@ -1,3 +1,8 @@
|
||||
+if(ANDROID)
|
||||
+define_3rdparty_module(jasper)
|
||||
+else()
|
||||
+
|
||||
+
|
||||
# ----------------------------------------------------------------------------
|
||||
# CMake file for libjasper. See root CMakeLists.txt
|
||||
#
|
||||
@@ -4,6 +9,7 @@
|
||||
# ----------------------------------------------------------------------------
|
||||
project(libjasper)
|
||||
|
||||
+
|
||||
add_definitions(-DEXCLUDE_MIF_SUPPORT -DEXCLUDE_PNM_SUPPORT -DEXCLUDE_BMP_SUPPORT -DEXCLUDE_RAS_SUPPORT -DEXCLUDE_JPG_SUPPORT -DEXCLUDE_PGX_SUPPORT)
|
||||
|
||||
# List of C++ files:
|
||||
@@ -41,6 +47,8 @@
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-implicit-function-declaration -Wno-unused")
|
||||
endif()
|
||||
|
||||
+endif()#!android
|
||||
+
|
||||
set_target_properties(${the_target}
|
||||
PROPERTIES
|
||||
OUTPUT_NAME "${the_target}"
|
||||
Index: 3rdparty/libpng/CMakeLists.txt
|
||||
===================================================================
|
||||
--- 3rdparty/libpng/CMakeLists.txt (revision 3503)
|
||||
+++ 3rdparty/libpng/CMakeLists.txt (working copy)
|
||||
@@ -1,3 +1,7 @@
|
||||
+if(ANDROID)
|
||||
+define_3rdparty_module(png)
|
||||
+else()
|
||||
+#endif()#android
|
||||
# ----------------------------------------------------------------------------
|
||||
# CMake file for libpng. See root CMakeLists.txt
|
||||
#
|
||||
@@ -38,3 +42,4 @@
|
||||
DEBUG_POSTFIX "${OPENCV_DEBUG_POSTFIX}"
|
||||
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/3rdparty/lib"
|
||||
)
|
||||
+endif()#android
|
||||
Index: 3rdparty/libjpeg/CMakeLists.txt
|
||||
===================================================================
|
||||
--- 3rdparty/libjpeg/CMakeLists.txt (revision 3503)
|
||||
+++ 3rdparty/libjpeg/CMakeLists.txt (working copy)
|
||||
@@ -1,3 +1,7 @@
|
||||
+if(ANDROID)
|
||||
+define_3rdparty_module(jpeg)
|
||||
+else()
|
||||
+#endif()#android
|
||||
# ----------------------------------------------------------------------------
|
||||
# CMake file for libjpeg. See root CMakeLists.txt
|
||||
#
|
||||
@@ -39,3 +43,4 @@
|
||||
DEBUG_POSTFIX "${OPENCV_DEBUG_POSTFIX}"
|
||||
ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/3rdparty/lib
|
||||
)
|
||||
+endif()#android
|
||||
Index: 3rdparty/CMakeLists.txt
|
||||
===================================================================
|
||||
--- 3rdparty/CMakeLists.txt (revision 3503)
|
||||
+++ 3rdparty/CMakeLists.txt (working copy)
|
||||
@@ -1,6 +1,22 @@
|
||||
+if(ANDROID)
|
||||
+ configure_file("${CMAKE_SOURCE_DIR}/Android.mk.modules.in" "${CMAKE_CURRENT_BINARY_DIR}/Android.mk")
|
||||
+ add_subdirectory(libpng)
|
||||
+ add_subdirectory(libjpeg)
|
||||
+ add_subdirectory(libjasper)
|
||||
+ add_subdirectory(flann)
|
||||
+ add_subdirectory(lapack)
|
||||
+
|
||||
+ #zlib is special? look in zlib-android
|
||||
+ #couldn't get the other one to compile for some reason...
|
||||
+ #config issue
|
||||
+ #add_subdirectory(zlib-android)
|
||||
+
|
||||
+else()
|
||||
+
|
||||
add_subdirectory(flann)
|
||||
add_subdirectory(lapack)
|
||||
add_subdirectory(zlib)
|
||||
+
|
||||
if(WITH_JASPER AND NOT JASPER_FOUND)
|
||||
add_subdirectory(libjasper)
|
||||
endif()
|
||||
@@ -13,3 +29,5 @@
|
||||
if(WITH_TIFF AND NOT TIFF_FOUND)
|
||||
add_subdirectory(libtiff)
|
||||
endif()
|
||||
+
|
||||
+endif()#android
|
||||
Index: 3rdparty/flann/CMakeLists.txt
|
||||
===================================================================
|
||||
--- 3rdparty/flann/CMakeLists.txt (revision 3503)
|
||||
+++ 3rdparty/flann/CMakeLists.txt (working copy)
|
||||
@@ -1,3 +1,7 @@
|
||||
+if(ANDROID)
|
||||
+file(GLOB_RECURSE flann_sources_cpp *.cpp)
|
||||
+define_android_manual(flann "${flann_sources_cpp}" "$(LOCAL_PATH)/../include $(LOCAL_PATH)/../include/flann $(LOCAL_PATH)/nn $(LOCAL_PATH)/algorithms $(LOCAL_PATH)/util")
|
||||
+else()
|
||||
if (DEFINED OPENCV_VERSION)
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
@@ -105,3 +109,4 @@
|
||||
)
|
||||
|
||||
ENDIF()
|
||||
+endif()#android
|
Reference in New Issue
Block a user