Commit 2f409055 authored by Andrey Kamaev's avatar Andrey Kamaev

Fixed Android build

parent ec0ec693
...@@ -25,6 +25,8 @@ if(CMAKE_COMPILER_IS_GNUCXX) ...@@ -25,6 +25,8 @@ if(CMAKE_COMPILER_IS_GNUCXX)
set_source_files_properties(jcdctmgr.c PROPERTIES COMPILE_FLAGS "-O1") set_source_files_properties(jcdctmgr.c PROPERTIES COMPILE_FLAGS "-O1")
endif() endif()
ocv_warnings_disable(CMAKE_C_FLAGS -Wcast-align)
set_target_properties(${JPEG_LIBRARY} set_target_properties(${JPEG_LIBRARY}
PROPERTIES OUTPUT_NAME ${JPEG_LIBRARY} PROPERTIES OUTPUT_NAME ${JPEG_LIBRARY}
DEBUG_POSTFIX "${OPENCV_DEBUG_POSTFIX}" DEBUG_POSTFIX "${OPENCV_DEBUG_POSTFIX}"
......
...@@ -21,6 +21,8 @@ if(UNIX) ...@@ -21,6 +21,8 @@ if(UNIX)
endif() endif()
endif() endif()
ocv_warnings_disable(CMAKE_C_FLAGS -Wcast-align)
set_target_properties(${PNG_LIBRARY} set_target_properties(${PNG_LIBRARY}
PROPERTIES OUTPUT_NAME ${PNG_LIBRARY} PROPERTIES OUTPUT_NAME ${PNG_LIBRARY}
DEBUG_POSTFIX "${OPENCV_DEBUG_POSTFIX}" DEBUG_POSTFIX "${OPENCV_DEBUG_POSTFIX}"
......
...@@ -90,7 +90,7 @@ if(WIN32) ...@@ -90,7 +90,7 @@ if(WIN32)
list(APPEND lib_srcs tif_win32.c) list(APPEND lib_srcs tif_win32.c)
endif(WIN32) endif(WIN32)
ocv_warnings_disable(CMAKE_C_FLAGS -Wno-unused-but-set-variable -Wmissing-prototypes -Wmissing-declarations -Wundef) ocv_warnings_disable(CMAKE_C_FLAGS -Wno-unused-but-set-variable -Wmissing-prototypes -Wmissing-declarations -Wundef -Wcast-align)
ocv_warnings_disable(CMAKE_CXX_FLAGS -Wmissing-declarations) ocv_warnings_disable(CMAKE_CXX_FLAGS -Wmissing-declarations)
if(UNIX AND (CMAKE_COMPILER_IS_GNUCXX OR CV_ICC)) if(UNIX AND (CMAKE_COMPILER_IS_GNUCXX OR CV_ICC))
......
This diff is collapsed.
...@@ -20,17 +20,17 @@ set(OPENCV_MOD_LIST ${OPENCV_MODULES_PUBLIC}) ...@@ -20,17 +20,17 @@ set(OPENCV_MOD_LIST ${OPENCV_MODULES_PUBLIC})
ocv_list_sort(OPENCV_MOD_LIST) ocv_list_sort(OPENCV_MOD_LIST)
foreach(m ${OPENCV_MOD_LIST}) foreach(m ${OPENCV_MOD_LIST})
string(TOUPPER "${m}" m) string(TOUPPER "${m}" m)
set(OPENCV_MODULE_DEFINITIONS_CONFIGMAKE "${OPENCV_MODULE_DEFINITIONS_CONFIGMAKE}#define HAVE_${m} 1\n") set(OPENCV_MODULE_DEFINITIONS_CONFIGMAKE "${OPENCV_MODULE_DEFINITIONS_CONFIGMAKE}#define HAVE_${m}\n")
endforeach() endforeach()
set(OPENCV_MODULE_DEFINITIONS_CONFIGMAKE "${OPENCV_MODULE_DEFINITIONS_CONFIGMAKE}\n") set(OPENCV_MODULE_DEFINITIONS_CONFIGMAKE "${OPENCV_MODULE_DEFINITIONS_CONFIGMAKE}\n")
set(OPENCV_MOD_LIST ${OPENCV_MODULES_DISABLED_USER} ${OPENCV_MODULES_DISABLED_AUTO}) #set(OPENCV_MOD_LIST ${OPENCV_MODULES_DISABLED_USER} ${OPENCV_MODULES_DISABLED_AUTO} ${OPENCV_MODULES_DISABLED_FORCE})
ocv_list_sort(OPENCV_MOD_LIST) #ocv_list_sort(OPENCV_MOD_LIST)
foreach(m ${OPENCV_MOD_LIST}) #foreach(m ${OPENCV_MOD_LIST})
string(TOUPPER "${m}" m) # string(TOUPPER "${m}" m)
set(OPENCV_MODULE_DEFINITIONS_CONFIGMAKE "${OPENCV_MODULE_DEFINITIONS_CONFIGMAKE}#undef HAVE_${m}\n") # set(OPENCV_MODULE_DEFINITIONS_CONFIGMAKE "${OPENCV_MODULE_DEFINITIONS_CONFIGMAKE}#undef HAVE_${m}\n")
endforeach() #endforeach()
configure_file("${OpenCV_SOURCE_DIR}/cmake/templates/opencv_modules.hpp.in" "${OPENCV_CONFIG_FILE_INCLUDE_DIR}/opencv2/opencv_modules.hpp") configure_file("${OpenCV_SOURCE_DIR}/cmake/templates/opencv_modules.hpp.in" "${OPENCV_CONFIG_FILE_INCLUDE_DIR}/opencv2/opencv_modules.hpp")
install(FILES "${OPENCV_CONFIG_FILE_INCLUDE_DIR}/opencv2/opencv_modules.hpp" DESTINATION ${OPENCV_INCLUDE_PREFIX}/opencv2 COMPONENT main) install(FILES "${OPENCV_CONFIG_FILE_INCLUDE_DIR}/opencv2/opencv_modules.hpp" DESTINATION ${OPENCV_INCLUDE_PREFIX}/opencv2 COMPONENT main)
...@@ -47,12 +47,12 @@ macro(ocv_check_flag_support lang flag varname) ...@@ -47,12 +47,12 @@ macro(ocv_check_flag_support lang flag varname)
string(TOUPPER "${flag}" ${varname}) string(TOUPPER "${flag}" ${varname})
string(REGEX REPLACE "^(/|-)" "HAVE_${_lang}_" ${varname} "${${varname}}") string(REGEX REPLACE "^(/|-)" "HAVE_${_lang}_" ${varname} "${${varname}}")
string(REPLACE "-" "_" ${varname} "${${varname}}") string(REGEX REPLACE " -|-|=| |\\." "_" ${varname} "${${varname}}")
if(_lang STREQUAL "CXX") if(_lang STREQUAL "CXX")
CHECK_CXX_COMPILER_FLAG(${flag} ${${varname}}) CHECK_CXX_COMPILER_FLAG("${ARGN} ${flag}" ${${varname}})
elseif(_lang STREQUAL "C") elseif(_lang STREQUAL "C")
CHECK_C_COMPILER_FLAG("${flag}" ${${varname}}) CHECK_C_COMPILER_FLAG("${ARGN} ${flag}" ${${varname}})
else() else()
set(${varname} FALSE) set(${varname} FALSE)
endif() endif()
......
...@@ -724,10 +724,10 @@ CV_IMPL void cvSaveWindowParameters(const char* name) ...@@ -724,10 +724,10 @@ CV_IMPL void cvSaveWindowParameters(const char* name)
CV_NO_GUI_ERROR("cvSaveWindowParameters"); CV_NO_GUI_ERROR("cvSaveWindowParameters");
} }
CV_IMPL void cvLoadWindowParameterss(const char* name) // CV_IMPL void cvLoadWindowParameterss(const char* name)
{ // {
CV_NO_GUI_ERROR("cvLoadWindowParameters"); // CV_NO_GUI_ERROR("cvLoadWindowParameters");
} // }
CV_IMPL int cvCreateButton(const char*, void (*)(int, void*), void*, int, int) CV_IMPL int cvCreateButton(const char*, void (*)(int, void*), void*, int, int)
{ {
......
...@@ -43,7 +43,7 @@ ...@@ -43,7 +43,7 @@
#include "test_precomp.hpp" #include "test_precomp.hpp"
#include "opencv2/highgui/highgui.hpp" #include "opencv2/highgui/highgui.hpp"
#if defined HAVE_GTK || defined HAVE_QT || defined WIN32 || defined _WIN32 || HAVE_CARBON || HAVE_COCOA #if defined HAVE_GTK || defined HAVE_QT || defined WIN32 || defined _WIN32 || defined HAVE_CARBON || defined HAVE_COCOA
using namespace cv; using namespace cv;
using namespace std; using namespace std;
......
...@@ -162,6 +162,8 @@ else() ...@@ -162,6 +162,8 @@ else()
endif() endif()
add_dependencies(${the_module} ${api_target}) add_dependencies(${the_module} ${api_target})
ocv_warnings_disable(CMAKE_CXX_FLAGS -Wmissing-declarations)
# Additional target properties # Additional target properties
set_target_properties(${the_module} PROPERTIES set_target_properties(${the_module} PROPERTIES
OUTPUT_NAME "${the_module}" OUTPUT_NAME "${the_module}"
......
#include <jni.h> #include <jni.h>
#include "opencv2/opencv_modules.hpp"
#ifdef HAVE_OPENCV_NONFREE
# include "opencv2/nonfree/nonfree.hpp"
#endif
#ifdef HAVE_OPENCV_FEATURES2D
# include "opencv2/features2d/features2d.hpp"
#endif
#ifdef HAVE_OPENCV_VIDEO
# include "opencv2/video/video.hpp"
#endif
#ifdef HAVE_OPENCV_ML
# include "opencv2/ml/ml.hpp"
#endif
extern "C" { extern "C" {
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL
...@@ -9,6 +27,23 @@ JNI_OnLoad(JavaVM* vm, void* reserved) ...@@ -9,6 +27,23 @@ JNI_OnLoad(JavaVM* vm, void* reserved)
if (vm->GetEnv((void**) &env, JNI_VERSION_1_6) != JNI_OK) if (vm->GetEnv((void**) &env, JNI_VERSION_1_6) != JNI_OK)
return -1; return -1;
bool init = true;
#ifdef HAVE_OPENCV_NONFREE
init &= cv::initModule_nonfree();
#endif
#ifdef HAVE_OPENCV_FEATURES2D
init &= cv::initModule_features2d();
#endif
#ifdef HAVE_OPENCV_VIDEO
init &= cv::initModule_video();
#endif
#ifdef HAVE_OPENCV_ML
init &= cv::initModule_ml();
#endif
if(!init)
return -1;
/* get class with (*env)->FindClass */ /* get class with (*env)->FindClass */
/* register methods with (*env)->RegisterNatives */ /* register methods with (*env)->RegisterNatives */
...@@ -22,15 +57,3 @@ JNI_OnUnload(JavaVM *vm, void *reserved) ...@@ -22,15 +57,3 @@ JNI_OnUnload(JavaVM *vm, void *reserved)
} }
} // extern "C" } // extern "C"
\ No newline at end of file
#include "opencv2/opencv_modules.hpp"
#if HAVE_OPENCV_MODULES_NONFREE
#include "opencv2/nonfree/nonfree.hpp"
static bool makeUseOfNonfree = initModule_nonfree();
#endif
#if HAVE_OPENCV_MODULES_FEATURES2D
#include "opencv2/features2d/features2d.hpp"
static bool makeUseOfNonfree = initModule_features2d();
#endif
\ No newline at end of file
...@@ -18,7 +18,7 @@ using std::tr1::get; ...@@ -18,7 +18,7 @@ using std::tr1::get;
typedef TestBaseWithParam<String> stitch; typedef TestBaseWithParam<String> stitch;
typedef TestBaseWithParam<String> match; typedef TestBaseWithParam<String> match;
#if HAVE_OPENCV_NONFREE #ifdef HAVE_OPENCV_NONFREE
#define TEST_DETECTORS testing::Values("surf", "orb") #define TEST_DETECTORS testing::Values("surf", "orb")
#else #else
#define TEST_DETECTORS testing::Values<String>("orb") #define TEST_DETECTORS testing::Values<String>("orb")
......
...@@ -61,7 +61,7 @@ Stitcher Stitcher::createDefault(bool try_use_gpu) ...@@ -61,7 +61,7 @@ Stitcher Stitcher::createDefault(bool try_use_gpu)
#ifdef HAVE_OPENCV_GPU #ifdef HAVE_OPENCV_GPU
if (try_use_gpu && gpu::getCudaEnabledDeviceCount() > 0) if (try_use_gpu && gpu::getCudaEnabledDeviceCount() > 0)
{ {
#if HAVE_OPENCV_NONFREE #ifdef HAVE_OPENCV_NONFREE
stitcher.setFeaturesFinder(new detail::SurfFeaturesFinderGpu()); stitcher.setFeaturesFinder(new detail::SurfFeaturesFinderGpu());
#else #else
stitcher.setFeaturesFinder(new detail::OrbFeaturesFinder()); stitcher.setFeaturesFinder(new detail::OrbFeaturesFinder());
...@@ -72,7 +72,7 @@ Stitcher Stitcher::createDefault(bool try_use_gpu) ...@@ -72,7 +72,7 @@ Stitcher Stitcher::createDefault(bool try_use_gpu)
else else
#endif #endif
{ {
#if HAVE_OPENCV_NONFREE #ifdef HAVE_OPENCV_NONFREE
stitcher.setFeaturesFinder(new detail::SurfFeaturesFinder()); stitcher.setFeaturesFinder(new detail::SurfFeaturesFinder());
#else #else
stitcher.setFeaturesFinder(new detail::OrbFeaturesFinder()); stitcher.setFeaturesFinder(new detail::OrbFeaturesFinder());
......
...@@ -42,7 +42,7 @@ ...@@ -42,7 +42,7 @@
#include "test_precomp.hpp" #include "test_precomp.hpp"
#include "opencv2/opencv_modules.hpp" #include "opencv2/opencv_modules.hpp"
#if HAVE_OPENCV_NONFREE #ifdef HAVE_OPENCV_NONFREE
using namespace cv; using namespace cv;
using namespace std; using namespace std;
......
...@@ -53,7 +53,7 @@ ...@@ -53,7 +53,7 @@
#include "opencv2/videostab/motion_core.hpp" #include "opencv2/videostab/motion_core.hpp"
#include "opencv2/videostab/outlier_rejection.hpp" #include "opencv2/videostab/outlier_rejection.hpp"
#if HAVE_OPENCV_GPU #ifdef HAVE_OPENCV_GPU
#include "opencv2/gpu/gpu.hpp" #include "opencv2/gpu/gpu.hpp"
#endif #endif
...@@ -200,7 +200,7 @@ private: ...@@ -200,7 +200,7 @@ private:
std::vector<Point2f> pointsPrevGood_, pointsGood_; std::vector<Point2f> pointsPrevGood_, pointsGood_;
}; };
#if HAVE_OPENCV_GPU #ifdef HAVE_OPENCV_GPU
class CV_EXPORTS KeypointBasedMotionEstimatorGpu : public ImageMotionEstimatorBase class CV_EXPORTS KeypointBasedMotionEstimatorGpu : public ImageMotionEstimatorBase
{ {
public: public:
......
...@@ -46,7 +46,7 @@ ...@@ -46,7 +46,7 @@
#include "opencv2/core/core.hpp" #include "opencv2/core/core.hpp"
#include "opencv2/opencv_modules.hpp" #include "opencv2/opencv_modules.hpp"
#if HAVE_OPENCV_GPU #ifdef HAVE_OPENCV_GPU
#include "opencv2/gpu/gpu.hpp" #include "opencv2/gpu/gpu.hpp"
#endif #endif
...@@ -99,7 +99,7 @@ public: ...@@ -99,7 +99,7 @@ public:
OutputArray status, OutputArray errors); OutputArray status, OutputArray errors);
}; };
#if HAVE_OPENCV_GPU #ifdef HAVE_OPENCV_GPU
class CV_EXPORTS SparsePyrLkOptFlowEstimatorGpu class CV_EXPORTS SparsePyrLkOptFlowEstimatorGpu
: public PyrLkOptFlowEstimatorBase, public ISparseOptFlowEstimator : public PyrLkOptFlowEstimatorBase, public ISparseOptFlowEstimator
{ {
......
...@@ -48,7 +48,7 @@ ...@@ -48,7 +48,7 @@
#include "opencv2/videostab/global_motion.hpp" #include "opencv2/videostab/global_motion.hpp"
#include "opencv2/videostab/log.hpp" #include "opencv2/videostab/log.hpp"
#if HAVE_OPENCV_GPU #ifdef HAVE_OPENCV_GPU
#include "opencv2/gpu/gpu.hpp" #include "opencv2/gpu/gpu.hpp"
#endif #endif
...@@ -119,7 +119,7 @@ private: ...@@ -119,7 +119,7 @@ private:
Mat_<float> mapx_, mapy_; Mat_<float> mapx_, mapy_;
}; };
#if HAVE_OPENCV_GPU #ifdef HAVE_OPENCV_GPU
class CV_EXPORTS MoreAccurateMotionWobbleSuppressorGpu : public MoreAccurateMotionWobbleSuppressorBase class CV_EXPORTS MoreAccurateMotionWobbleSuppressorGpu : public MoreAccurateMotionWobbleSuppressorBase
{ {
public: public:
......
...@@ -686,7 +686,7 @@ Mat KeypointBasedMotionEstimator::estimate(const Mat &frame0, const Mat &frame1, ...@@ -686,7 +686,7 @@ Mat KeypointBasedMotionEstimator::estimate(const Mat &frame0, const Mat &frame1,
} }
#if HAVE_OPENCV_GPU #ifdef HAVE_OPENCV_GPU
KeypointBasedMotionEstimatorGpu::KeypointBasedMotionEstimatorGpu(Ptr<MotionEstimatorBase> estimator) KeypointBasedMotionEstimatorGpu::KeypointBasedMotionEstimatorGpu(Ptr<MotionEstimatorBase> estimator)
: ImageMotionEstimatorBase(estimator->motionModel()), motionEstimator_(estimator) : ImageMotionEstimatorBase(estimator->motionModel()), motionEstimator_(estimator)
{ {
......
...@@ -325,7 +325,7 @@ public: ...@@ -325,7 +325,7 @@ public:
MotionInpainter::MotionInpainter() MotionInpainter::MotionInpainter()
{ {
#if HAVE_OPENCV_GPU #ifdef HAVE_OPENCV_GPU
setOptFlowEstimator(new DensePyrLkOptFlowEstimatorGpu()); setOptFlowEstimator(new DensePyrLkOptFlowEstimatorGpu());
#else #else
CV_Error(CV_StsNotImplemented, "Current implementation of MotionInpainter requires GPU"); CV_Error(CV_StsNotImplemented, "Current implementation of MotionInpainter requires GPU");
......
...@@ -60,7 +60,7 @@ void SparsePyrLkOptFlowEstimator::run( ...@@ -60,7 +60,7 @@ void SparsePyrLkOptFlowEstimator::run(
} }
#if HAVE_OPENCV_GPU #ifdef HAVE_OPENCV_GPU
SparsePyrLkOptFlowEstimatorGpu::SparsePyrLkOptFlowEstimatorGpu() SparsePyrLkOptFlowEstimatorGpu::SparsePyrLkOptFlowEstimatorGpu()
{ {
CV_Assert(gpu::getCudaEnabledDeviceCount() > 0); CV_Assert(gpu::getCudaEnabledDeviceCount() > 0);
...@@ -135,7 +135,7 @@ void DensePyrLkOptFlowEstimatorGpu::run( ...@@ -135,7 +135,7 @@ void DensePyrLkOptFlowEstimatorGpu::run(
flowX_.download(flowX.getMatRef()); flowX_.download(flowX.getMatRef());
flowY_.download(flowY.getMatRef()); flowY_.download(flowY.getMatRef());
} }
#endif // #if HAVE_OPENCV_GPU #endif // HAVE_OPENCV_GPU
} // namespace videostab } // namespace videostab
} // namespace cv } // namespace cv
...@@ -115,7 +115,7 @@ void MoreAccurateMotionWobbleSuppressor::suppress(int idx, const Mat &frame, Mat ...@@ -115,7 +115,7 @@ void MoreAccurateMotionWobbleSuppressor::suppress(int idx, const Mat &frame, Mat
} }
#if HAVE_OPENCV_GPU #ifdef HAVE_OPENCV_GPU
void MoreAccurateMotionWobbleSuppressorGpu::suppress(int idx, const gpu::GpuMat &frame, gpu::GpuMat &result) void MoreAccurateMotionWobbleSuppressorGpu::suppress(int idx, const gpu::GpuMat &frame, gpu::GpuMat &result)
{ {
CV_Assert(motions_ && stabilizationMotions_); CV_Assert(motions_ && stabilizationMotions_);
......
...@@ -4,6 +4,8 @@ ...@@ -4,6 +4,8 @@
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
add_custom_target(opencv_android_examples) add_custom_target(opencv_android_examples)
ocv_warnings_disable(CMAKE_CXX_FLAGS -Wmissing-declarations)
add_subdirectory(15-puzzle) add_subdirectory(15-puzzle)
add_subdirectory(face-detection) add_subdirectory(face-detection)
add_subdirectory(image-manipulations) add_subdirectory(image-manipulations)
......
...@@ -215,7 +215,7 @@ public: ...@@ -215,7 +215,7 @@ public:
outlierRejector = tblor; outlierRejector = tblor;
} }
#if HAVE_OPENCV_GPU #ifdef HAVE_OPENCV_GPU
if (gpu) if (gpu)
{ {
KeypointBasedMotionEstimatorGpu *kbest = new KeypointBasedMotionEstimatorGpu(est); KeypointBasedMotionEstimatorGpu *kbest = new KeypointBasedMotionEstimatorGpu(est);
...@@ -256,7 +256,7 @@ public: ...@@ -256,7 +256,7 @@ public:
outlierRejector = tblor; outlierRejector = tblor;
} }
#if HAVE_OPENCV_GPU #ifdef HAVE_OPENCV_GPU
if (gpu) if (gpu)
{ {
KeypointBasedMotionEstimatorGpu *kbest = new KeypointBasedMotionEstimatorGpu(est); KeypointBasedMotionEstimatorGpu *kbest = new KeypointBasedMotionEstimatorGpu(est);
...@@ -341,7 +341,7 @@ int main(int argc, const char **argv) ...@@ -341,7 +341,7 @@ int main(int argc, const char **argv)
return 0; return 0;
} }
#if HAVE_OPENCV_GPU #ifdef HAVE_OPENCV_GPU
if (arg("gpu") == "yes") if (arg("gpu") == "yes")
{ {
cout << "initializing GPU..."; cout.flush(); cout << "initializing GPU..."; cout.flush();
...@@ -419,7 +419,7 @@ int main(int argc, const char **argv) ...@@ -419,7 +419,7 @@ int main(int argc, const char **argv)
{ {
MoreAccurateMotionWobbleSuppressorBase *ws = new MoreAccurateMotionWobbleSuppressor(); MoreAccurateMotionWobbleSuppressorBase *ws = new MoreAccurateMotionWobbleSuppressor();
if (arg("gpu") == "yes") if (arg("gpu") == "yes")
#if HAVE_OPENCV_GPU #ifdef HAVE_OPENCV_GPU
ws = new MoreAccurateMotionWobbleSuppressorGpu(); ws = new MoreAccurateMotionWobbleSuppressorGpu();
#else #else
throw runtime_error("OpenCV is built without GPU support"); throw runtime_error("OpenCV is built without GPU support");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment