OpenCVDetectDirectX.cmake 895 B

123456789101112131415161718192021222324252627282930313233
  1. if(WIN32)
  2. try_compile(__VALID_DIRECTX
  3. "${OpenCV_BINARY_DIR}"
  4. "${OpenCV_SOURCE_DIR}/cmake/checks/directx.cpp"
  5. LINK_LIBRARIES d3d11
  6. OUTPUT_VARIABLE TRY_OUT
  7. )
  8. if(NOT __VALID_DIRECTX)
  9. message(STATUS "No support for DirectX (install Windows 8 SDK)")
  10. return()
  11. endif()
  12. try_compile(__VALID_DIRECTX_NV12
  13. "${OpenCV_BINARY_DIR}"
  14. "${OpenCV_SOURCE_DIR}/cmake/checks/directx.cpp"
  15. COMPILE_DEFINITIONS "-DCHECK_NV12"
  16. LINK_LIBRARIES d3d11
  17. OUTPUT_VARIABLE TRY_OUT
  18. )
  19. if(__VALID_DIRECTX_NV12)
  20. set(HAVE_DIRECTX_NV12 ON)
  21. else()
  22. message(STATUS "No support for DirectX NV12 format (install Windows 8 SDK)")
  23. endif()
  24. set(HAVE_DIRECTX ON)
  25. set(HAVE_D3D11 ON)
  26. set(HAVE_D3D10 ON)
  27. set(HAVE_D3D9 ON)
  28. if(HAVE_OPENCL AND WITH_OPENCL_D3D11_NV AND EXISTS "${OPENCL_INCLUDE_DIR}/CL/cl_d3d11_ext.h")
  29. set(HAVE_OPENCL_D3D11_NV ON)
  30. endif()
  31. endif()