mirror of
https://github.com/opencv/opencv.git
synced 2024-12-15 18:01:37 +08:00
6cf0910842
* cmake: Fix DirectX detection in mingw The pragma comment directive is valid for MSVC only. So, the DirectX detection fails in mingw. The failure is fixed by adding the required linking library (here d3d11) in the try_compile() function in OpenCVDetectDirectX.cmake file. Also add a message if the first DirectX check fails. * gapi: Fix compilation with mingw These changes remove MSVC specific pragma directive. The compilation fails at linking time due to absence of proper linking library. The required libraries are added in corresponding CMakeLists.txt file. * samples: Fix compilation with mingw These changes remove MSVC specific pragma directive. The compilation fails at linking time due to absence of proper linking library. The required libraries are added in corresponding CMakeLists.txt file.
34 lines
895 B
CMake
34 lines
895 B
CMake
if(WIN32)
|
|
try_compile(__VALID_DIRECTX
|
|
"${OpenCV_BINARY_DIR}"
|
|
"${OpenCV_SOURCE_DIR}/cmake/checks/directx.cpp"
|
|
LINK_LIBRARIES d3d11
|
|
OUTPUT_VARIABLE TRY_OUT
|
|
)
|
|
if(NOT __VALID_DIRECTX)
|
|
message(STATUS "No support for DirectX (install Windows 8 SDK)")
|
|
return()
|
|
endif()
|
|
try_compile(__VALID_DIRECTX_NV12
|
|
"${OpenCV_BINARY_DIR}"
|
|
"${OpenCV_SOURCE_DIR}/cmake/checks/directx.cpp"
|
|
COMPILE_DEFINITIONS "-DCHECK_NV12"
|
|
LINK_LIBRARIES d3d11
|
|
OUTPUT_VARIABLE TRY_OUT
|
|
)
|
|
if(__VALID_DIRECTX_NV12)
|
|
set(HAVE_DIRECTX_NV12 ON)
|
|
else()
|
|
message(STATUS "No support for DirectX NV12 format (install Windows 8 SDK)")
|
|
endif()
|
|
set(HAVE_DIRECTX ON)
|
|
set(HAVE_D3D11 ON)
|
|
set(HAVE_D3D10 ON)
|
|
set(HAVE_D3D9 ON)
|
|
|
|
if(HAVE_OPENCL AND WITH_OPENCL_D3D11_NV AND EXISTS "${OPENCL_INCLUDE_DIR}/CL/cl_d3d11_ext.h")
|
|
set(HAVE_OPENCL_D3D11_NV ON)
|
|
endif()
|
|
|
|
endif()
|