forked from rpavlik/cmake-modules
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFindDirectShow.cmake
126 lines (112 loc) · 3.28 KB
/
FindDirectShow.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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
# - Find Microsoft DirectShow sample files, library, and headers.
#
# DIRECTSHOW_INCLUDE_DIRS - where to find needed include file
# DIRECTSHOW_BASECLASS_DIR- Directory containing the DirectShow baseclass sample code.
# DIRECTSHOW_FOUND - True if DirectShow found.
#
# Requires these CMake modules:
# FindPackageHandleStandardArgs (known included with CMake >=2.6.2)
#
# Initially in VRPN - Distributed under the Boost Software License, Version 1.0.
#
# Almost entirely re-written by:
# 2012 Ryan Pavlik <[email protected]> <[email protected]>
# http://academic.cleardefinition.com
# Iowa State University HCI Graduate Program/VRAC
#
# Copyright Iowa State University 2012.
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
# Look for one of the sample files.
find_package(WindowsSDK)
find_package(DirectX QUIET)
set(DIRECTSHOW_WINDOWSSDK_ROOT
"${DIRECTSHOW_WINDOWSSDK_ROOT}"
CACHE
PATH
"A specific Windows SDK to use for DirectShow.")
if(MSVC AND CMAKE_CL_64)
set(DIRECTSHOW_LIB_SUBDIR /x64)
else()
set(DIRECTSHOW_LIB_SUBDIR)
endif()
set(_acceptable_winsdk)
if(WINDOWSSDK_FOUND)
foreach(_sdkdir ${WINDOWSSDK_DIRS})
if(EXISTS "${_sdkdir}/Samples/Multimedia/DirectShow/BaseClasses/streams.h"
AND EXISTS "${_sdkdir}/Lib${DIRECTSHOW_LIB_SUBDIR}/strmiids.lib"
AND EXISTS "${_sdkdir}/Include/DShow.h")
list(APPEND _acceptable_winsdk "${_sdkdir}")
endif()
endforeach()
endif()
find_path(DIRECTSHOW_BASECLASS_DIR
NAMES
streams.h
HINTS
"${DIRECTSHOW_WINDOWSSDK_ROOT}"
PATHS
${_acceptable_winsdk}
PATH_SUFFIXES
"Samples/Multimedia/DirectShow/BaseClasses")
find_path(DIRECTSHOW_WINDOWSSDK_INCLUDE_DIR
NAMES
DShow.h
HINTS
"${DIRECTSHOW_WINDOWSSDK_ROOT}"
PATHS
${_acceptable_winsdk}
PATH_SUFFIXES
"Include")
# This one we can grab from another SDK version.
find_path(DIRECTSHOW_QEDIT_INCLUDE_DIR
NAMES
qedit.h
HINTS
"${DIRECTSHOW_WINDOWSSDK_ROOT}"
PATHS
${WINDOWSSDK_DIRS}
PATH_SUFFIXES
"Include")
find_library(DIRECTSHOW_STRMIIDS_LIBRARY
NAMES
strmiids
HINTS
"${DIRECTSHOW_WINDOWSSDK_ROOT}"
PATHS
${_acceptable_winsdk}
PATH_SUFFIXES
"Lib${DIRECTSHOW_LIB_SUBDIR}")
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(DirectShow
DEFAULT_MSG
DIRECTSHOW_BASECLASS_DIR
DIRECTSHOW_WINDOWSSDK_INCLUDE_DIR
DIRECTSHOW_QEDIT_INCLUDE_DIR
DIRECTX_INCLUDE_DIR
DIRECTX_FOUND
DIRECTSHOW_STRMIIDS_LIBRARY)
if(DIRECTSHOW_FOUND)
set(DIRECTSHOW_INCLUDE_DIRS
# Baseclass must be before SDK so it gets the correct refclock.h
"${DIRECTSHOW_BASECLASS_DIR}"
"${DIRECTSHOW_WINDOWSSDK_INCLUDE_DIR}"
"${DIRECTX_INCLUDE_DIR}"
)
if(EXISTS "${DIRECTSHOW_WINDOWSSDK_INCLUDE_DIR}/atl/atlbase.h")
list(APPEND
DIRECTSHOW_INCLUDE_DIRS
"${DIRECTSHOW_WINDOWSSDK_INCLUDE_DIR}/atl")
endif()
if(NOT "${DIRECTSHOW_QEDIT_INCLUDE_DIR}" STREQUAL "${DIRECTSHOW_WINDOWSSDK_INCLUDE_DIR}")
# QEdit include dir might be an older SDK, so put it last.
list(APPEND DIRECTSHOW_INCLUDE_DIRS "${DIRECTSHOW_QEDIT_INCLUDE_DIR}")
endif()
set(DIRECTSHOW_LIBRARIES "${DIRECTSHOW_STRMIIDS_LIBRARY}")
mark_as_advanced(DIRECTSHOW_WINDOWSSDK_ROOT)
endif()
mark_as_advanced(DIRECTSHOW_BASECLASS_DIR
DIRECTSHOW_WINDOWSSDK_INCLUDE_DIR
DIRECTSHOW_QEDIT_INCLUDE_DIR
DIRECTSHOW_STRMIIDS_LIBRARY)