From 8ee50c422bbc712dfdb16e1a27d749a0e78560ad Mon Sep 17 00:00:00 2001 From: Ethan Rublee Date: Wed, 22 Sep 2010 02:16:33 +0000 Subject: [PATCH] adding some small changes to support android build, mainly cmake stuff, but in persistance the wcstombs is not supported on android, and in sift.cpp there was and ifdef that affected arm and this causes undefined symbols on android. --- modules/CMakeLists.txt | 13 +++++++++++-- modules/core/src/persistence.cpp | 4 ++-- modules/features2d/CMakeLists.txt | 3 ++- modules/features2d/src/sift.cpp | 11 ++++++++++- modules/highgui/CMakeLists.txt | 19 +++++++++++++++++++ 5 files changed, 44 insertions(+), 6 deletions(-) diff --git a/modules/CMakeLists.txt b/modules/CMakeLists.txt index a9e3eb932a..85567f7f8b 100644 --- a/modules/CMakeLists.txt +++ b/modules/CMakeLists.txt @@ -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,13 @@ if(PYTHONLIBS_FOUND AND BUILD_NEW_PYTHON_SUPPORT) endif() add_subdirectory(video) + +if(!ANDROID) add_subdirectory(haartraining) add_subdirectory(traincascade) - - add_subdirectory(gpu) +endif() + + + + diff --git a/modules/core/src/persistence.cpp b/modules/core/src/persistence.cpp index 54e27ea6b7..f631c2d480 100644 --- a/modules/core/src/persistence.cpp +++ b/modules/core/src/persistence.cpp @@ -114,7 +114,7 @@ cv::string cv::FileStorage::getDefaultObjectName(const string& _filename) namespace cv { - +#ifndef ANDROID //unsuported wcstombs on android string fromUtf16(const WString& str) { cv::AutoBuffer _buf(str.size()*4 + 1); @@ -138,7 +138,7 @@ WString toUtf16(const string& str) buf[sz] = '\0'; return WString(buf); } - +#endif } typedef struct CvGenericHash diff --git a/modules/features2d/CMakeLists.txt b/modules/features2d/CMakeLists.txt index 6fd566e768..7ab8c9a33b 100644 --- a/modules/features2d/CMakeLists.txt +++ b/modules/features2d/CMakeLists.txt @@ -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) + diff --git a/modules/features2d/src/sift.cpp b/modules/features2d/src/sift.cpp index 196c185dd2..0eac521269 100644 --- a/modules/features2d/src/sift.cpp +++ b/modules/features2d/src/sift.cpp @@ -48,7 +48,15 @@ #include "precomp.hpp" -#ifndef __arm__ +#ifdef __arm__ +#define ARM_NO_SIFT +#endif + +#ifdef ANDROID +#undef ARM_NO_SIFT +#endif //ANDROID + +#ifndef ARM_NO_SIFT #include #include @@ -175,6 +183,7 @@ public: 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, diff --git a/modules/highgui/CMakeLists.txt b/modules/highgui/CMakeLists.txt index 0f6133016a..883778275c 100644 --- a/modules/highgui/CMakeLists.txt +++ b/modules/highgui/CMakeLists.txt @@ -3,6 +3,7 @@ # Some parts taken from version of Hartmut Seichter, HIT Lab NZ. # Jose Luis Blanco, 2008 # ---------------------------------------------------------------------------- +if(!ANDROID) project(opencv_highgui) if(WITH_JPEG) @@ -332,3 +333,21 @@ install(TARGETS ${the_target} install(FILES ${highgui_ext_hdrs} DESTINATION include/opencv2/highgui COMPONENT main) + +else(!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_jpeg2000.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)") +endif(!ANDROID)