-
Notifications
You must be signed in to change notification settings - Fork 4
/
CMakeLists.txt
executable file
·144 lines (114 loc) · 4.46 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
cmake_minimum_required(VERSION 3.5.1)
project (iamf)
message(STATUS "start build iamf")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O3")
SET(CMAKE_POSITION_INDEPENDENT_CODE ON)
option(BUILD_SHARED_LIBS "Build shared library" ON)
add_definitions(-DIAMF_RIMARY_PROFILE=001)
add_definitions(-DIAMF_ADDITIONAL_PROFILE=001)
option(SAMSUNG_TV "For samsung tv." ON)
option(IAMF_DEBUG "Debug iamf." OFF)
if (SAMSUNG_TV)
add_definitions(-DSAMSUNG_TV)
endif()
if (IAMF_DEBUG)
add_definitions(-DIA_DBG -DIA_DEV)
endif()
set(CODEC_LIB_DIR "${PROJECT_SOURCE_DIR}/dep_codecs/lib")
set(CODEC_INCLUDE_DIR "${PROJECT_SOURCE_DIR}/dep_codecs/include")
set(EXTER_INCLUDE_DIR "${PROJECT_SOURCE_DIR}/dep_external/include")
option(SUPPORT_VERIFIER "Output vlogging file" OFF)
if (SUPPORT_VERIFIER)
message(STATUS "Output vlogging file")
add_definitions(-DSUPPORT_VERIFIER=1)
endif()
option(CODEC_CAP "Codec capability check" ON)
option(BINAURALIZER "Enable binaural rendering" OFF)
if(CODEC_CAP)
unset(find_opus CACHE)
find_library(find_opus NAMES opus PATHS ${CODEC_LIB_DIR} NO_DEFAULT_PATH)
if(${find_opus} STREQUAL "find_opus-NOTFOUND")
message(WARNING "the opus library was not found")
else()
add_definitions(-DCONFIG_OPUS_CODEC)
endif()
unset(find_aac CACHE)
find_library(find_aac NAMES fdk-aac PATHS ${CODEC_LIB_DIR} NO_DEFAULT_PATH)
if(${find_aac} STREQUAL "find_aac-NOTFOUND")
message(WARNING "the fdk-aac library was not found")
else()
add_definitions(-DCONFIG_AAC_CODEC)
endif()
unset(find_flac CACHE)
find_library(find_flac NAMES FLAC PATHS ${CODEC_LIB_DIR} NO_DEFAULT_PATH)
if(${find_flac} STREQUAL "find_flac-NOTFOUND")
message(WARNING "the FLAC library was not found")
else()
add_definitions(-DCONFIG_FLAC_CODEC)
endif()
endif()
include_directories (include)
aux_source_directory (dep_external/src/wav DIR_DEP_EXTERNAL_WAV)
aux_source_directory (src/common DIR_IAMF_COMMON)
aux_source_directory (src/iamf_dec DIR_IAMF_DEC)
if(NOT ${find_opus} STREQUAL "find_opus-NOTFOUND")
aux_source_directory (src/iamf_dec/opus DIR_IAMF_DEC_OPUS)
endif()
if(NOT ${find_aac} STREQUAL "find_aac-NOTFOUND")
aux_source_directory (src/iamf_dec/aac DIR_IAMF_DEC_AAC)
endif()
if(NOT ${find_flac} STREQUAL "find_flac-NOTFOUND")
aux_source_directory (src/iamf_dec/flac DIR_IAMF_DEC_FLAC)
endif()
aux_source_directory (src/iamf_dec/pcm DIR_IAMF_DEC_PCM)
include_directories(
${CODEC_INCLUDE_DIR}
${EXTER_INCLUDE_DIR}
${PROJECT_SOURCE_DIR}/src/common
${PROJECT_SOURCE_DIR}/src/iamf_dec
${PROJECT_SOURCE_DIR}/src/iamf_dec/opus
${PROJECT_SOURCE_DIR}/src/iamf_dec/aac
${PROJECT_SOURCE_DIR}/src/iamf_dec/flac
)
link_directories (
${CODEC_LIB_DIR}
)
if(BUILD_SHARED_LIBS)
add_library(${PROJECT_NAME} SHARED ${DIR_DEP_EXTERNAL_WAV} ${DIR_IAMF_COMMON}
${DIR_IAMF_DEC_OPUS} ${DIR_IAMF_DEC_AAC} ${DIR_IAMF_DEC_FLAC} ${DIR_IAMF_DEC_PCM} ${DIR_IAMF_DEC})
if(NOT ${find_opus} STREQUAL "find_opus-NOTFOUND")
target_link_libraries (${PROJECT_NAME} opus)
endif()
if(NOT ${find_aac} STREQUAL "find_aac-NOTFOUND")
target_link_libraries (${PROJECT_NAME} fdk-aac)
endif()
if(NOT ${find_flac} STREQUAL "find_flac-NOTFOUND")
target_link_libraries (${PROJECT_NAME} FLAC)
endif()
else()
add_library(${PROJECT_NAME} STATIC ${DIR_DEP_EXTERNAL_WAV} ${DIR_IAMF_COMMON}
${DIR_IAMF_DEC_OPUS} ${DIR_IAMF_DEC_AAC} ${DIR_IAMF_DEC_PCM}
${DIR_IAMF_DEC_FLAC} ${DIR_IAMF_DEC})
endif()
set(IAMF_PUBLIC_HEADER
${CMAKE_CURRENT_SOURCE_DIR}/include/IAMF_decoder.h
${CMAKE_CURRENT_SOURCE_DIR}/include/IAMF_defines.h
${CMAKE_CURRENT_SOURCE_DIR}/include/vlogging_tool_sr.h
)
set_target_properties(iamf PROPERTIES PUBLIC_HEADER "${IAMF_PUBLIC_HEADER}")
set(prefix ${CMAKE_INSTALL_PREFIX})
set(exec_prefix ${CMAKE_INSTALL_PREFIX})
set(libdir ${CMAKE_INSTALL_PREFIX}/lib)
set(includedir ${CMAKE_INSTALL_PREFIX}/include)
configure_file(iamf.pc.in iamf.pc)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/iamf.pc
DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/pkgconfig)
if(BUILD_SHARED_LIBS)
install(TARGETS ${PROJECT_NAME}
LIBRARY DESTINATION ${CMAKE_INSTALL_PREFIX}/lib
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_PREFIX}/include/iamf)
else()
install(TARGETS ${PROJECT_NAME}
ARCHIVE DESTINATION ${CMAKE_INSTALL_PREFIX}/lib
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_PREFIX}/include/iamf)
endif()