• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 2022-2022 Huawei Device Co., Ltd.
2# Licensed under the Apache License, Version 2.0 (the "License");
3# you may not use this file except in compliance with the License.
4# You may obtain a copy of the License at
5#
6#     http://www.apache.org/licenses/LICENSE-2.0
7#
8# Unless required by applicable law or agreed to in writing, software
9# distributed under the License is distributed on an "AS IS" BASIS,
10# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11# See the License for the specific language governing permissions and
12# limitations under the License.
13
14IF (MSVC)
15    ADD_DEFINITIONS(-DMSVC_VMG_ENABLED /std:c++11)  #  /Z7)
16    SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /vmg")
17ENDIF (MSVC)
18
19#IF(UNIX)
20#MESSAGE("UNIX")
21#ADD_DEFINITIONS(
22#    -g -ggdb
23#)
24#ENDIF(UNIX)
25
26IF (UNIX AND NOT CYGWIN)
27    ADD_DEFINITIONS(
28            -fPIC -DPROFILE
29    )
30    if (${OHOS_LITE})
31        set(CMAKE_CXX_FLAGS "-g -ggdb3 -O0 -Wall -Wl,--disable-new-dtags")
32    else()
33        set(CMAKE_CXX_FLAGS "-g -ggdb3 -O0 -std=c++17 -Wall -Wl,--disable-new-dtags")
34    endif()
35
36ENDIF (UNIX AND NOT CYGWIN)
37
38ADD_DEFINITIONS(
39        -D__STDC_FORMAT_MACROS
40        -DHST_PLUGIN_PATH="./"
41)
42if (WIN32)
43add_definitions( -DHST_PLUGIN_FILE_TAIL=".dll" )
44else()
45add_definitions( -DHST_PLUGIN_FILE_TAIL=".so" )
46endif()
47
48IF (CMAKE_CL_64)
49    ADD_DEFINITIONS(-DWIN64)
50ENDIF (CMAKE_CL_64)
51
52######################################################
53# include directories
54include_directories(
55        ${TOP_DIR}/engine
56        ${TOP_DIR}/engine/scene/player
57        ${TOP_DIR}/engine/scene/recorder
58        ${TOP_DIR}/engine/pipeline
59        ${TOP_DIR}/engine/pipeline/core
60        ${TOP_DIR}/engine/foundation
61        ${TOP_DIR}/engine/foundation/osal
62        ${TOP_DIR}/engine/foundation/utils
63        ${TOP_DIR}/engine/pipeline/filters
64        ${TOP_DIR}/engine/pipeline/filters/player
65        ${TOP_DIR}/engine/plugin
66)
67
68if (AVS3DA_ENABLE)
69    include_directories(
70        ${HISTREAMER_PLUGINS_DIR}/codec/avs3_audio_decoder/avs3_codec/libavs3_common
71        ${HISTREAMER_PLUGINS_DIR}/codec/avs3_audio_decoder/avs3_codec/avs3Decoder/include
72        ${HISTREAMER_PLUGINS_DIR}/codec/avs3_audio_decoder/avs3_render
73    )
74endif ()
75
76if (NOT ${OHOS_LITE})
77    message(STATUS "media interface header included.")
78    include_directories(
79            ${TOP_DIR}/engine/scene/standard
80    )
81endif ()
82
83######################################################
84
85file(GLOB_RECURSE HISTREAMER_BASE_SRCS
86        ${TOP_DIR}/engine/pipeline/*.cpp
87        ${TOP_DIR}/engine/plugin/common/*.cpp
88        ${TOP_DIR}/engine/plugin/core/*.cpp
89        ${TOP_DIR}/engine/plugin/core/hdi_codec/*.cpp
90        ${TOP_DIR}/engine/plugin/types/*.cpp
91        ${TOP_DIR}/engine/scene/player/internal/*.cpp
92        ${TOP_DIR}/engine/scene/recorder/internal/*.cpp
93        ${TOP_DIR}/engine/scene/common/*.cpp
94        ${TOP_DIR}/engine/foundation/*.cpp
95        ${TOP_DIR}/engine/foundation/utils/*.cpp
96        )
97
98file(GLOB_RECURSE COMMON_PLUGIN_SRCS
99        ${TOP_DIR}/engine/plugin/plugins/demuxer/wav_demuxer/*.cpp
100        ${TOP_DIR}/engine/plugin/plugins/ffmpeg_adapter/*.cpp
101        ${TOP_DIR}/engine/plugin/plugins/sink/sdl/*.cpp
102        ${TOP_DIR}/engine/plugin/plugins/sink/file_sink/*.cpp
103        ${TOP_DIR}/engine/plugin/plugins/source/file_source/*.cpp
104        ${TOP_DIR}/engine/plugin/plugins/minimp3_adapter/*.cpp
105        ${TOP_DIR}/engine/plugin/plugins/minimp3_adapter/*.c
106        ${TOP_DIR}/engine/plugin/plugins/source/http_source/*.cpp
107        ${TOP_DIR}/engine/plugin/plugins/source/http_source_test/*.cpp
108        ${TOP_DIR}/engine/plugin/plugins/source/stream_source/*.cpp
109        ${TOP_DIR}/engine/plugin/plugins/source/std_stream_source/*.cpp
110)
111
112if (AVS3DA_ENABLE)
113    file(GLOB_RECURSE AVS3DA_PLUGIN_SRCS
114        ${HISTREAMER_PLUGINS_DIR}/codec/avs3_audio_decoder/avs3_codec/libavs3_common/*.c
115        ${HISTREAMER_PLUGINS_DIR}/codec/avs3_audio_decoder/avs3_codec/avs3Decoder/src/*.c
116        ${HISTREAMER_PLUGINS_DIR}/codec/avs3_audio_decoder/avs3_render/*.c
117        ${HISTREAMER_PLUGINS_DIR}/codec/avs3_audio_decoder/*.cpp
118    )
119endif()
120
121if (OHOS_LITE)
122    message(STATUS "#1 player lite source")
123    file(GLOB_RECURSE PLAYER_SRCS
124            ${TOP_DIR}/engine/scene/lite/*.cpp
125            ${TOP_DIR}/engine/scene/player/lite/*.cpp
126            )
127    message(STATUS "#1 recorder lite source")
128    file(GLOB_RECURSE RECORDER_SRCS
129            ${TOP_DIR}/engine/scene/lite/*.cpp
130            ${TOP_DIR}/engine/scene/recorder/lite/*.cpp
131            )
132else ()
133    message(STATUS "player standard source")
134    file(GLOB_RECURSE PLAYER_SRCS
135            ${TOP_DIR}/engine/scene/standard/*.cpp
136            ${TOP_DIR}/engine/scene/player/standard/*.cpp
137            )
138    message(STATUS "recorder standard source")
139    file(GLOB_RECURSE RECORDER_SRCS
140            ${TOP_DIR}/engine/scene/standard/*.cpp
141            ${TOP_DIR}/engine/scene/recorder/standard/*.cpp
142            )
143    file(GLOB_RECURSE PLAT_PLUGIN_SRCS
144            ${TOP_DIR}/engine/plugin/plugins/source/audio_capture/*.cpp
145            ${TOP_DIR}/engine/plugin/plugins/source/video_capture/*.cpp
146            )
147endif ()
148
149set(HISTREAMER_SRCS ${HISTREAMER_BASE_SRCS} ${PLAYER_SRCS} ${RECORDER_SRCS} ${COMMON_PLUGIN_SRCS} ${AVS3DA_PLUGIN_SRCS} ${PLAT_PLUGIN_SRCS})
150
151file(GLOB_RECURSE PLUGINS_STATIC_BUILD_SRCS
152        ${TOP_DIR}/engine/plugin/plugins/source/file_source/*.cpp
153        )
154
155INCLUDE_DIRECTORIES(BEFORE ${CMAKE_CURRENT_SOURCE_DIR}/../include)
156
157link_directories(
158        ${ffmpeg_lib_path}
159        ${sdl_lib_path}
160        ${TOP_DIR}/../3rdparty/curl/lib/windows
161)
162
163if (WIN32)
164    link_libraries(
165            pthread
166            m
167            avcodec
168            avformat
169            avutil
170            avfilter
171            swresample
172            swscale
173            SDL2
174            curl
175    )
176elseif (LINUX_DEMO)
177else ()
178    link_libraries(
179            log
180            FFmpeg
181            SDL2
182    )
183endif ()
184
185set(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/bin)
186set(CMAKE_SHARED_LIBRARY_PREFIX "libmedia_engine_")
187set(CMAKE_SHARED_LIBRARY_SUFFIX ".z.so")
188
189add_library(${PROJECT_NAME} SHARED ${HISTREAMER_SRCS} ${PLUGINS_STATIC_BUILD_SRCS}
190        ${3RDPARTY_SRCS})
191