2013-08-07 10:53:48 +02:00
|
|
|
# Detect if we want to build samples with library binaries or not
|
|
|
|
if(NOT CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_LIST_DIR)
|
|
|
|
#
|
|
|
|
# BUILD CASE 1: Build samples with library sources
|
|
|
|
#
|
|
|
|
|
|
|
|
|
2010-05-11 19:44:00 +02:00
|
|
|
# ----------------------------------------------------------------------------
|
2012-06-27 14:02:31 +02:00
|
|
|
# CMake file for samples. See root CMakeLists.txt
|
2010-05-11 19:44:00 +02:00
|
|
|
#
|
|
|
|
# ----------------------------------------------------------------------------
|
|
|
|
|
2012-06-27 14:02:31 +02:00
|
|
|
add_subdirectory(cpp)
|
|
|
|
add_subdirectory(gpu)
|
2013-12-28 23:28:43 +01:00
|
|
|
add_subdirectory(tapi)
|
2011-06-30 15:37:56 +02:00
|
|
|
|
2013-12-01 22:50:24 +01:00
|
|
|
if(WIN32 AND HAVE_DIRECTX)
|
|
|
|
add_subdirectory(directx)
|
|
|
|
endif()
|
|
|
|
|
2015-06-01 17:16:22 +02:00
|
|
|
if((NOT ANDROID) AND HAVE_OPENGL)
|
|
|
|
add_subdirectory(opengl)
|
|
|
|
endif()
|
|
|
|
|
2015-09-10 18:30:19 +02:00
|
|
|
if(UNIX AND NOT ANDROID AND (HAVE_VA OR HAVE_VA_INTEL))
|
2015-08-31 01:33:15 +02:00
|
|
|
add_subdirectory(va_intel)
|
2015-08-12 10:59:05 +02:00
|
|
|
endif()
|
|
|
|
|
2012-02-03 12:26:49 +01:00
|
|
|
if(ANDROID AND BUILD_ANDROID_EXAMPLES)
|
|
|
|
add_subdirectory(android)
|
2010-12-05 02:19:36 +01:00
|
|
|
endif()
|
2013-08-07 10:53:48 +02:00
|
|
|
|
2014-12-30 11:13:10 +01:00
|
|
|
if(INSTALL_PYTHON_EXAMPLES)
|
2015-12-16 14:36:03 +01:00
|
|
|
add_subdirectory(python)
|
2014-12-30 11:13:10 +01:00
|
|
|
endif()
|
|
|
|
|
2013-08-07 10:53:48 +02:00
|
|
|
#
|
|
|
|
# END OF BUILD CASE 1: Build samples with library sources
|
|
|
|
#
|
|
|
|
else()
|
|
|
|
#
|
|
|
|
# BUILD CASE 2: Build samples with library binaries
|
|
|
|
#
|
|
|
|
cmake_minimum_required(VERSION 2.8)
|
|
|
|
|
|
|
|
project(samples C CXX)
|
|
|
|
option(BUILD_EXAMPLES "Build samples" ON)
|
|
|
|
|
|
|
|
find_package(OpenCV REQUIRED)
|
|
|
|
|
|
|
|
if(MSVC)
|
|
|
|
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
|
2013-10-03 16:48:07 +02:00
|
|
|
|
|
|
|
if(NOT OpenCV_SHARED)
|
|
|
|
foreach(flag_var
|
|
|
|
CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE
|
|
|
|
CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO
|
|
|
|
CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE
|
|
|
|
CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO)
|
|
|
|
if(${flag_var} MATCHES "/MD")
|
|
|
|
string(REGEX REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}")
|
|
|
|
endif()
|
|
|
|
if(${flag_var} MATCHES "/MDd")
|
|
|
|
string(REGEX REPLACE "/MDd" "/MTd" ${flag_var} "${${flag_var}}")
|
|
|
|
endif()
|
|
|
|
endforeach(flag_var)
|
|
|
|
|
|
|
|
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /NODEFAULTLIB:atlthunk.lib /NODEFAULTLIB:msvcrt.lib /NODEFAULTLIB:msvcrtd.lib")
|
|
|
|
set(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} /NODEFAULTLIB:libcmt.lib")
|
|
|
|
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /NODEFAULTLIB:libcmtd.lib")
|
|
|
|
endif()
|
2013-08-07 10:53:48 +02:00
|
|
|
endif()
|
|
|
|
|
|
|
|
add_subdirectory(cpp)
|
2013-10-03 16:48:07 +02:00
|
|
|
# FIXIT: can't use cvconfig.h in samples: add_subdirectory(gpu)
|
2013-08-07 10:53:48 +02:00
|
|
|
|
OpenCV-OpenCL interop (PR #4072):
Commits:
added new function, cv::ocl::attachContext(String& platformName, void* platformID, void* context, void* deviceID) which allow to attach externally created OpenCL context to OpenCV.
add definitions of clRetainDevice, clRetainContext funcs
removed definitions for clRetainContext, clRetainDevice
fixed build issue under Linux
fixed uninitialized vars, replace dbgassert in error handling
remove function which is not ready yet
add new function, cv::ocl::convertFromBuffer(int rows, int cols, int type, void* cl_mem_obj, UMat& dst, UMatUsageFlags usageFlags = cv::USAGE_DEFAULT) which attaches user allocated OpenCL clBuffer to UMat
uncommented clGetMemObjectInfo definition (otherwise prevent opencv build)
fixed build issue on linux and android
add step parameter to cv::ocl::convertFromBuffer func
suppress compile-time warning
added sample opencl-opencv interoperability (showcase for cv::ocl::convertFromBuffer func)
CMakeLists.txt modified to not create sample build script if OpenCL SDK not found in system
fixed build issue (apple opencl include dir and spaces in CMake file)
added call to clRetainContext for attachContext func and call to clRetainMemObject for convertFromBuffer func
uncommented clRetainMemObject definition
added comments and cleanup
add local path to cmake modules search dirs (instead of replacing)
remove REQUIRED for find_package call (sample build together with opencv). need to try standalone sample build
opencl-interop sample moved to standalone build
set minimum version requirement for sample's cmake to 3.1
put cmake_minimum_required under condition, so do not check if samples not builded
remove code dups for setSize, updateContinuityFlag, and finalizeHdr
commented out cmake_minimum_required(VERSION 3.1)
add safety check for cmake version
add convertFromImage func and update opencl-interop sample
uncommented clGetImageInfo defs
uncommented clEnqueueCopyImageToBuffer defs
fixed clEnqueueCopyImageToBuffer defs
add doxygen comments
remove doxygen @fn tag
try to restart buildbot
add doxygen comments to directx interop funcs
remove internal header, use fwd declarations in affected compile units instead
2015-05-27 22:22:33 +02:00
|
|
|
add_subdirectory(opencl)
|
|
|
|
|
2013-12-01 22:50:24 +01:00
|
|
|
if(WIN32)
|
|
|
|
add_subdirectory(directx)
|
|
|
|
endif()
|
|
|
|
|
2013-08-07 10:53:48 +02:00
|
|
|
#
|
|
|
|
# END OF BUILD CASE 2: Build samples with library binaries
|
|
|
|
#
|
2013-12-28 23:28:43 +01:00
|
|
|
endif()
|