forked from thesofproject/sof
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
151 lines (136 loc) · 3.97 KB
/
CMakeLists.txt
File metadata and controls
151 lines (136 loc) · 3.97 KB
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
145
146
147
148
149
150
151
# SPDX-License-Identifier: BSD-3-Clause
if(NOT CONFIG_LIBRARY)
add_local_sources(sof
host.c
component.c
buffer.c
channel_map.c
)
if(CONFIG_COMP_VOLUME)
add_subdirectory(volume)
endif()
if(CONFIG_COMP_SRC)
add_subdirectory(src)
endif()
if(CONFIG_COMP_FIR)
add_subdirectory(eq_fir)
endif()
if(CONFIG_COMP_IIR)
add_subdirectory(eq_iir)
endif()
if(CONFIG_COMP_DCBLOCK)
add_subdirectory(dcblock)
endif()
if(CONFIG_COMP_CROSSOVER)
add_subdirectory(crossover)
endif()
if(CONFIG_COMP_TDFB)
add_subdirectory(tdfb)
endif()
if(CONFIG_COMP_DRC)
add_subdirectory(drc)
endif()
if(CONFIG_COMP_MULTIBAND_DRC)
add_subdirectory(multiband_drc)
endif()
if(CONFIG_COMP_TONE)
add_local_sources(sof
tone.c
)
endif()
if(CONFIG_COMP_MIXER)
add_local_sources(sof
mixer.c
)
endif()
if(CONFIG_COMP_MUX)
add_subdirectory(mux)
endif()
if(CONFIG_COMP_SWITCH)
add_local_sources(sof
switch.c
)
endif()
if(CONFIG_COMP_DAI)
add_local_sources(sof
dai.c
)
endif()
if(CONFIG_COMP_KPB)
add_local_sources(sof
kpb.c
)
endif()
if(CONFIG_COMP_SEL)
add_subdirectory(selector)
endif()
if(CONFIG_MAXIM_DSM)
sof_add_static_library(dsm ./smart_amp/dsm_lib/libdsm.a)
add_subdirectory(smart_amp)
endif()
add_subdirectory(pcm_converter)
if(CONFIG_COMP_ASRC)
add_subdirectory(asrc)
endif()
if(CONFIG_COMP_MODULE_ADAPTER)
add_subdirectory(module_adapter)
endif()
if(CONFIG_COMP_IGO_NR)
add_subdirectory(igo_nr)
endif()
subdirs(pipeline)
return()
endif()
subdirs(pipeline)
add_local_sources(sof
component.c
buffer.c
)
# Audio Modules with various optimizaitons
# add rules for module compilation and installation
function(sof_audio_add_module lib_name compile_flags)
add_library(${lib_name} MODULE "")
target_link_libraries(${lib_name} PRIVATE sof_options)
target_link_libraries(${lib_name} PRIVATE -Wl,--export-dynamic)
target_compile_options(${lib_name} PRIVATE ${compile_flags})
add_local_sources(${lib_name} ${ARGN})
sof_append_relative_path_definitions(${lib_name})
install(TARGETS ${lib_name} DESTINATION lib)
endfunction()
include(CheckCCompilerFlag)
set(available_optimizations)
# checks if flag is supported by compiler and sets needed flags
macro(check_optimization opt_name flag extra_define)
check_c_compiler_flag(${flag} compiles_flag_${opt_name})
if(compiles_flag_${opt_name})
list(APPEND available_optimizations ${opt_name})
set(${opt_name}_flags ${flag} ${extra_define} -ffast-math)
endif()
endmacro()
# modules will be compiled only for flags supported by compiler
check_optimization(sse42 -msse4.2 -DOPS_SSE42)
check_optimization(avx -mavx -DOPS_AVX)
check_optimization(avx2 -mavx2 -DOPS_AVX2)
check_optimization(fma -mfma -DOPS_FMA)
check_optimization(hifi2ep -mhifi2ep -DOPS_HIFI2EP)
check_optimization(hifi3 -mhifi3 -DOPS_HIFI3)
set(sof_audio_modules volume src asrc eq-fir eq-iir dcblock crossover tdfb drc multiband_drc)
# sources for each module
set(volume_sources volume/volume.c volume/volume_generic.c)
set(src_sources src/src.c src/src_generic.c)
set(asrc_sources asrc/asrc.c asrc/asrc_farrow.c asrc/asrc_farrow_generic.c)
set(eq-fir_sources eq_fir/eq_fir.c eq_fir/eq_fir_generic.c)
set(eq-iir_sources eq_iir/eq_iir.c eq_iir/iir.c)
set(dcblock_sources dcblock/dcblock.c dcblock/dcblock_generic.c)
set(crossover_sources crossover/crossover.c crossover/crossover_generic.c)
set(tdfb_sources tdfb/tdfb.c tdfb/tdfb_generic.c)
set(drc_sources drc/drc.c drc/drc_generic.c drc/drc_math_generic.c)
set(multiband_drc_sources multiband_drc/multiband_drc.c multiband_drc/multiband_drc_generic.c crossover/crossover.c crossover/crossover_generic.c drc/drc.c drc/drc_generic.c drc/drc_math_generic.c)
foreach(audio_module ${sof_audio_modules})
# first compile with no optimizations
sof_audio_add_module(sof_${audio_module} "" ${${audio_module}_sources})
# compile for each optimization
foreach(opt ${available_optimizations})
sof_audio_add_module(sof_${audio_module}_${opt} "${${opt}_flags}" ${${audio_module}_sources})
endforeach()
endforeach()