Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions scripts/cmake/misc.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,14 @@ macro(add_local_sources_ifdef condition target)
endif()
endmacro()

# helper macro used similarly as add_local_sources_ifdef
# Zephyr duplicate in sof/zephyr/CMakeLists.txt; keep in sync
macro(sof_list_append_ifdef feature_toggle list)
if(${${feature_toggle}})
list(APPEND ${list} ${ARGN})
endif()
endmacro()

# Adds sources to target like target_sources, but assumes that
# paths are relative to subdirectory.
# Works like:
Expand Down
94 changes: 59 additions & 35 deletions src/audio/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,33 +1,72 @@
# SPDX-License-Identifier: BSD-3-Clause

if(NOT CONFIG_COMP_MODULE_SHARED_LIBRARY_BUILD)
add_local_sources(sof
host-legacy.c
component.c
source_api_helper.c
sink_api_helper.c
sink_source_utils.c
audio_stream.c
channel_map.c
)
set(base_files
channel_map.c
component.c
source_api_helper.c
sink_api_helper.c
sink_source_utils.c
audio_stream.c
channel_map.c
)

### Common actions for Zephyr/XTOS ###
if(NOT CONFIG_COMP_MODULE_SHARED_LIBRARY_BUILD)
add_subdirectory(buffers)

if(CONFIG_COMP_BLOB)
add_local_sources(sof data_blob.c)
add_subdirectory(pipeline)
if(CONFIG_COMP_ASRC)
add_subdirectory(asrc)
endif()
if(CONFIG_COMP_SRC)
add_subdirectory(src)
if(CONFIG_COMP_DCBLOCK)
add_subdirectory(dcblock)
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)
if(CONFIG_COMP_KPB AND NOT CONFIG_LIBRARY_STATIC)
add_local_sources(sof
kpb.c
)
endif()
if(CONFIG_COMP_SEL)
add_subdirectory(selector)
endif()
if(CONFIG_COMP_SRC)
add_subdirectory(src)
endif()

if(CONFIG_ZEPHYR_NATIVE_DRIVERS)
list(APPEND base_files host-zephyr.c)
sof_list_append_ifdef(CONFIG_COMP_DAI base_files dai-zephyr.c)
else()
list(APPEND base_files host-legacy.c)
sof_list_append_ifdef(CONFIG_COMP_DAI base_files dai-legacy.c)
endif()
endif()

sof_list_append_ifdef(CONFIG_COMP_BLOB base_files data_blob.c)

is_zephyr(it_is)
if(it_is) ### Zephyr ###

zephyr_library_sources(
${base_files}
)

return()
endif()

### XTOS normal build (not shared library) ###

if(NOT CONFIG_COMP_MODULE_SHARED_LIBRARY_BUILD)
add_local_sources(sof
host-legacy.c
${base_files}
)

if(CONFIG_COMP_CROSSOVER)
add_subdirectory(crossover)
endif()
Expand Down Expand Up @@ -59,21 +98,10 @@ if(NOT CONFIG_COMP_MODULE_SHARED_LIBRARY_BUILD)
dai-legacy.c
)
endif()
if(CONFIG_COMP_KPB AND NOT CONFIG_LIBRARY_STATIC)
add_local_sources(sof
kpb.c
)
endif()
if(CONFIG_COMP_SEL)
add_subdirectory(selector)
endif()
if(CONFIG_COMP_SMART_AMP)
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()
Expand Down Expand Up @@ -106,7 +134,6 @@ if(NOT CONFIG_COMP_MODULE_SHARED_LIBRARY_BUILD)
if(CONFIG_INTEL_ADSP_MIC_PRIVACY)
add_subdirectory(mic_privacy_manager)
endif()
subdirs(pipeline)
add_subdirectory(google)
if(CONFIG_COMP_CHAIN_DMA)
add_local_sources(sof chain_dma.c)
Expand All @@ -118,22 +145,19 @@ if(NOT CONFIG_COMP_MODULE_SHARED_LIBRARY_BUILD)
return()
endif()

