opencv/samples/CMakeLists.txt
Alexey Ershov 3f68787051 OpenGL OpenCL sample
057cd52 first versions: cv::ogl::convertFromGLTexture2D & cv::ogl::convertToGLTexture2D
5656e94 added autogenerated stuff for cl_gl.h
765f1fd resolved CL functions in opengl.cpp
9f9fee3 implemented function cv::ogl::ocl::initializeContextFromGLTexture2D()
a792adb cv::ogl::ocl::initializeContextFromGLTexture2D() - added linux support (glx.h)
51c2869 added missing error message in function cv::ogl::ocl::initializeContextFromGLTexture2D()
513b887 fixed extension call in function cv::ogl::ocl::initializeContextFromGLTexture2D()
475a3e9 added CL-GL interop Windows sample (gpu/opengl_interop.cpp)
07af28f added building of CL-GL interop sample - Windows only
befe3a2 fixed whitespace errors & doxygen warnings (precommit_docs)
551251a changed function name to cv::ogl::ocl::initializeContextFromGL(), removed unused argument
4d5f009 changed CL_DEVICES_FOR_GL_CONTEXT_KHR to CL_CURRENT_DEVICE_FOR_GL_CONTEXT_KHR
9fc3055 changed CL_DEVICES_FOR_GL_CONTEXT_KHR to CL_CURRENT_DEVICE_FOR_GL_CONTEXT_KH
6d31cee Revert "changed CL_DEVICES_FOR_GL_CONTEXT_KHR to CL_CURRENT_DEVICE_FOR_GL_CONTEXT_KH"
cc6a025 added texture format check in cv::ogl::convertFromGLTexture2D()
063a2c1 CL-GL sample: added Linux implementation (Xlib/GLX)
c392ae9 fixed trailing whitespace
85a80d0 fixed include files
ae23628 excluded samples/opengl from build case 2
9870ea5 added android EGL support
530b64c added doxygen documentation comments to CL-GL interop functions
2015-06-26 14:15:12 +03:00

83 lines
2.2 KiB
CMake

# 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
#
# ----------------------------------------------------------------------------
# CMake file for samples. See root CMakeLists.txt
#
# ----------------------------------------------------------------------------
add_subdirectory(cpp)
add_subdirectory(gpu)
add_subdirectory(tapi)
if(WIN32 AND HAVE_DIRECTX)
add_subdirectory(directx)
endif()
if((NOT ANDROID) AND HAVE_OPENGL)
add_subdirectory(opengl)
endif()
if(ANDROID AND BUILD_ANDROID_EXAMPLES)
add_subdirectory(android)
endif()
if(INSTALL_PYTHON_EXAMPLES)
add_subdirectory(python2)
endif()
#
# 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)
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()
endif()
add_subdirectory(cpp)
# FIXIT: can't use cvconfig.h in samples: add_subdirectory(gpu)
add_subdirectory(opencl)
if(WIN32)
add_subdirectory(directx)
endif()
#
# END OF BUILD CASE 2: Build samples with library binaries
#
endif()