1# Copyright (c) 2023-2023 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
19IF (UNIX AND NOT CYGWIN)
20    ADD_DEFINITIONS(
21            -fPIC -DPROFILE
22    )
23    if (${OHOS_LITE})
24        set(CMAKE_CXX_FLAGS "-g -ggdb3 -O0 -Wall -Wl,--disable-new-dtags")
25    else()
26        set(CMAKE_CXX_FLAGS "-g -ggdb3 -O0 -std=c++17 -Wall -Wl,--disable-new-dtags")
27    endif()
28
29ENDIF (UNIX AND NOT CYGWIN)
30
31ADD_DEFINITIONS(
32        -D__STDC_FORMAT_MACROS
33        -DHST_PLUGIN_PATH="./"
34        -DHST_ANY_WITH_NO_RTTI
35)
36if (WIN32)
37add_definitions( -DHST_PLUGIN_FILE_TAIL=".dll" )
38else()
39add_definitions( -DHST_PLUGIN_FILE_TAIL=".so" )
40endif()
41
42IF (CMAKE_CL_64)
43    ADD_DEFINITIONS(-DWIN64)
44ENDIF (CMAKE_CL_64)
45
46######################################################
47include_directories(
48        ${TOP_DIR}/media_foundation/src
49        ${TOP_DIR}/media_foundation/src/capi/common
50        ${TOP_DIR}/media_foundation/src/buffer/avbuffer/include
51        ${TOP_DIR}/media_foundation/src/buffer/avbuffer_queue/include
52        ${TOP_DIR}/media_foundation/interface
53        ${TOP_DIR}/media_foundation/interface/inner_api
54        ${TOP_DIR}/media_foundation/interface/kits/c
55)
56
57######################################################
58
59file(GLOB_RECURSE FOUNDATION_SRCS
60        ${TOP_DIR}/media_foundation/src/buffer/*.cpp
61        ${TOP_DIR}/media_foundation/src/common/*.cpp
62        ${TOP_DIR}/media_foundation/src/common/cpp_ext/*.cpp
63        ${TOP_DIR}/media_foundation/src/meta/*.cpp
64        ${TOP_DIR}/media_foundation/src/osal/base/*.cpp
65        ${TOP_DIR}/media_foundation/src/osal/filesystem/*.cpp
66        ${TOP_DIR}/media_foundation/src/osal/task/pthread/*.cpp
67        ${TOP_DIR}/media_foundation/src/osal/utils/*.cpp
68        ${TOP_DIR}/media_foundation/src/pipeline/*.cpp
69        ${TOP_DIR}/media_foundation/src/plugin/*.cpp
70)
71
72set(MEDIA_FOUNDATION_SRCS ${FOUNDATION_SRCS})
73
74link_directories(
75        ${ffmpeg_lib_path}
76        ${sdl_lib_path}
77        ${TOP_DIR}/3rdparty/curl/lib/windows
78)
79
80if (WIN32)
81    link_libraries(
82            pthread
83            m
84            avcodec
85            avformat
86            avutil
87            avfilter
88            swresample
89            swscale
90            SDL2
91            curl
92    )
93elseif (LINUX_DEMO)
94else ()
95    link_libraries(
96            log
97            FFmpeg
98            SDL2
99    )
100endif ()
101
102set(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/bin)
103set(CMAKE_SHARED_LIBRARY_PREFIX "libmedia_engine_")
104set(CMAKE_SHARED_LIBRARY_SUFFIX ".z.so")
105
106add_library(media_foundation SHARED ${MEDIA_FOUNDATION_SRCS}
107        ${3RDPARTY_SRCS})
108