forked from opencv/opencv
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathOpenCVDetectMediaSDK.cmake
59 lines (51 loc) · 1.54 KB
/
OpenCVDetectMediaSDK.cmake
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
set(HAVE_MFX 0)
if (UNIX)
set(root "$ENV{MFX_HOME}")
elseif(WIN32)
set(root "$ENV{INTELMEDIASDKROOT}")
endif()
# TODO: ICC? MINGW? ARM? IOS?
if(WIN32)
if(X86_64)
set(arch "x64")
else()
set(arch "win32")
endif()
elseif(UNIX)
set(arch "lin_x64")
else()
# ???
endif()
find_path(MFX_INCLUDE mfxdefs.h PATHS "${root}/include" NO_DEFAULT_PATH)
message(STATUS "MFX_INCLUDE: ${MFX_INCLUDE} (${root}/include)")
find_library(MFX_LIBRARY NAMES mfx PATHS "${root}/lib/${arch}" NO_DEFAULT_PATH)
if(MSVC)
if(MSVC14)
find_library(MFX_LIBRARY NAMES libmfx_vs2015.lib PATHS "${root}/lib/${arch}" NO_DEFAULT_PATH)
else()
find_library(MFX_LIBRARY NAMES libmfx.lib PATHS "${root}/lib/${arch}" NO_DEFAULT_PATH)
endif()
endif()
if(NOT MFX_INCLUDE OR NOT MFX_LIBRARY)
return()
endif()
set(deps)
if (UNIX)
find_library(MFX_VA_LIBRARY va)
find_library(MFX_VA_DRM_LIBRARY va-drm)
if (NOT MFX_VA_LIBRARY OR NOT MFX_VA_DRM_LIBRARY)
return()
endif()
add_library(mfx-va UNKNOWN IMPORTED)
set_target_properties(mfx-va PROPERTIES IMPORTED_LOCATION "${MFX_VA_LIBRARY}")
add_library(mfx-va-drm UNKNOWN IMPORTED)
set_target_properties(mfx-va-drm PROPERTIES IMPORTED_LOCATION "${MFX_VA_DRM_LIBRARY}")
list(APPEND deps mfx-va mfx-va-drm "-Wl,--exclude-libs=libmfx")
endif()
add_library(mfx UNKNOWN IMPORTED)
set_target_properties(mfx PROPERTIES
IMPORTED_LOCATION "${MFX_LIBRARY}"
INTERFACE_INCLUDE_DIRECTORIES "${MFX_INCLUDE}"
INTERFACE_LINK_LIBRARIES "${deps}"
)
set(HAVE_MFX 1)