forked from bilibili/ijkplayer
-
Notifications
You must be signed in to change notification settings - Fork 92
/
CMakeLists.txt
85 lines (69 loc) · 2.95 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
#
# Copyright (c) 2019 befovy <befovy@gmail.com>
#
# This file is part of fijkPlayer.
#
# fijkPlayer is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# fijkPlayer is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with ijkPlayer; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
#
cmake_minimum_required(VERSION 3.6)
project("FijkPlayer")
set(CMAKE_C_STANDARD 11)
set(CMAKE_CXX_STANDARD 11)
add_definitions(-DANDROID)
message(STATUS "CMAKE_BUILD_TYPE: ${CMAKE_BUILD_TYPE}")
message(STATUS "ANDROID_PLATFORM_LEVEL:${ANDROID_PLATFORM_LEVEL}")
message(STATUS "ANDROID_ABI:${ANDROID_ABI}")
message(STATUS "PROJECT_SOURCE_DIR ${PROJECT_SOURCE_DIR}")
set(FIJKROOT_PATH "${PROJECT_SOURCE_DIR}/../../../../..")
get_filename_component(FIJKROOT_PATH ${FIJKROOT_PATH} ABSOLUTE)
message(STATUS "FIJKROOT_PATH ${FIJKROOT_PATH}")
if (${CMAKE_BUILD_TYPE} STREQUAL "Release")
add_definitions(-DNDEBUG)
elseif (${CMAKE_BUILD_TYPE} STREQUAL "Debug")
add_definitions(-DDEBUG)
endif ()
add_compile_options("-Wno-deprecated-declarations")
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set(ANDROID_CONTRIB_PATH ${FIJKROOT_PATH}/android/contrib/build)
message(STATUS "ANDROID_CONTRIB_PATH:${ANDROID_CONTRIB_PATH}")
if (${ANDROID_ABI} STREQUAL "arm64-v8a")
set(IJK_FFMPAG_BUILD_DIR ${ANDROID_CONTRIB_PATH}/output-arm64)
elseif (${ANDROID_ABI} STREQUAL "armeabi-v7a")
set(IJK_FFMPAG_BUILD_DIR ${ANDROID_CONTRIB_PATH}/output-armv7a)
elseif (${ANDROID_ABI} STREQUAL "armeabi")
set(IJK_FFMPAG_BUILD_DIR ${ANDROID_CONTRIB_PATH}/output-armv5)
elseif (${ANDROID_ABI} STREQUAL "x86")
set(IJK_FFMPAG_BUILD_DIR ${ANDROID_CONTRIB_PATH}/output-x86)
elseif (${ANDROID_ABI} STREQUAL "x86_64")
set(IJK_FFMPAG_BUILD_DIR ${ANDROID_CONTRIB_PATH}/output-x86_64)
endif ()
if (NOT DEFINED IJK_FFMPAG_BUILD_DIR)
message(FATAL_ERROR "Can not find ffmpeg build output: ${IJK_FFMPAG_BUILD_DIR}")
else ()
message(STATUS "IJK_FFMPAG_BUILD_DIR:${IJK_FFMPAG_BUILD_DIR}")
endif ()
add_library(ijkffmpeg SHARED IMPORTED)
set_target_properties( # Specifies the target library.
ijkffmpeg
PROPERTIES
IMPORTED_LOCATION ${IJK_FFMPAG_BUILD_DIR}/libijkffmpeg.so
)
add_custom_target(cpffmpeg
COMMAND mkdir -p ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}
COMMAND cp ${IJK_FFMPAG_BUILD_DIR}/libijkffmpeg.so ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}
)
add_dependencies(ijkffmpeg cpffmpeg)
message(STATUE "${CMAKE_LIBRARY_OUTPUT_DIRECTORY} ${PROJECT_BINARY_DIR}")
add_subdirectory(${FIJKROOT_PATH}/ijkmedia ijkmedia)