blob: b423cba09050ed6f03e0bbb26b51048a1af7631a [file] [log] [blame]
Tim Yaoe004da02019-12-03 11:59:05 -08001cmake_minimum_required(VERSION 3.8)
2
3project(aml_audio_hal
4 VERSION 1.0)
5
6include(GNUInstallDirs)
7
8add_subdirectory("libms12v2")
9add_subdirectory("audio_hal/libaudioprocessing")
10
11add_library(spdifenc STATIC
12 utils/SPDIFEncoderAD.cpp
13 utils/spdifenc_wrap.cpp
14)
15
16target_include_directories(spdifenc PRIVATE
17 ./audio_hal
18 ./include
19 ./include/utils)
20
Tim Yaoe419f812021-01-20 21:15:05 -080021target_compile_options(spdifenc PRIVATE -Wno-deprecated-declarations -fPIC)
Tim Yaoe004da02019-12-03 11:59:05 -080022
cheng tong12e5d132020-09-25 18:57:09 +080023option(USE_DTV "Compile with DTV option" OFF)
Tim Yao2c66a762021-01-06 18:08:33 -080024option(USE_CAP "Support audio capture" ON)
Zhizhong Zhang16302302021-01-20 22:29:14 +080025option(USE_SC2 "Current platform is sc2" OFF)
Tim Yaob5e98392021-03-03 11:51:26 -080026option(USE_CAP_MUTE_HDMI "Support audio capture mute for HDMI INPUT" ON)
Tim Yao97c694d2021-02-25 12:12:53 -080027option(USE_APP_MIXING "Support appsound mixing" ON)
Pradeep Sriramd18aa612020-05-14 13:05:34 -070028
29if(USE_DTV)
30 list(APPEND DTV_FILES audio_hal/audio_dtv_ad.c)
31 list(APPEND DTV_FILES audio_hal/audio_hw_dtv.c)
32 list(APPEND DTV_INC $ENV{AML_AUDIO_HAL_STAGING_DIR}/usr/include/aml_dvb/am_adp)
cheng tong12e5d132020-09-25 18:57:09 +080033 list(APPEND DTV_LIBS -L$ENV{AML_AUDIO_HAL_STAGING_DIR}/usr/lib/aml_libs_nf -lamadec_hal -lam_adp )
Zhizhong Zhang16302302021-01-20 22:29:14 +080034 list(APPEND DVB_AUDIO_INC ./dtv_audio_utils/sync)
35 list(APPEND DVB_AUDIO_LIBS -L./dtv_audio_utils -ldvbaudioutils)
36
cheng tong7177c1b2020-09-17 17:36:27 +080037 add_definitions(-DUSE_DTV)
Pradeep Sriramd18aa612020-05-14 13:05:34 -070038endif()
39
Tim Yao97c694d2021-02-25 12:12:53 -080040if(USE_APP_MIXING)
41add_definitions(-DUSE_APP_MIXING)
42endif()
43
Song Zhaoc23fabe2020-09-18 13:28:40 -070044option(USE_EQ_DRC "Compile with EQ/DRC" OFF)
45
cheng tong12e5d132020-09-25 18:57:09 +080046if(USE_EQ_DRC)
47 list(APPEND EQ_DRC_FILES
48 amlogic_AQ_tools/audio_eq_drc_compensation.c
49 amlogic_AQ_tools/audio_eq_drc_parser.c
50 amlogic_AQ_tools/ini/dictionary.c
51 amlogic_AQ_tools/ini/iniparser.c)
52endif()
53
Tim Yaoe004da02019-12-03 11:59:05 -080054#############################################
55# libaudio_hal
56#############################################
57add_library(audio_hal SHARED
58 audio_hal/alsa_config_parameters.c
59 audio_hal/alsa_manager.c
60 audio_hal/aml_ac3_parser.c
Tim Yao20c2bf62020-07-20 01:56:44 -070061 audio_hal/aml_audio_ac3parser.c
62 audio_hal/aml_audio_ac4parser.c
63 audio_hal/aml_audio_bitsparser.c
Tim Yaoe004da02019-12-03 11:59:05 -080064 audio_hal/aml_audio_delay.c
65 audio_hal/aml_audio_ease.c
66 audio_hal/amlAudioMixer.c
Tim Yao20c2bf62020-07-20 01:56:44 -070067 audio_hal/aml_audio_ms12_bypass.c
Tim Yaoe004da02019-12-03 11:59:05 -080068 audio_hal/aml_audio_resample_manager.c
69 audio_hal/aml_audio_stream.c
Tim Yao20c2bf62020-07-20 01:56:44 -070070 audio_hal/aml_audio_spdif_output.c
Tim Yaoe004da02019-12-03 11:59:05 -080071 audio_hal/aml_audio_timer.c
72 audio_hal/aml_avsync_tuning.c
73 audio_hal/aml_dca_dec_api.c
74 audio_hal/aml_dcv_dec_api.c
75 audio_hal/aml_hw_mixer.c
76 audio_hal/aml_resample_wrap.cpp
77 audio_hal/audio_android_resample_api.c
78 audio_hal/audio_data_process.c
Tim Yaoe004da02019-12-03 11:59:05 -080079 audio_hal/audio_format_parse.c
80 audio_hal/audio_hw.c
Tim Yao20c2bf62020-07-20 01:56:44 -070081 audio_hal/audio_hw_insert_silence_data.c
Tim Yaoe004da02019-12-03 11:59:05 -080082 audio_hal/audio_hw_ms12.c
83 audio_hal/audio_hw_profile.c
84 audio_hal/audio_hwsync.c
85 audio_hal/audio_hw_utils.c
86 audio_hal/audio_port.c
87 audio_hal/audio_post_process.c
88 audio_hal/audio_route.c
89 audio_hal/audio_simple_resample_api.c
90 audio_hal/audio_virtual_buf.c
91 audio_hal/dolby_lib_api.c
92 audio_hal/hw_avsync.c
93 audio_hal/hw_avsync_callbacks.c
94 audio_hal/spdif_encoder_api.c
95 audio_hal/sub_mixing_factory.c
cheng tongc6b27a92020-11-02 11:46:31 +080096 audio_hal/audio_effect_if.c
Tim Yaoe004da02019-12-03 11:59:05 -080097 utils/ac3_parser_utils.c
98 utils/alsa_device_parser.c
99 utils/aml_alsa_mixer.c
100 utils/aml_android_utils.c
101 utils/aml_audio_mixer.c
102 utils/aml_audio_resampler.c
103 utils/aml_buffer_provider.c
104 utils/aml_data_utils.c
105 utils/aml_dump_debug.c
Tim Yao20c2bf62020-07-20 01:56:44 -0700106 utils/aml_malloc_debug.c
Tim Yaoe004da02019-12-03 11:59:05 -0800107 utils/aml_ringbuffer.c
108 utils/aml_volume_utils.c
109 utils/aml_configs/aml_conf_loader.c
110 utils/aml_configs/aml_conf_parser.c
Tim Yao20c2bf62020-07-20 01:56:44 -0700111 utils/earc_utils.c
Pradeep Sriramd18aa612020-05-14 13:05:34 -0700112 ${DTV_FILES}
cheng tong12e5d132020-09-25 18:57:09 +0800113 ${EQ_DRC_FILES}
Tim Yaoe004da02019-12-03 11:59:05 -0800114)
115
Tim Yao20c2bf62020-07-20 01:56:44 -0700116add_definitions(-DNDEBUG -DREPLACE_OUTPUT_BUFFER_WITH_CALLBACK)
Tim Yao2c66a762021-01-06 18:08:33 -0800117if(USE_CAP)
118add_definitions(-DAUDIO_CAP)
Tim Yaob5e98392021-03-03 11:51:26 -0800119
120if(USE_CAP_MUTE_HDMI)
121 add_definitions(-DAUDIO_CAP_MUTE_HDMI)
122endif()
Tim Yao2c66a762021-01-06 18:08:33 -0800123endif()
Tim Yao4bff6782019-12-26 18:31:40 -0800124
Tim Yaoe004da02019-12-03 11:59:05 -0800125set(PREBUILD_STATIC_LIBS
126 ${CMAKE_SOURCE_DIR}/amlogic_AQ_tools/lib_aml_ng.a
127 ${CMAKE_SOURCE_DIR}/amlogic_AQ_tools/Amlogic_DRC_Param_Generator.a
128 ${CMAKE_SOURCE_DIR}/amlogic_AQ_tools/Amlogic_EQ_Param_Generator.a)
129
130set_target_properties(audio_hal PROPERTIES
131 VERSION ${PROJECT_VERSION}
132 SOVERSION 1)
133
134target_include_directories(audio_hal PRIVATE
Tim Yaoe004da02019-12-03 11:59:05 -0800135 ./include
136 ./include/utils
Tim Yaoe004da02019-12-03 11:59:05 -0800137 ./libms12v2/include)
138
Tim Yaoe419f812021-01-20 21:15:05 -0800139target_compile_options(audio_hal PRIVATE -D_GNU_SOURCE -DTV_AUDIO_OUTPUT -Wno-deprecated-declarations -funwind-tables -fasynchronous-unwind-tables -fPIC)
Tim Yaoe004da02019-12-03 11:59:05 -0800140
141target_link_libraries(audio_hal
cheng tong5ae92692020-08-28 14:13:39 +0800142 audioprocessing spdifenc ms12v2 ${PREBUILD_STATIC_LIBS}
Song Zhaoc23fabe2020-09-18 13:28:40 -0700143 -lcutils -lamaudioutils -ltinyalsa -llog -lexpat -lpthread -ldl -lstdc++ -Wl,-z,defs)
144
145if(USE_EQ_DRC)
146 target_include_directories(audio_hal PRIVATE
147 ./include/amlogic_AQ_tools
148 ./amlogic_AQ_tools
149 ./amlogic_AQ_tools/ini)
150 target_compile_options(audio_hal PRIVATE -DAML_EQ_DRC)
Song Zhaoc23fabe2020-09-18 13:28:40 -0700151endif()
152
153if(USE_DTV)
Zhizhong Zhang16302302021-01-20 22:29:14 +0800154 target_include_directories(audio_hal PRIVATE
155 ${DTV_INC}
156 ${DVB_AUDIO_INC})
157 target_link_libraries(audio_hal
158 ${DTV_LIBS}
159 ${DVB_AUDIO_LIBS} -lamavutils)
160endif()
161
162if(USE_SC2)
163 add_definitions(-DDVB_AUDIO_SC2)
Song Zhaoc23fabe2020-09-18 13:28:40 -0700164endif()
Tim Yaoe004da02019-12-03 11:59:05 -0800165
166install(TARGETS audio_hal
167 LIBRARY DESTINATION "lib")
168
169install(FILES audio_hal/mixer_paths.xml
170 DESTINATION /etc)
171
cheng tong5ae92692020-08-28 14:13:39 +0800172install(PROGRAMS amlogic_AQ_tools/Amlogic_DRC_Param_Generator amlogic_AQ_tools/Amlogic_EQ_Param_Generator
173 DESTINATION /usr/bin)
174