added opencv_world module that combines all the other [selected by user] OpenCV modules, except for opencv_python and opencv_gpu.

This commit is contained in:
Vadim Pisarevsky 2012-05-12 13:54:26 +00:00
parent 8408499c94
commit 9bbcebd6b0
11 changed files with 335 additions and 5 deletions

View File

@ -155,10 +155,19 @@ OCV_OPTION(INSTALL_PYTHON_EXAMPLES "Install Python examples" OFF )
OCV_OPTION(INSTALL_ANDROID_EXAMPLES "Install Android examples" OFF IF ANDROID )
OCV_OPTION(INSTALL_TO_MANGLED_PATHS "Enables mangled install paths, that help with side by side installs." OFF IF (UNIX AND NOT ANDROID AND NOT IOS AND BUILD_SHARED_LIBS) )
if(CMAKE_GENERATOR MATCHES Xcode)
set(ENABLE_SOLUTION_FOLDERS0 ON)
elseif(MSVC_IDE)
set(ENABLE_SOLUTION_FOLDERS0 ON)
else()
set(ENABLE_SOLUTION_FOLDERS0 OFF)
endif()
# OpenCV build options
# ===================================================
OCV_OPTION(ENABLE_PRECOMPILED_HEADERS "Use precompiled headers" ON IF (NOT IOS) )
OCV_OPTION(ENABLE_SOLUTION_FOLDERS "Solution folder in Visual Studio or in other IDEs" MSVC_IDE IF (CMAKE_VERSION VERSION_GREATER "2.8.0") )
OCV_OPTION(ENABLE_SOLUTION_FOLDERS "Solution folder in Visual Studio or in other IDEs" ${ENABLE_SOLUTION_FOLDERS0} IF (CMAKE_VERSION VERSION_GREATER "2.8.0") )
OCV_OPTION(ENABLE_PROFILING "Enable profiling in the GCC compiler (Add flags: -g -pg)" OFF IF CMAKE_COMPILER_IS_GNUCXX )
OCV_OPTION(ENABLE_OMIT_FRAME_POINTER "Enable -fomit-frame-pointer for GCC" ON IF CMAKE_COMPILER_IS_GNUCXX )
OCV_OPTION(ENABLE_POWERPC "Enable PowerPC for GCC" ON IF (CMAKE_COMPILER_IS_GNUCXX AND CMAKE_SYSTEM_PROCESSOR MATCHES powerpc.*) )

View File

@ -58,8 +58,8 @@ set(OPENCV_MODULES_DISABLED_FORCE "" CACHE INTERNAL "List of OpenCV modules whic
# * <list of dependencies> - can include full names of modules or full pathes to shared/static libraries or cmake targets
macro(ocv_add_dependencies full_modname)
#we don't clean the dependencies here to allow this macro several times for every module
foreach(d "REQIRED" ${ARGN})
if(d STREQUAL "REQIRED")
foreach(d "REQUIRED" ${ARGN})
if(d STREQUAL "REQUIRED")
set(__depsvar OPENCV_MODULE_${full_modname}_REQ_DEPS)
elseif(d STREQUAL "OPTIONAL")
set(__depsvar OPENCV_MODULE_${full_modname}_OPT_DEPS)
@ -110,7 +110,13 @@ macro(ocv_add_module _name)
unset(OPENCV_MODULE_${the_module}_OPT_DEPS CACHE)
#create option to enable/disable this module
option(BUILD_${the_module} "Include ${the_module} module into the OpenCV build" ON)
if(the_module STREQUAL "opencv_world")
set(build_the_module OFF)
else()
set(build_the_module ON)
endif()
option(BUILD_${the_module} "Include ${the_module} module into the OpenCV build" ${build_the_module})
unset(build_the_module)
if("${ARGV1}" STREQUAL "INTERNAL" OR "${ARGV1}" STREQUAL "BINDINGS")
set(__ocv_argn__ ${ARGN})

View File

@ -301,3 +301,5 @@ endif()
ocv_add_accuracy_tests()
ocv_add_perf_tests()
set(HIGHGUI_LIBRARIES ${HIGHGUI_LIBRARIES} PARENT_SCOPE)

View File

@ -2136,6 +2136,8 @@ typedef CvGBTreesParams GradientBoostingTreeParams;
typedef CvGBTrees GradientBoostingTrees;
template<> CV_EXPORTS void Ptr<CvDTreeSplit>::delete_obj();
CV_EXPORTS bool initModule_ml(void);
}

