-
Notifications
You must be signed in to change notification settings - Fork 325
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Janusz Jankowski <janusz.jankowski@linux.intel.com>
- Loading branch information
Showing
7 changed files
with
170 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# includes | ||
set(GENERATED_DIRECTORY ${PROJECT_BINARY_DIR}/generated) | ||
file(MAKE_DIRECTORY ${GENERATED_DIRECTORY}/include) | ||
|
||
target_include_directories(sof_options INTERFACE ${PROJECT_SOURCE_DIR}/src/arch/host/include) | ||
target_include_directories(sof_options INTERFACE ${PROJECT_SOURCE_DIR}/src/library/include) | ||
target_include_directories(sof_options INTERFACE ${GENERATED_DIRECTORY}/include) | ||
|
||
# TODO: add Kconfig support also for testbench when it'll be decoupled from fw | ||
set(CONFIG_HOST 1) | ||
set(CONFIG_LIB 1) | ||
|
||
configure_file ( | ||
"${PROJECT_SOURCE_DIR}/src/arch/host/config.h.in" | ||
"${GENERATED_DIRECTORY}/include/config.h" | ||
) | ||
|
||
# linker flags | ||
target_link_libraries(sof_options INTERFACE -lpthread) | ||
|
||
# C & ASM flags | ||
target_compile_options(sof_options INTERFACE -g -O3 -Wall -Werror -Wl,-EL -Wmissing-prototypes -Wimplicit-fallthrough=3) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
#define CONFIG_HOST @CONFIG_HOST@ | ||
#define CONFIG_LIB @CONFIG_LIB@ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,90 @@ | ||
add_local_sources(sof | ||
eq_iir.c | ||
iir.c | ||
eq_fir.c | ||
fir.c | ||
fir_hifi2ep.c | ||
fir_hifi3.c | ||
tone.c | ||
src.c | ||
src_generic.c | ||
src_hifi2ep.c | ||
src_hifi3.c | ||
mixer.c | ||
mux.c | ||
volume.c | ||
volume_generic.c | ||
volume_hifi3.c | ||
switch.c | ||
if(NOT BUILD_HOST) | ||
add_local_sources(sof | ||
eq_iir.c | ||
iir.c | ||
eq_fir.c | ||
fir.c | ||
fir_hifi2ep.c | ||
fir_hifi3.c | ||
tone.c | ||
src.c | ||
src_generic.c | ||
src_hifi2ep.c | ||
src_hifi3.c | ||
mixer.c | ||
mux.c | ||
volume.c | ||
volume_generic.c | ||
volume_hifi3.c | ||
switch.c | ||
dai.c | ||
host.c | ||
pipeline.c | ||
pipeline_static.c | ||
component.c | ||
buffer.c | ||
) | ||
return() | ||
endif() | ||
|
||
add_library(sof_audio_core SHARED "") | ||
target_link_libraries(sof_audio_core PRIVATE sof_options) | ||
target_link_libraries(sof_audio_core PRIVATE -Wl,--export-dynamic) | ||
add_local_sources(sof_audio_core | ||
dai.c | ||
host.c | ||
pipeline.c | ||
pipeline_static.c | ||
component.c | ||
buffer.c | ||
) | ||
|
||
install(TARGETS sof_audio_core DESTINATION lib) | ||
|
||
# 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}) | ||
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 -ftree-vectorizer-verbose=0) | ||
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) | ||
|
||
# sources for each module | ||
set(volume_sources volume.c volume_generic.c) | ||
set(src_sources src.c src_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() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib") | ||
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) | ||
|
||
add_executable(testbench "") | ||
add_local_sources(testbench testbench.c) | ||
|
||
target_link_libraries(testbench PRIVATE -ldl -lm) | ||
target_link_libraries(testbench PRIVATE sof_ipc tb_common sof_audio_core) | ||
|
||
add_library(tb_common STATIC "") | ||
target_link_libraries(tb_common sof_options) | ||
add_local_sources(tb_common | ||
alloc.c | ||
common_test.c | ||
file.c | ||
ipc.c | ||
schedule.c | ||
topology.c | ||
trace.c | ||
) | ||
|
||
install(TARGETS testbench DESTINATION bin) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters