Index: modules/calib3d/include/opencv2/calib3d/calib3d.hpp =================================================================== --- modules/calib3d/include/opencv2/calib3d/calib3d.hpp (revision 7046) +++ modules/calib3d/include/opencv2/calib3d/calib3d.hpp (working copy) @@ -760,4 +760,10 @@ #endif +// Auto linking by "#pragma comment(lib)" syntax +#include "opencv2/core/pragma_lib.hpp" +#if PRAGMA_COMMENT_SUPPORT && OPENCV_AUTO_LINK +#pragma OPENCV_COMMENT_LIB_FNAME("calib3d") +#endif // PRAGMA_COMMENT_SUPPORT && OPENCV_AUTO_LINK + #endif Index: modules/contrib/include/opencv2/contrib/contrib.hpp =================================================================== --- modules/contrib/include/opencv2/contrib/contrib.hpp (revision 7046) +++ modules/contrib/include/opencv2/contrib/contrib.hpp (working copy) @@ -629,5 +629,10 @@ #endif -#endif +// Auto linking by "#pragma comment(lib)" syntax +#include "opencv2/core/pragma_lib.hpp" +#if PRAGMA_COMMENT_SUPPORT && OPENCV_AUTO_LINK +#pragma OPENCV_COMMENT_LIB_FNAME("contrib") +#endif // PRAGMA_COMMENT_SUPPORT && OPENCV_AUTO_LINK +#endif \ No newline at end of file Index: modules/core/include/opencv2/core/core.hpp =================================================================== --- modules/core/include/opencv2/core/core.hpp (revision 7046) +++ modules/core/include/opencv2/core/core.hpp (working copy) @@ -4381,4 +4381,10 @@ #include "opencv2/core/operations.hpp" #include "opencv2/core/mat.hpp" +// Auto linking by "#pragma comment(lib)" syntax +#include "opencv2/core/pragma_lib.hpp" +#if PRAGMA_COMMENT_SUPPORT && OPENCV_AUTO_LINK +#pragma OPENCV_COMMENT_LIB_FNAME("core") +#endif + #endif /*__OPENCV_CORE_HPP__*/ Index: modules/core/include/opencv2/core/pragma_lib.hpp =================================================================== --- modules/core/include/opencv2/core/pragma_lib.hpp (revision 0) +++ modules/core/include/opencv2/core/pragma_lib.hpp (working copy) @@ -0,0 +1,91 @@ +/*! \file pragma_include.hpp + \brief #pragmas for auto library linking + */ +/*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-2011, 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_PRAGMA_LIB_HPP__ +#define __OPENCV_PRAGMA_LIB_HPP__ 1 + +#if (defined(_MSC_VER) && !defined(PRAGMA_COMMENT_SUPPORT)) \ + && !defined(CVAPI_EXPORTS) +#define PRAGMA_COMMENT_SUPPORT 1 +#elif !defined(PRAGMA_COMMENT_SUPPORT) +#define PRAGMA_COMMENT_SUPPORT 0 +#endif + +#ifndef CV_MAJOR_VERSION +#pragma message("WARM: Any OpenCV header included before pragma_lib.hpp") +#include "opencv2/core/version.hpp" +#endif + +// version string which contains in library's file name such as "232" +#define OPENCV_LIBVERSTR \ + CVAUX_STR(CV_MAJOR_VERSION) \ + CVAUX_STR(CV_MINOR_VERSION) \ + CVAUX_STR(CV_SUBMINOR_VERSION) + +// generate #pragma arguments string +#ifndef _DEBUG // Release +#define OPENCV_COMMENT_LIB_FNAME(name) \ +comment(lib, "opencv_" name OPENCV_LIBVERSTR ".lib") +#else // Debug +#define OPENCV_COMMENT_LIB_FNAME(name) \ +comment(lib, "opencv_" name OPENCV_LIBVERSTR "d.lib") +#endif + +// defined macro search, +// OPENCV_DEFINE_SEARCH(modulename) is only true +// when header file of modulename is included. +#define OPENCV_DEFINE_SEARCH(modulename) \ + ( \ + defined( __OPENCV_##modulename##_HPP__ ) || \ + defined( _OPENCV_##modulename##_HPP_ ) || \ + defined( __OPENCV_##modulename##_H__ ) || \ + defined( __OPENCV_##modulename##_##name##_C_H ) \ + ) + +#ifndef OPENCV_AUTO_LINK +#define OPENCV_AUTO_LINK 1 +#endif + +#endif // #ifndef __OPENCV_PRAGMA_LIB_HPP__ Index: modules/features2d/include/opencv2/features2d/features2d.hpp =================================================================== --- modules/features2d/include/opencv2/features2d/features2d.hpp (revision 7046) +++ modules/features2d/include/opencv2/features2d/features2d.hpp (working copy) @@ -3048,6 +3048,12 @@ #endif /* __cplusplus */ +// Auto linking by "#pragma comment(lib)" syntax +#include "opencv2/core/pragma_lib.hpp" +#if PRAGMA_COMMENT_SUPPORT && OPENCV_AUTO_LINK +#pragma OPENCV_COMMENT_LIB_FNAME("features2d") +#endif // PRAGMA_COMMENT_SUPPORT && OPENCV_AUTO_LINK + #endif /* End of file. */ Index: modules/flann/include/opencv2/flann/flann.hpp =================================================================== --- modules/flann/include/opencv2/flann/flann.hpp (revision 7046) +++ modules/flann/include/opencv2/flann/flann.hpp (working copy) @@ -40,8 +40,8 @@ // //M*/ -#ifndef _OPENCV_FLANN_HPP_ -#define _OPENCV_FLANN_HPP_ +#ifndef __OPENCV_FLANN_HPP__ +#define __OPENCV_FLANN_HPP__ #ifdef __cplusplus @@ -415,5 +415,11 @@ } } // namespace cv::flann #endif // __cplusplus + +// Auto linking by "#pragma comment(lib)" syntax +#include "opencv2/core/pragma_lib.hpp" +#if PRAGMA_COMMENT_SUPPORT && OPENCV_AUTO_LINK +#pragma OPENCV_COMMENT_LIB_FNAME("flann") +#endif // PRAGMA_COMMENT_SUPPORT && OPENCV_AUTO_LINK #endif Index: modules/gpu/include/opencv2/gpu/gpu.hpp =================================================================== --- modules/gpu/include/opencv2/gpu/gpu.hpp (revision 7046) +++ modules/gpu/include/opencv2/gpu/gpu.hpp (working copy) @@ -1565,4 +1565,10 @@ } // namespace cv +// Auto linking by "#pragma comment(lib)" syntax +#include "opencv2/core/pragma_lib.hpp" +#if PRAGMA_COMMENT_SUPPORT && OPENCV_AUTO_LINK +#pragma OPENCV_COMMENT_LIB_FNAME("gpu") +#endif // PRAGMA_COMMENT_SUPPORT && OPENCV_AUTO_LINK + #endif /* __OPENCV_GPU_HPP__ */ Index: modules/highgui/include/opencv2/highgui/highgui.hpp =================================================================== --- modules/highgui/include/opencv2/highgui/highgui.hpp (revision 7046) +++ modules/highgui/include/opencv2/highgui/highgui.hpp (working copy) @@ -253,4 +253,10 @@ #endif +// Auto linking by "#pragma comment(lib)" syntax +#include "opencv2/core/pragma_lib.hpp" +#if PRAGMA_COMMENT_SUPPORT && OPENCV_AUTO_LINK +#pragma OPENCV_COMMENT_LIB_FNAME("highgui") +#endif // PRAGMA_COMMENT_SUPPORT && OPENCV_AUTO_LINK + #endif Index: modules/imgproc/include/opencv2/imgproc/imgproc.hpp =================================================================== --- modules/imgproc/include/opencv2/imgproc/imgproc.hpp (revision 7046) +++ modules/imgproc/include/opencv2/imgproc/imgproc.hpp (working copy) @@ -1149,6 +1149,12 @@ #endif /* __cplusplus */ +// Auto linking by "#pragma comment(lib)" syntax +#include "opencv2/core/pragma_lib.hpp" +#if PRAGMA_COMMENT_SUPPORT && OPENCV_AUTO_LINK +#pragma OPENCV_COMMENT_LIB_FNAME("imgproc") +#endif // PRAGMA_COMMENT_SUPPORT && OPENCV_AUTO_LINK + #endif /* End of file. */ Index: modules/legacy/include/opencv2/legacy/legacy.hpp =================================================================== --- modules/legacy/include/opencv2/legacy/legacy.hpp (revision 7046) +++ modules/legacy/include/opencv2/legacy/legacy.hpp (working copy) @@ -1764,6 +1764,12 @@ //#include "cvvidsurv.hpp" #endif +// Auto linking by "#pragma comment(lib)" syntax +#include "opencv2/core/pragma_lib.hpp" +#if PRAGMA_COMMENT_SUPPORT && OPENCV_AUTO_LINK +#pragma OPENCV_COMMENT_LIB_FNAME("legacy") +#endif // PRAGMA_COMMENT_SUPPORT && OPENCV_AUTO_LINK + #endif /* End of file. */ Index: modules/ml/include/opencv2/ml/ml.hpp =================================================================== --- modules/ml/include/opencv2/ml/ml.hpp (revision 7046) +++ modules/ml/include/opencv2/ml/ml.hpp (working copy) @@ -2156,5 +2156,11 @@ } +// Auto linking by "#pragma comment(lib)" syntax +#include "opencv2/core/pragma_lib.hpp" +#if PRAGMA_COMMENT_SUPPORT && OPENCV_AUTO_LINK +#pragma OPENCV_COMMENT_LIB_FNAME("ml") +#endif // PRAGMA_COMMENT_SUPPORT && OPENCV_AUTO_LINK + #endif /* End of file. */ Index: modules/objdetect/include/opencv2/objdetect/objdetect.hpp =================================================================== --- modules/objdetect/include/opencv2/objdetect/objdetect.hpp (revision 7046) +++ modules/objdetect/include/opencv2/objdetect/objdetect.hpp (working copy) @@ -658,4 +658,10 @@ CV_EXPORTS std::deque cvFindDataMatrix(CvMat *im); #endif +// Auto linking by "#pragma comment(lib)" syntax +#include "opencv2/core/pragma_lib.hpp" +#if PRAGMA_COMMENT_SUPPORT && OPENCV_AUTO_LINK +#pragma OPENCV_COMMENT_LIB_FNAME("objdetect") +#endif // PRAGMA_COMMENT_SUPPORT && OPENCV_AUTO_LINK + #endif Index: modules/stitching/include/opencv2/stitching/stitcher.hpp =================================================================== --- modules/stitching/include/opencv2/stitching/stitcher.hpp (revision 7046) +++ modules/stitching/include/opencv2/stitching/stitcher.hpp (working copy) @@ -167,4 +167,10 @@ } // namespace cv +// Auto linking by "#pragma comment(lib)" syntax +#include "opencv2/core/pragma_lib.hpp" +#if PRAGMA_COMMENT_SUPPORT && OPENCV_AUTO_LINK +#pragma OPENCV_COMMENT_LIB_FNAME("stitching") +#endif // PRAGMA_COMMENT_SUPPORT && OPENCV_AUTO_LINK + #endif // __OPENCV_STITCHING_STITCHER_HPP__ Index: modules/video/include/opencv2/video/video.hpp =================================================================== --- modules/video/include/opencv2/video/video.hpp (revision 7046) +++ modules/video/include/opencv2/video/video.hpp (working copy) @@ -1,49 +1,55 @@ -/*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_VIDEO_HPP__ -#define __OPENCV_VIDEO_HPP__ - -#include "opencv2/video/tracking.hpp" -#include "opencv2/video/background_segm.hpp" - -#endif //__OPENCV_VIDEO_HPP__ +/*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_VIDEO_HPP__ +#define __OPENCV_VIDEO_HPP__ + +#include "opencv2/video/tracking.hpp" +#include "opencv2/video/background_segm.hpp" + +// Auto linking by "#pragma comment(lib)" syntax +#include "opencv2/core/pragma_lib.hpp" +#if PRAGMA_COMMENT_SUPPORT && OPENCV_AUTO_LINK +#pragma OPENCV_COMMENT_LIB_FNAME("video") +#endif // PRAGMA_COMMENT_SUPPORT && OPENCV_AUTO_LINK + +#endif //__OPENCV_VIDEO_HPP__