Skip to content

Commit

Permalink
cmake/zephyr: decentralize src/ipc/
Browse files Browse the repository at this point in the history
Adding all source files in a single, giant zephyr/CMakeLists.txt is
inconvenient and does not scale.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
  • Loading branch information
marc-hb committed Oct 31, 2023
1 parent c016141 commit c4acccf
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 31 deletions.
26 changes: 25 additions & 1 deletion src/ipc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,32 @@ elseif (CONFIG_IPC_MAJOR_4)
add_subdirectory(ipc4)
endif()

add_local_sources(sof
set(base_files
ipc-common.c
ipc-helper.c
)

if(CONFIG_SOF) ### Zephyr ###

zephyr_library_sources(
${base_files}
dma-copy.c
)

if (CONFIG_SOC_SERIES_INTEL_CAVS_V25 OR CONFIG_SOC_SERIES_INTEL_ACE)
zephyr_library_sources(
ipc-zephyr.c
)
endif()


else() ### Not Zephyr ###


add_local_sources(sof
${base_files}
)

if (CONFIG_TRACE)
add_local_sources(sof
dma-copy.c)
Expand All @@ -19,3 +40,6 @@ endif()
if (CONFIG_LIBRARY)
return()
endif()


endif() # Zephyr
19 changes: 17 additions & 2 deletions src/ipc/ipc3/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,12 +1,27 @@
# SPDX-License-Identifier: BSD-3-Clause

add_local_sources(sof
set(common_files
handler.c
helper.c
dai.c
)

if(CONFIG_SOF) ### Zephyr ###

zephyr_library_sources(
${common_files}
host-page-table.c
)

else() ### Not Zephyr ###

add_local_sources(sof
${common_files}
)

if (CONFIG_HOST_PTABLE)
add_local_sources(sof
host-page-table.c)
endif()
endif()

endif() # Zephyr
25 changes: 24 additions & 1 deletion src/ipc/ipc4/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,12 +1,35 @@
# SPDX-License-Identifier: BSD-3-Clause

add_local_sources(sof
set(common_files
dai.c
handler.c
helper.c
logging.c
notification.c
)


if(CONFIG_SOF) #### Zephyr #######


zephyr_library_sources(
${common_files}
)

zephyr_library_sources_ifdef(CONFIG_AMS
ams_helpers.c
)


else() ### Not Zephyr ####


add_local_sources(sof
${common_files}
ams_helpers.c
)

target_include_directories(sof_options INTERFACE ${RIMAGE_TOP}/src/include)


endif() # Zephyr
28 changes: 1 addition & 27 deletions zephyr/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ zephyr_include_directories(

# New, "de-centralized Zephyr" way. Requires "if(CONFIG_SOF)" conditionals in
# the decentralized CMakeLists.txt files shared with XTOS.
add_subdirectory(../src/ipc/ unused_install_ipc/)
add_subdirectory(../src/init/ unused_install_init/)


Expand All @@ -126,10 +127,6 @@ add_subdirectory(../src/init/ unused_install_init/)
if (CONFIG_SOC_SERIES_INTEL_CAVS_V25)

# Driver sources
zephyr_library_sources(
${SOF_IPC_PATH}/ipc-zephyr.c
)

zephyr_library_sources_ifdef(CONFIG_INTEL_HDA
${SOF_DRIVERS_PATH}/intel/hda/hda-dma.c
)
Expand All @@ -155,11 +152,6 @@ endif()
# Intel ACE 1.5 and newer platforms
if (CONFIG_SOC_SERIES_INTEL_ACE)

# Driver sources
zephyr_library_sources(
${SOF_IPC_PATH}/ipc-zephyr.c
)

# Platform sources
zephyr_library_sources(
${SOF_PLATFORM_PATH}/intel/ace/platform.c
Expand Down Expand Up @@ -317,9 +309,6 @@ zephyr_include_directories(${SOF_PLATFORM_PATH}/${PLATFORM}/include)
# Mandatory Files used on all platforms.
# Commented files will be added/removed as integration dictates.
zephyr_library_sources(
${SOF_IPC_PATH}/dma-copy.c
${SOF_IPC_PATH}/ipc-common.c
${SOF_IPC_PATH}/ipc-helper.c

# SOF math utilities
${SOF_MATH_PATH}/decibels.c
Expand Down Expand Up @@ -398,20 +387,6 @@ else()
)
endif()

zephyr_library_sources_ifdef(CONFIG_IPC_MAJOR_3
${SOF_IPC_PATH}/ipc3/handler.c
${SOF_IPC_PATH}/ipc3/helper.c
${SOF_IPC_PATH}/ipc3/dai.c
${SOF_IPC_PATH}/ipc3/host-page-table.c
)

zephyr_library_sources_ifdef(CONFIG_IPC_MAJOR_4
${SOF_IPC_PATH}/ipc4/handler.c
${SOF_IPC_PATH}/ipc4/helper.c
${SOF_IPC_PATH}/ipc4/dai.c
${SOF_IPC_PATH}/ipc4/logging.c
${SOF_IPC_PATH}/ipc4/notification.c
)

zephyr_library_sources_ifdef(CONFIG_TRACE
${SOF_SRC_PATH}/trace/dma-trace.c
Expand Down Expand Up @@ -766,7 +741,6 @@ zephyr_library_sources_ifdef(CONFIG_HAVE_AGENT

zephyr_library_sources_ifdef(CONFIG_AMS
${SOF_LIB_PATH}/ams.c
${SOF_IPC_PATH}/ipc4/ams_helpers.c
)

zephyr_library_sources_ifdef(CONFIG_GDB_DEBUG
Expand Down

0 comments on commit c4acccf

Please sign in to comment.