### Shared library build (CONFIG_COMP_MODULE_SHARED_LIBRARY_BUILD) ###

subdirs(pipeline)

if(CONFIG_COMP_MODULE_ADAPTER)
add_subdirectory(module_adapter)
endif()

add_local_sources(sof
component.c
data_blob.c
buffers/comp_buffer.c
buffers/audio_buffer.c
source_api_helper.c
sink_api_helper.c
sink_source_utils.c
audio_stream.c
channel_map.c
${base_files}
)

# Audio Modules with various optimizaitons
Expand Down
12 changes: 9 additions & 3 deletions src/audio/asrc/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
# SPDX-License-Identifier: BSD-3-Clause

if(CONFIG_COMP_ASRC STREQUAL "m")
add_subdirectory(llext ${PROJECT_BINARY_DIR}/asrc_llext)
add_dependencies(app asrc)
return()
endif()

add_local_sources(sof asrc.c asrc_farrow.c asrc_farrow_generic.c
asrc_farrow_hifi3.c asrc_farrow_hifi5.c)
asrc_farrow_hifi3.c asrc_farrow_hifi5.c)

if(CONFIG_IPC_MAJOR_3)
add_local_sources(sof asrc_ipc3.c)
add_local_sources(sof asrc_ipc3.c)
elseif(CONFIG_IPC_MAJOR_4)
add_local_sources(sof asrc_ipc4.c)
add_local_sources(sof asrc_ipc4.c)
endif()
7 changes: 2 additions & 5 deletions src/audio/buffers/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
# SPDX-License-Identifier: BSD-3-Clause

add_local_sources(sof audio_buffer.c)
add_local_sources(sof comp_buffer.c)
add_local_sources(sof audio_buffer.c comp_buffer.c)

if(CONFIG_PIPELINE_2_0)
add_local_sources(sof ring_buffer.c)
endif()
add_local_sources_ifdef(CONFIG_PIPELINE_2_0 sof ring_buffer.c)
10 changes: 8 additions & 2 deletions src/audio/dcblock/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
if(CONFIG_COMP_DCBLOCK STREQUAL "m")
add_subdirectory(llext ${PROJECT_BINARY_DIR}/dcblock_llext)
add_dependencies(app dcblock)
return()
endif()

add_local_sources(sof dcblock.c)
add_local_sources(sof dcblock_generic.c)
add_local_sources(sof dcblock_hifi3.c)
add_local_sources(sof dcblock_hifi4.c)

if(CONFIG_IPC_MAJOR_3)
add_local_sources(sof dcblock_ipc3.c)
add_local_sources(sof dcblock_ipc3.c)
elseif(CONFIG_IPC_MAJOR_4)
add_local_sources(sof dcblock_ipc4.c)
add_local_sources(sof dcblock_ipc4.c)
endif()
21 changes: 15 additions & 6 deletions src/audio/eq_fir/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,18 @@
# SPDX-License-Identifier: BSD-3-Clause

add_local_sources(sof eq_fir.c eq_fir_generic.c eq_fir_hifi2ep.c eq_fir_hifi3.c)
if(CONFIG_IPC_MAJOR_3)
add_local_sources(sof eq_fir_ipc3.c)
elseif(CONFIG_IPC_MAJOR_4)
add_local_sources(sof eq_fir_ipc4.c)
endif()
if(CONFIG_COMP_FIR STREQUAL "m")

add_subdirectory(llext ${PROJECT_BINARY_DIR}/eq_fir_llext)
add_dependencies(app eq_fir)

else()

add_local_sources(sof eq_fir.c eq_fir_generic.c eq_fir_hifi2ep.c eq_fir_hifi3.c)

if(CONFIG_IPC_MAJOR_3)
add_local_sources(sof eq_fir_ipc3.c)
elseif(CONFIG_IPC_MAJOR_4)
add_local_sources(sof eq_fir_ipc4.c)
endif()

endif()
20 changes: 15 additions & 5 deletions src/audio/eq_iir/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,18 @@
# SPDX-License-Identifier: BSD-3-Clause

