blob: 0cee6bcbf7581c9483f6f0bf5ea8849f42603ec5 [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)
Pradeep Sriramd18aa612020-05-14 13:05:34 -070027
28if(USE_DTV)
29 list(APPEND DTV_FILES audio_hal/audio_dtv_ad.c)
30 list(APPEND DTV_FILES audio_hal/audio_hw_dtv.c)
31 list(APPEND DTV_INC $ENV{AML_AUDIO_HAL_STAGING_DIR}/usr/include/aml_dvb/am_adp)
cheng tong12e5d132020-09-25 18:57:09 +080032 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 +080033 list(APPEND DVB_AUDIO_INC ./dtv_audio_utils/sync)
34 list(APPEND DVB_AUDIO_LIBS -L./dtv_audio_utils -ldvbaudioutils)
35
cheng tong7177c1b2020-09-17 17:36:27 +080036 add_definitions(-DUSE_DTV)
Pradeep Sriramd18aa612020-05-14 13:05:34 -070037endif()
38
Song Zhaoc23fabe2020-09-18 13:28:40 -070039option(USE_EQ_DRC "Compile with EQ/DRC" OFF)
40
cheng tong12e5d132020-09-25 18:57:09 +080041if(USE_EQ_DRC)
42 list(APPEND EQ_DRC_FILES
43 amlogic_AQ_tools/audio_eq_drc_compensation.c
44 amlogic_AQ_tools/audio_eq_drc_parser.c
45 amlogic_AQ_tools/ini/dictionary.c
46 amlogic_AQ_tools/ini/iniparser.c)
47endif()
48
Tim Yaoe004da02019-12-03 11:59:05 -080049#############################################
50# libaudio_hal
51#############################################
52add_library(audio_hal SHARED
53 audio_hal/alsa_config_parameters.c
54 audio_hal/alsa_manager.c
55 audio_hal/aml_ac3_parser.c
Tim Yao20c2bf62020-07-20 01:56:44 -070056 audio_hal/aml_audio_ac3parser.c
57 audio_hal/aml_audio_ac4parser.c
58 audio_hal/aml_audio_bitsparser.c
Tim Yaoe004da02019-12-03 11:59:05 -080059 audio_hal/aml_audio_delay.c
60 audio_hal/aml_audio_ease.c
61 audio_hal/amlAudioMixer.c
Tim Yao20c2bf62020-07-20 01:56:44 -070062 audio_hal/aml_audio_ms12_bypass.c
Tim Yaoe004da02019-12-03 11:59:05 -080063 audio_hal/aml_audio_resample_manager.c
64 audio_hal/aml_audio_stream.c
Tim Yao20c2bf62020-07-20 01:56:44 -070065 audio_hal/aml_audio_spdif_output.c
Tim Yaoe004da02019-12-03 11:59:05 -080066 audio_hal/aml_audio_timer.c
67 audio_hal/aml_avsync_tuning.c
68 audio_hal/aml_dca_dec_api.c
69 audio_hal/aml_dcv_dec_api.c
70 audio_hal/aml_hw_mixer.c
71 audio_hal/aml_resample_wrap.cpp
72 audio_hal/audio_android_resample_api.c
73 audio_hal/audio_data_process.c
Tim Yaoe004da02019-12-03 11:59:05 -080074 audio_hal/audio_format_parse.c
75 audio_hal/audio_hw.c
Tim Yao20c2bf62020-07-20 01:56:44 -070076 audio_hal/audio_hw_insert_silence_data.c
Tim Yaoe004da02019-12-03 11:59:05 -080077 audio_hal/audio_hw_ms12.c
78 audio_hal/audio_hw_profile.c
79 audio_hal/audio_hwsync.c
80 audio_hal/audio_hw_utils.c
81 audio_hal/audio_port.c
82 audio_hal/audio_post_process.c
83 audio_hal/audio_route.c
84 audio_hal/audio_simple_resample_api.c
85 audio_hal/audio_virtual_buf.c
86 audio_hal/dolby_lib_api.c
87 audio_hal/hw_avsync.c
88 audio_hal/hw_avsync_callbacks.c
89 audio_hal/spdif_encoder_api.c
90 audio_hal/sub_mixing_factory.c
cheng tongc6b27a92020-11-02 11:46:31 +080091 audio_hal/audio_effect_if.c
Tim Yaoe004da02019-12-03 11:59:05 -080092 utils/ac3_parser_utils.c
93 utils/alsa_device_parser.c
94 utils/aml_alsa_mixer.c
95 utils/aml_android_utils.c
96 utils/aml_audio_mixer.c
97 utils/aml_audio_resampler.c
98 utils/aml_buffer_provider.c
99 utils/aml_data_utils.c
100 utils/aml_dump_debug.c
Tim Yao20c2bf62020-07-20 01:56:44 -0700101 utils/aml_malloc_debug.c
Tim Yaoe004da02019-12-03 11:59:05 -0800102 utils/aml_ringbuffer.c
103 utils/aml_volume_utils.c
104 utils/aml_configs/aml_conf_loader.c
105 utils/aml_configs/aml_conf_parser.c
Tim Yao20c2bf62020-07-20 01:56:44 -0700106 utils/earc_utils.c
Pradeep Sriramd18aa612020-05-14 13:05:34 -0700107 ${DTV_FILES}
cheng tong12e5d132020-09-25 18:57:09 +0800108 ${EQ_DRC_FILES}
Tim Yaoe004da02019-12-03 11:59:05 -0800109)
110
Tim Yao20c2bf62020-07-20 01:56:44 -0700111add_definitions(-DNDEBUG -DREPLACE_OUTPUT_BUFFER_WITH_CALLBACK)
Tim Yao2c66a762021-01-06 18:08:33 -0800112if(USE_CAP)
113add_definitions(-DAUDIO_CAP)
Tim Yaob5e98392021-03-03 11:51:26 -0800114
115if(USE_CAP_MUTE_HDMI)
116 add_definitions(-DAUDIO_CAP_MUTE_HDMI)
117endif()
Tim Yao2c66a762021-01-06 18:08:33 -0800118endif()
Tim Yao4bff6782019-12-26 18:31:40 -0800119
Tim Yaoe004da02019-12-03 11:59:05 -0800120set(PREBUILD_STATIC_LIBS
121 ${CMAKE_SOURCE_DIR}/amlogic_AQ_tools/lib_aml_ng.a
122 ${CMAKE_SOURCE_DIR}/amlogic_AQ_tools/Amlogic_DRC_Param_Generator.a
123 ${CMAKE_SOURCE_DIR}/amlogic_AQ_tools/Amlogic_EQ_Param_Generator.a)
124
125set_target_properties(audio_hal PROPERTIES
126 VERSION ${PROJECT_VERSION}
127 SOVERSION 1)
128
129target_include_directories(audio_hal PRIVATE
Tim Yaoe004da02019-12-03 11:59:05 -0800130 ./include
131 ./include/utils
Tim Yaoe004da02019-12-03 11:59:05 -0800132 ./libms12v2/include)
133
Tim Yaoe419f812021-01-20 21:15:05 -0800134target_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 -0800135
136target_link_libraries(audio_hal
cheng tong5ae92692020-08-28 14:13:39 +0800137 audioprocessing spdifenc ms12v2 ${PREBUILD_STATIC_LIBS}
Song Zhaoc23fabe2020-09-18 13:28:40 -0700138 -lcutils -lamaudioutils -ltinyalsa -llog -lexpat -lpthread -ldl -lstdc++ -Wl,-z,defs)
139
140if(USE_EQ_DRC)
141 target_include_directories(audio_hal PRIVATE
142 ./include/amlogic_AQ_tools
143 ./amlogic_AQ_tools
144 ./amlogic_AQ_tools/ini)
145 target_compile_options(audio_hal PRIVATE -DAML_EQ_DRC)
Song Zhaoc23fabe2020-09-18 13:28:40 -0700146endif()
147
148if(USE_DTV)
Zhizhong Zhang16302302021-01-20 22:29:14 +0800149 target_include_directories(audio_hal PRIVATE
150 ${DTV_INC}
151 ${DVB_AUDIO_INC})
152 target_link_libraries(audio_hal
153 ${DTV_LIBS}
154 ${DVB_AUDIO_LIBS} -lamavutils)
155endif()
156
157if(USE_SC2)
158 add_definitions(-DDVB_AUDIO_SC2)
Song Zhaoc23fabe2020-09-18 13:28:40 -0700159endif()
Tim Yaoe004da02019-12-03 11:59:05 -0800160
161install(TARGETS audio_hal
162 LIBRARY DESTINATION "lib")
163
164install(FILES audio_hal/mixer_paths.xml
165 DESTINATION /etc)
166
cheng tong5ae92692020-08-28 14:13:39 +0800167install(PROGRAMS amlogic_AQ_tools/Amlogic_DRC_Param_Generator amlogic_AQ_tools/Amlogic_EQ_Param_Generator
168 DESTINATION /usr/bin)
169