-
Notifications
You must be signed in to change notification settings - Fork 180
/
CMakeLists.txt
121 lines (103 loc) · 4.02 KB
/
CMakeLists.txt
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
cmake_minimum_required(VERSION 2.8.12)
project(libdshowcapture)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules/")
option(BUILD_SHARED_LIBS "Build shared library" ON)
find_package(CXX11 REQUIRED)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CXX11_FLAGS}")
if(${CMAKE_C_COMPILER_ID} MATCHES "Clang" OR ${CMAKE_CXX_COMPILER_ID} MATCHES
"Clang")
set(CMAKE_COMPILER_IS_CLANG TRUE)
endif()
if(CMAKE_COMPILER_IS_GNUCC
OR CMAKE_COMPILER_IS_GNUCXX
OR CMAKE_COMPILER_IS_CLANG)
set(CMAKE_CXX_FLAGS
"-Wall -Wextra -Wno-unused-function -Werror-implicit-function-declaration -Wno-missing-field-initializers ${CMAKE_CXX_FLAGS} -fno-strict-aliasing"
)
set(CMAKE_C_FLAGS
"-Wall -Wextra -Wno-unused-function -Werror-implicit-function-declaration -Wno-missing-braces -Wno-missing-field-initializers ${CMAKE_C_FLAGS} -std=gnu99 -fno-strict-aliasing"
)
option(USE_LIBC++ "Use libc++ instead of libstdc++" ${APPLE})
if(USE_LIBC++)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")
endif()
elseif(MSVC)
if(CMAKE_CXX_FLAGS MATCHES "/W[0-4]")
string(REGEX REPLACE "/W[0-4]" "/W4" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4")
endif()
# Disable pointless constant condition warnings
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4127 /wd4201")
endif()
if(WIN32)
add_definitions(-DUNICODE -D_UNICODE)
if(BUILD_SHARED_LIBS)
add_definitions(-DDSHOWCAPTURE_EXPORTS)
endif()
endif()
if(MSVC)
set(CMAKE_C_FLAGS_DEBUG "/DDEBUG=1 /D_DEBUG=1 ${CMAKE_C_FLAGS_DEBUG}")
set(CMAKE_CXX_FLAGS_DEBUG "/DDEBUG=1 /D_DEBUG=1 ${CMAKE_C_FLAGS_DEBUG}")
if(NOT CMAKE_SIZEOF_VOID_P EQUAL 8)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /SAFESEH:NO")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /SAFESEH:NO")
set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} /SAFESEH:NO")
endif()
else()
if(MINGW)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_WIN32_WINNT=0x0600 -DWINVER=0x0600")
set(CMAKE_CXX_FLAGS
"${CMAKE_CXX_FLAGS} -D_WIN32_WINNT=0x0600 -DWINVER=0x0600")
endif()
set(CMAKE_C_FLAGS_DEBUG "-DDEBUG=1 -D_DEBUG=1 ${CMAKE_C_FLAGS_DEBUG}")
set(CMAKE_CXX_FLAGS_DEBUG "-DDEBUG=1 -D_DEBUG=1 ${CMAKE_CXX_FLAGS_DEBUG}")
endif()
if(MINGW)
include(CheckSymbolExists)
check_symbol_exists(MINGW_HAS_SECURE_API "_mingw.h" HAVE_MINGW_HAS_SECURE_API)
if(NOT HAVE_MINGW_HAS_SECURE_API)
message(FATAL_ERROR "mingw must be compiled with --enable-secure-api")
endif()
endif()
set(libdshowcapture_SOURCES
external/capture-device-support/Library/EGAVResult.cpp
external/capture-device-support/Library/ElgatoUVCDevice.cpp
external/capture-device-support/Library/win/EGAVHIDImplementation.cpp
external/capture-device-support/SampleCode/DriverInterface.cpp
source/capture-filter.cpp
source/output-filter.cpp
source/dshowcapture.cpp
source/dshowencode.cpp
source/device.cpp
source/device-vendor.cpp
source/encoder.cpp
source/dshow-base.cpp
source/dshow-demux.cpp
source/dshow-enum.cpp
source/dshow-formats.cpp
source/dshow-media-type.cpp
source/dshow-encoded-device.cpp
source/log.cpp)
set(libdshowcapture_HEADERS
dshowcapture.hpp
source/external/IVideoCaptureFilter.h
source/capture-filter.hpp
source/output-filter.hpp
source/device.hpp
source/encoder.hpp
source/dshow-base.hpp
source/dshow-demux.hpp
source/dshow-device-defs.hpp
source/dshow-enum.hpp
source/dshow-formats.hpp
source/dshow-media-type.hpp
source/log.hpp)
add_library(libdshowcapture ${libdshowcapture_SOURCES}
${libdshowcapture_HEADERS})
target_include_directories(
libdshowcapture
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/external/capture-device-support/Library)
target_compile_definitions(libdshowcapture PRIVATE _UP_WINDOWS=1)
target_link_libraries(libdshowcapture PRIVATE setupapi strmiids ksuser winmm
wmcodecdspuuid)