View File

@ -48,7 +48,7 @@
namespace cv
{
CV_EXPORTS_W bool initModule_nonfree();
CV_EXPORTS bool initModule_nonfree();
}

View File

@ -46,4 +46,13 @@
#include "opencv2/video/tracking.hpp"
#include "opencv2/video/background_segm.hpp"
#ifdef __cplusplus
namespace cv
{
CV_EXPORTS bool initModule_video(void);
}
#endif
#endif //__OPENCV_VIDEO_HPP__

View File

@ -0,0 +1,117 @@
set(the_description "All the selected OpenCV modules in a single binary")
set(module_list )
ocv_add_module(world opencv_core OPTIONAL opencv_flann opencv_imgproc opencv_video opencv_ml opencv_features2d opencv_highgui opencv_calib3d opencv_photo opencv_objdetect opencv_legacy opencv_nonfree)
set(the_module opencv_world)
ocv_glob_module_sources()
ocv_module_include_directories()
add_library(${the_module} ${OPENCV_MODULE_TYPE} ${OPENCV_MODULE_${the_module}_HEADERS} ${OPENCV_MODULE_${the_module}_SOURCES})
if(ENABLE_SOLUTION_FOLDERS)
set_target_properties(${the_module} PROPERTIES FOLDER "modules")
endif()
set_target_properties(${the_module} PROPERTIES
OUTPUT_NAME "${the_module}${OPENCV_DLLVERSION}"
DEBUG_POSTFIX "${OPENCV_DEBUG_POSTFIX}"
ARCHIVE_OUTPUT_DIRECTORY ${LIBRARY_OUTPUT_PATH}
RUNTIME_OUTPUT_DIRECTORY ${EXECUTABLE_OUTPUT_PATH}
INSTALL_NAME_DIR lib
)
# For dynamic link numbering convenions
if(NOT ANDROID)
# Android SDK build scripts can include only .so files into final .apk
# As result we should not set version properties for Android
set_target_properties(${the_module} PROPERTIES
VERSION ${OPENCV_VERSION}
SOVERSION ${OPENCV_SOVERSION}
)
endif()
if(BUILD_SHARED_LIBS)
if(MSVC)
set_target_properties(${the_module} PROPERTIES DEFINE_SYMBOL CVAPI_EXPORTS)
else()
add_definitions(-DCVAPI_EXPORTS)
endif()
endif()
if(MSVC)
if(CMAKE_CROSSCOMPILING)
set_target_properties(${the_module} PROPERTIES LINK_FLAGS "/NODEFAULTLIB:secchk")
endif()
set_target_properties(${the_module} PROPERTIES LINK_FLAGS "/NODEFAULTLIB:libc /DEBUG")
endif()
set(objpath0 "${OpenCV_BINARY_DIR}/modules/<MODULE_NAME>")
if(CMAKE_GENERATOR MATCHES "^Visual.*$")
set(have_cfg 1)
set(objpath0 "${objpath0}/CMakeFiles/opencv_<MODULE_NAME>.dir/src/<SRC_NAME_WE>.obj")
elseif (CMAKE_GENERATOR MATCHES Xcode)
set(have_cfg 1)
set(objpath0 "${objpath0}/OpenCV.build/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/opencv_<MODULE_NAME>.build/Objects-normal/$(CURRENT_ARCH)/<SRC_NAME_WE>.o")
else()
set(have_cfg 0)
set(objpath0 "${objpath0}/CMakeFiles/opencv_<MODULE_NAME>.dir/src/<SRC_NAME>.o")
endif()
#message("CMAKE_CFG_INTDIR: ${CMAKE_CFG_INTDIR}")
set(objlist)
foreach(m ${OPENCV_MODULES_BUILD})
if(m STREQUAL ${the_module})
else()
add_dependencies(${the_module} ${m})
string(REGEX REPLACE "^opencv_" "" bare_m "${m}")
string(REGEX REPLACE "<MODULE_NAME>" "${bare_m}" objpath1 "${objpath0}")
if(m STREQUAL "opencv_highgui")
target_link_libraries(${the_module} ${HIGHGUI_LIBRARIES} zlib libtiff libjpeg libpng libjasper)
endif()
set(modobjlist)
foreach(src ${OPENCV_MODULE_${m}_SOURCES})
get_filename_component(srcname ${src} NAME)
if(srcname STREQUAL "precomp.cpp")
elseif(srcname MATCHES ".*\\.[cm].*")
get_filename_component(srcname_we ${srcname} NAME_WE)
string(REGEX REPLACE <SRC_NAME_WE> "${srcname_we}" objpath2 "${objpath1}")
string(REGEX REPLACE <SRC_NAME> "${srcname}" objpath3 "${objpath2}")
set(modobjlist "${modobjlist} ${objpath3}")
endif()
endforeach()
set(objlist "${objlist} ${modobjlist}")
endif()
endforeach()
if(have_cfg)
set_target_properties(${the_module} PROPERTIES
LINK_FLAGS_DEBUG ${objlist}
LINK_FLAGS_RELEASE ${objlist})
else()
set_target_properties(${the_module} PROPERTIES
LINK_FLAGS ${objlist})
endif()
install(TARGETS ${the_module}
RUNTIME DESTINATION bin COMPONENT main
LIBRARY DESTINATION ${OPENCV_LIB_INSTALL_PATH} COMPONENT main
ARCHIVE DESTINATION ${OPENCV_LIB_INSTALL_PATH} COMPONENT main
)
# only "public" headers need to be installed
if(OPENCV_MODULE_${the_module}_HEADERS AND OPENCV_MODULES_PUBLIC MATCHES "(^|;)${the_module}(;|$)")
foreach(hdr ${OPENCV_MODULE_${the_module}_HEADERS})
string(REGEX REPLACE "^.*opencv2/" "opencv2/" hdr2 "${hdr}")
if(hdr2 MATCHES "^(opencv2/.*)/[^/]+.h(..)?$")
install(FILES ${hdr} DESTINATION "${OPENCV_INCLUDE_PREFIX}/${CMAKE_MATCH_1}" COMPONENT main)
endif()
endforeach()
endif()
ocv_add_precompiled_headers(${the_module})

