Skip to content

Commit

Permalink
cmake/zephyr: decentralize src/init/
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 165e68f commit c016141
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 5 deletions.
15 changes: 15 additions & 0 deletions src/init/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
# SPDX-License-Identifier: BSD-3-Clause

if(CONFIG_SOF) ### Zephyr ###


zephyr_library_sources(
init.c
ext_manifest.c
)


else() ### Not Zephyr ###


add_local_sources(sof init.c)

add_library(ext_manifest STATIC "")
Expand All @@ -21,3 +33,6 @@ sof_append_relative_path_definitions(ext_manifest)

target_link_libraries(ext_manifest sof_options)
target_link_libraries(sof_static_libraries INTERFACE ext_manifest)


endif() # Zephyr
16 changes: 11 additions & 5 deletions zephyr/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# This is still WIP - Not fully validated on any platform.

# When west is installed, Zephyr's CMake invokes west to list and try to
# compile every Zephyr module that can be found.
# compile every Zephyr module that can be found. See
# sof/zephyr/module.yml and
# https://docs.zephyrproject.org/latest/develop/modules.html
if(CONFIG_SOF)

if(CONFIG_LIBRARY)
Expand Down Expand Up @@ -114,6 +114,14 @@ zephyr_include_directories(
# SOC level sources
# Files that are commented may not be needed.


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


# Old way below: all .c files added by this giant file.

# Intel TGL and CAVS 2.5 platforms
if (CONFIG_SOC_SERIES_INTEL_CAVS_V25)

Expand Down Expand Up @@ -344,8 +352,6 @@ zephyr_library_sources(
${SOF_AUDIO_PATH}/pipeline/pipeline-xrun.c

# SOF core infrastructure - runs on top of Zephyr
${SOF_SRC_PATH}/init/init.c
${SOF_SRC_PATH}/init/ext_manifest.c
${SOF_SRC_PATH}/arch/xtensa/drivers/cache_attr.c
${SOF_SRC_PATH}/schedule/zephyr_domain.c
${SOF_SRC_PATH}/schedule/schedule.c
Expand Down

0 comments on commit c016141

Please sign in to comment.