-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
129 lines (113 loc) · 3.32 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
#*******************************************************************************
# libavio/CMakeLists.txt
#
# Copyright (c) 2022, 2024 Stephen Rhodes
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
#******************************************************************************/
cmake_minimum_required(VERSION 3.17)
project(libavio VERSION 3.2.5)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED True)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D__STDC_CONSTANT_MACROS")
#add_compile_options("-g")
# pass current dir in from host when building in virtual env
set (MY_CURRENT_DIR ${CMAKE_CURRENT_SOURCE_DIR})
if (DEFINED ENV{CMAKE_CURRENT_SOURCE_DIR})
set(MY_CURRENT_DIR $ENV{CMAKE_CURRENT_SOURCE_DIR})
endif()
file(TO_CMAKE_PATH "${MY_CURRENT_DIR}" MY_DIR_VAR)
list(PREPEND CMAKE_MODULE_PATH ${MY_DIR_VAR}/cmake)
if(WIN32)
list(PREPEND CMAKE_MODULE_PATH ${MY_DIR_VAR}/cmake-win)
add_compile_options(/EHsc /MT)
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS TRUE)
set(BUILD_SHARED_LIBS TRUE)
endif()
add_definitions(-w)
find_package(FFmpeg REQUIRED)
find_package(SDL2 REQUIRED)
if (NOT WITHOUT_LIBS)
add_library(libavio SHARED
src/Clock.cpp
src/Decoder.cpp
src/Display.cpp
src/Encoder.cpp
src/Exception.cpp
src/Filter.cpp
src/Frame.cpp
src/Packet.cpp
src/Pipe.cpp
src/Player.cpp
src/Reader.cpp
src/Writer.cpp
)
if (WIN32)
target_link_libraries(libavio PUBLIC
FFmpeg::FFmpeg
SDL2::SDL2
)
else()
target_link_libraries(libavio PUBLIC
FFmpeg::FFmpeg
SDL2::SDL2
pthread
)
set_target_properties(libavio PROPERTIES
OUTPUT_NAME avio
SOVERSION 1
)
endif()
target_include_directories(libavio PUBLIC
include
${FFMPEG_INCLUDE_DIRS}
${SDL2_INCLUDE_DIRS}
)
endif()
if (NOT WITHOUT_PYTHON)
add_subdirectory(pybind11)
pybind11_add_module(avio
src/avio.cpp
src/Clock.cpp
src/Decoder.cpp
src/Display.cpp
src/Encoder.cpp
src/Exception.cpp
src/Filter.cpp
src/Frame.cpp
src/Packet.cpp
src/Pipe.cpp
src/Player.cpp
src/Reader.cpp
src/Writer.cpp
)
target_link_libraries(avio PRIVATE
FFmpeg::FFmpeg
SDL2::SDL2
)
target_include_directories(avio SYSTEM PUBLIC
include
)
endif()
#IF (BUILD_TEST)
# add_executable(avio-test
# test/avio-test.cpp
# )
# target_link_libraries(avio-test PRIVATE
# libavio
# )
# target_include_directories(avio-test PUBLIC
# include
# )
#endif()