add_local_sources(sof eq_iir.c eq_iir_generic.c)
if(CONFIG_IPC_MAJOR_3)
add_local_sources(sof eq_iir_ipc3.c)
elseif(CONFIG_IPC_MAJOR_4)
add_local_sources(sof eq_iir_ipc4.c)
if(CONFIG_COMP_IIR STREQUAL "m")

add_subdirectory(llext ${PROJECT_BINARY_DIR}/eq_iir_llext)
add_dependencies(app eq_iir)

else()

add_local_sources(sof eq_iir.c eq_iir_generic.c)

if(CONFIG_IPC_MAJOR_3)
add_local_sources(sof eq_iir_ipc3.c)
elseif(CONFIG_IPC_MAJOR_4)
add_local_sources(sof eq_iir_ipc4.c)
endif()

endif()
10 changes: 5 additions & 5 deletions src/audio/pipeline/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# SPDX-License-Identifier: BSD-3-Clause

add_local_sources(sof
pipeline-graph.c
pipeline-stream.c
pipeline-params.c
pipeline-xrun.c
pipeline-schedule.c
pipeline-graph.c
pipeline-stream.c
pipeline-params.c
pipeline-xrun.c
pipeline-schedule.c
)
6 changes: 6 additions & 0 deletions src/audio/selector/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# SPDX-License-Identifier: BSD-3-Clause

if(CONFIG_COMP_SEL STREQUAL "m")
add_subdirectory(llext ${PROJECT_BINARY_DIR}/selector_llext)
add_dependencies(app selector)
return()
endif()

add_local_sources(sof selector_generic.c selector.c)
28 changes: 25 additions & 3 deletions src/audio/src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,31 @@
# SPDX-License-Identifier: BSD-3-Clause

add_local_sources(sof src_generic.c src_hifi2ep.c src_hifi3.c src_hifi4.c src_hifi5.c src_common.c src.c)
set(base_files src_generic.c src_hifi2ep.c src_hifi3.c src_hifi4.c src_hifi5.c src_common.c src.c)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know this is a copy of existing, but we should not need to build hifi2 for hifi 5 targets

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can be fixed later though. @singalsu fyi.


if(CONFIG_IPC_MAJOR_3)
add_local_sources(sof src_ipc3.c)
list(APPEND base_files src_ipc3.c)
elseif(CONFIG_IPC_MAJOR_4)
add_local_sources(sof src_ipc4.c)
list(APPEND base_files src_ipc4.c)
endif()

sof_list_append_ifdef(CONFIG_COMP_SRC_LITE base_files src_lite.c)

is_zephyr(it_is)
if(it_is) ### Zephyr ###
Comment on lines +13 to +14
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it not be simpler and more readable with

if(is_zephyr)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lgirdwood there's a slight risk of broken telephone when I've been continueing Marc's work, but this would seem a standard cmake macro trick. possible more readable:

-is_zephyr(it_is)
-if(it_is) ###  Zephyr ###
+is_zephyr(zephyr)
+if(zephyr) ###  Zephyr ###

...?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, lest factor this improvement in as we go, not blocking this one though.


if(CONFIG_COMP_SRC STREQUAL "m")

add_subdirectory(llext ${PROJECT_BINARY_DIR}/src_llext)
add_dependencies(app src)

else()

zephyr_library_sources(${base_files})

endif()

else() ### XTOS ###

add_local_sources(sof ${base_files})

endif()
1 change: 1 addition & 0 deletions src/include/sof/audio/component.h
Original file line number Diff line number Diff line change
Expand Up @@ -869,6 +869,7 @@ void sys_comp_module_asrc_interface_init(void);
void sys_comp_module_rtnr_interface_init(void);
void sys_comp_module_selector_interface_init(void);
void sys_comp_module_src_interface_init(void);
void sys_comp_module_src_lite_interface_init(void);
void sys_comp_module_tdfb_interface_init(void);
void sys_comp_module_volume_interface_init(void);
void sys_comp_module_tester_interface_init(void);
Expand Down
Loading