View File

@ -0,0 +1,58 @@
/*M///////////////////////////////////////////////////////////////////////////////////////
//
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
//
// By downloading, copying, installing or using the software you agree to this license.
// If you do not agree to this license, do not download, install,
// copy or use the software.
//
//
// License Agreement
// For Open Source Computer Vision Library
//
// Copyright (C) 2000-2008, Intel Corporation, all rights reserved.
// Copyright (C) 2009-2010, Willow Garage Inc., all rights reserved.
// Third party copyrights are property of their respective owners.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// * Redistribution's of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// * Redistribution's in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// * The name of the copyright holders may not be used to endorse or promote products
// derived from this software without specific prior written permission.
//
// This software is provided by the copyright holders and contributors "as is" and
// any express or implied warranties, including, but not limited to, the implied
// warranties of merchantability and fitness for a particular purpose are disclaimed.
// In no event shall the Intel Corporation or contributors be liable for any direct,
// indirect, incidental, special, exemplary, or consequential damages
// (including, but not limited to, procurement of substitute goods or services;
// loss of use, data, or profits; or business interruption) however caused
// and on any theory of liability, whether in contract, strict liability,
// or tort (including negligence or otherwise) arising in any way out of
// the use of this software, even if advised of the possibility of such damage.
//
//M*/
#ifndef __OPENCV_WORLD_HPP__
#define __OPENCV_WORLD_HPP__
#include "opencv2/core/core.hpp"
#ifdef __cplusplus
namespace cv
{
CV_EXPORTS_W bool initAll();
}
#endif
#endif

View File

View File

@ -0,0 +1,66 @@
/*M///////////////////////////////////////////////////////////////////////////////////////
//
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
//
// By downloading, copying, installing or using the software you agree to this license.
// If you do not agree to this license, do not download, install,
// copy or use the software.
//
//
// License Agreement
// For Open Source Computer Vision Library
//
// Copyright (C) 2000-2008, Intel Corporation, all rights reserved.
// Copyright (C) 2009, Willow Garage Inc., all rights reserved.
// Third party copyrights are property of their respective owners.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// * Redistribution's of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// * Redistribution's in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// * The name of the copyright holders may not be used to endorse or promote products
// derived from this software without specific prior written permission.
//
// This software is provided by the copyright holders and contributors "as is" and
// any express or implied warranties, including, but not limited to, the implied
// warranties of merchantability and fitness for a particular purpose are disclaimed.
// In no event shall the Intel Corporation or contributors be liable for any direct,
// indirect, incidental, special, exemplary, or consequential damages
// (including, but not limited to, procurement of substitute goods or services;
// loss of use, data, or profits; or business interruption) however caused
// and on any theory of liability, whether in contract, strict liability,
// or tort (including negligence or otherwise) arising in any way out of
// the use of this software, even if advised of the possibility of such damage.
//
//M*/
#ifndef __OPENCV_PRECOMP_H__
#define __OPENCV_PRECOMP_H__
#ifdef HAVE_CVCONFIG_H
#include "cvconfig.h"
#endif
#include "opencv2/opencv_modules.hpp"
#ifdef HAVE_OPENCV_VIDEO
#include "opencv2/video/video.hpp"
#endif
#ifdef HAVE_OPENCV_FEATURES2D
#include "opencv2/features2d/features2d.hpp"
#endif
#ifdef HAVE_OPENCV_NONFREE
#include "opencv2/nonfree/nonfree.hpp"
#endif
#ifdef HAVE_OPENCV_ML
#include "opencv2/ml/ml.hpp"
#endif
#include "opencv2/world/world.hpp"
#endif

View File

@ -0,0 +1,61 @@
/*M///////////////////////////////////////////////////////////////////////////////////////
//
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
//
// By downloading, copying, installing or using the software you agree to this license.
// If you do not agree to this license, do not download, install,
// copy or use the software.
//
//
// License Agreement
// For Open Source Computer Vision Library
//
// Copyright (C) 2000-2008, Intel Corporation, all rights reserved.
// Copyright (C) 2009, Willow Garage Inc., all rights reserved.
// Third party copyrights are property of their respective owners.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// * Redistribution's of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// * Redistribution's in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// * The name of the copyright holders may not be used to endorse or promote products
// derived from this software without specific prior written permission.
//
// This software is provided by the copyright holders and contributors "as is" and
// any express or implied warranties, including, but not limited to, the implied
// warranties of merchantability and fitness for a particular purpose are disclaimed.
// In no event shall the Intel Corporation or contributors be liable for any direct,
// indirect, incidental, special, exemplary, or consequential damages
// (including, but not limited to, procurement of substitute goods or services;
// loss of use, data, or profits; or business interruption) however caused
// and on any theory of liability, whether in contract, strict liability,
// or tort (including negligence or otherwise) arising in any way out of
// the use of this software, even if advised of the possibility of such damage.
//
//M*/
#include "precomp.hpp"
bool cv::initAll()
{
return true
#ifdef HAVE_OPENCV_VIDEO
&& initModule_video()
#endif
#ifdef HAVE_OPENCV_FEATURES2D
&& initModule_features2d()
#endif
#ifdef HAVE_OPENCV_NONFREE
&& initModule_nonfree()
#endif
#ifdef HAVE_OPENCV_ML
&& initModule_ml()
#endif
;
}