forked from xbmc/inputstream.ffmpegdirect
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
150 lines (133 loc) · 6.06 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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
cmake_minimum_required(VERSION 3.5)
project(inputstream.ffmpegdirect)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR})
find_package(PkgConfig)
if(WIN32)
find_package(LibXml2 REQUIRED)
find_package(Iconv REQUIRED)
find_package(OpenSSL REQUIRED)
endif()
find_package(p8-platform REQUIRED)
find_package(Kodi REQUIRED)
find_package(FFMPEG REQUIRED)
find_package(ZLIB REQUIRED)
find_package(BZip2 REQUIRED)
set(CATCHUP_SOURCES src/StreamManager.cpp
src/stream/DemuxStream.cpp
src/stream/FFmpegCatchupStream.cpp
src/stream/FFmpegLog.cpp
src/stream/FFmpegStream.cpp
src/stream/CurlCatchupInput.cpp
src/stream/CurlInput.cpp
src/stream/commons/Exception.cpp
src/stream/threads/Atomics.cpp
src/stream/threads/Event.cpp
src/stream/threads/Thread.cpp
src/stream/threads/Timer.cpp
src/stream/threads/TimeUtils.cpp
src/stream/threads/SystemClock.cpp
src/stream/TimeshiftBuffer.cpp
src/stream/TimeshiftSegment.cpp
src/stream/TimeshiftStream.cpp
src/stream/url/URL.cpp
src/stream/url/UrlOptions.cpp
src/stream/url/Variant.cpp
src/utils/FilenameUtils.cpp)
set(CATCHUP_HEADERS src/StreamManager.h
src/stream/BaseStream.h
src/stream/DemuxStream.h
src/stream/FFmpegCatchupStream.h
src/stream/FFmpegLog.h
src/stream/FFmpegStream.h
src/stream/CurlCatchupInput.h
src/stream/CurlInput.h
src/stream/IManageDemuxPacket.h
src/stream/commons/Exception.h
src/stream/threads/Atomics.h
src/stream/threads/Condition.h
src/stream/threads/CriticalSection.h
src/stream/threads/Event.h
src/stream/threads/Helpers.h
src/stream/threads/Lockables.h
src/stream/threads/SharedSection.h
src/stream/threads/SingleLock.h
src/stream/threads/SystemClock.h
src/stream/threads/Thread.h
src/stream/threads/Timer.h
src/stream/threads/TimeUtils.h
src/stream/threads/platform/ThreadImpl.h
src/stream/TimeshiftBuffer.h
src/stream/TimeshiftSegment.h
src/stream/TimeshiftStream.h
src/utils/HttpProxy.h
src/utils/FilenameUtils.h
src/utils/Log.h
src/utils/Properties.h
src/stream/url/URL.h
src/stream/url/UrlOptions.h
src/stream/url/Variant.h)
if(NOT WIN32)
list(APPEND CATCHUP_SOURCES src/stream/platform/posix/XTimeUtils.cpp)
list(APPEND CATCHUP_HEADERS src/stream/platform/posix/PlatformDefs.h
src/stream/platform/posix/XTimeUtils.h)
endif()
include_directories(${p8-platform_INCLUDE_DIRS}
${INCLUDES}
${FFMPEG_INCLUDE_DIRS}
${ZLIB_INCLUDE_DIRS}
${BZIP2_INCLUDE_DIRS}
${OPENSSL_INCLUDE_DIR}
${LIBXML2_INCLUDE_DIRS}
${KODI_INCLUDE_DIR}/..) # Hack way with "/..", need bigger Kodi cmake rework to match right include ways (becomes done in future)
# to see linker output
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -v")
# We don't add FFMPEG_LIBRARIES here as we handle them at the end
list(APPEND DEPLIBS ${p8-platform_LIBRARIES}
${ZLIB_LIBRARIES}
${BZIP2_LIBRARIES})
if(WIN32)
# Windows does need to know about FFMPEG_LIBRARIES here
list(APPEND DEPLIBS ${ICONV_LIBRARIES}
${OPENSSL_LIBRARIES}
${LIBXML2_LIBRARIES}
${FFMPEG_LIBRARIES}
Winmm.lib
WS2_32.lib
Bcrypt.lib
Secur32.lib
Mfplat.lib
Mfuuid.lib
Strmiids.lib)
elseif(CORE_SYSTEM_NAME STREQUAL osx OR
CORE_SYSTEM_NAME STREQUAL darwin_embedded)
find_library(AUDIOTOOLBOX AudioToolbox)
find_library(COREFOUNDATION CoreFoundation)
find_library(COREMEDIA CoreMedia)
find_library(VIDEOTOOLBOX VideoToolbox)
find_library(SECURITY Security)
include_directories(${AUDIOTOOLBOX}
${COREFOUNDATION}
${COREMEDIA}
${VIDEOTOOLBOX}
${SECURITY})
list(APPEND DEPLIBS ${AUDIOTOOLBOX} ${COREFOUNDATION} ${COREMEDIA} ${VIDEOTOOLBOX} ${SECURITY})
else()
list(APPEND DEPLIBS ${FFMPEG_LIBRARIES})
endif()
addon_version(inputstream.ffmpegdirect CATCHUP)
add_definitions(-DCATCHUP_VERSION=${CATCHUP_VERSION})
build_addon(inputstream.ffmpegdirect CATCHUP DEPLIBS)
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
# Due to a bug in CMake and frameworks on OSX we strip them from FFMPEG_LDFLAGS
string(REGEX REPLACE "-framework;([A-Za-z0-9_]+);?" "" FFMPEG_LDFLAGS "${FFMPEG_LDFLAGS}")
endif()
# Now remove ';''s for all platforms and allow CMake to add them back
string(REGEX REPLACE ";" " " FFMPEG_LDFLAGS "${FFMPEG_LDFLAGS}")
set_target_properties(inputstream.ffmpegdirect PROPERTIES LINK_FLAGS "${FFMPEG_LDFLAGS}")
if(CORE_SYSTEM_NAME STREQUAL windowsstore)
# fix linking
set_target_properties(inputstream.ffmpegdirect PROPERTIES LINK_FLAGS_RELWITHDEBINFO "/LTCG /defaultlib:vccorlib.lib /defaultlib:msvcrt.lib")
set_target_properties(inputstream.ffmpegdirect PROPERTIES LINK_FLAGS_RELEASE "/LTCG /defaultlib:vccorlib.lib /defaultlib:msvcrt.lib")
set_target_properties(inputstream.ffmpegdirect PROPERTIES LINK_FLAGS_DEBUG "/LTCG /defaultlib:vccorlibd.lib /defaultlib:msvcrtd.lib")
endif()
include(CPack)