diff --git a/modules/ts/include/opencv2/ts.hpp b/modules/ts/include/opencv2/ts.hpp index b0416daad1266cf46a7629979b45fa3d16ea55f9..2cd07767953d893f37b935819978dfdfa1005a4a 100644 --- a/modules/ts/include/opencv2/ts.hpp +++ b/modules/ts/include/opencv2/ts.hpp @@ -4,6 +4,14 @@ #include "opencv2/core/cvdef.h" #include // for va_list +#include "cvconfig.h" + +#ifndef GTEST_CREATE_SHARED_LIBRARY +#ifdef BUILD_SHARED_LIBS +#define GTEST_LINKED_AS_SHARED_LIBRARY 1 +#endif +#endif + #ifdef _MSC_VER #pragma warning( disable: 4127 ) #endif diff --git a/modules/ts/include/opencv2/ts/ts_gtest.h b/modules/ts/include/opencv2/ts/ts_gtest.h index 4bce30848f37b26d8d42f0a030e32d85600d3fa4..3ccf48584a9c2a8e508d2fe16041a6f4f506dbcc 100644 --- a/modules/ts/include/opencv2/ts/ts_gtest.h +++ b/modules/ts/include/opencv2/ts/ts_gtest.h @@ -1912,7 +1912,19 @@ using ::std::tuple_size; #endif // GTEST_HAS_SEH -#define GTEST_API_ CV_EXPORTS +#ifdef _MSC_VER + +# if GTEST_LINKED_AS_SHARED_LIBRARY +# define GTEST_API_ __declspec(dllimport) +# elif GTEST_CREATE_SHARED_LIBRARY +# define GTEST_API_ __declspec(dllexport) +# endif + +#endif // _MSC_VER + +#ifndef GTEST_API_ +# define GTEST_API_ CV_EXPORTS +#endif #ifdef __GNUC__ // Ask the compiler to never inline a given function. diff --git a/modules/ts/include/opencv2/ts/ts_perf.hpp b/modules/ts/include/opencv2/ts/ts_perf.hpp index 93e5d28656890809c56564dfb0928e73b14069c8..2f555767005d8957d3f4dfbc82d7d0b0d278c1f0 100644 --- a/modules/ts/include/opencv2/ts/ts_perf.hpp +++ b/modules/ts/include/opencv2/ts/ts_perf.hpp @@ -1,6 +1,14 @@ #ifndef __OPENCV_TS_PERF_HPP__ #define __OPENCV_TS_PERF_HPP__ +#include "cvconfig.h" + +#ifndef GTEST_CREATE_SHARED_LIBRARY +# ifdef BUILD_SHARED_LIBS +# define GTEST_LINKED_AS_SHARED_LIBRARY 1 +# endif +#endif + #include "opencv2/core.hpp" #include "ts_gtest.h"