Skip to content

Conversation

@kv2019i
Copy link
Collaborator

@kv2019i kv2019i commented Mar 14, 2025

cmake/zephyr: decentralize src/math/

Adding all source files in a single, giant zephyr/CMakeLists.txt is
inconvenient and does not scale.

Align new cmake files with:
https://docs.zephyrproject.org/latest/contribute/style/cmake.html

Link: #8260
Signed-off-by: Kai Vehmanen kai.vehmanen@linux.intel.com

cmake/zephyr: decentralize src/debug/tester/

Adding all source files in a single, giant zephyr/CMakeLists.txt is
inconvenient and does not scale.

Link: #8260
Signed-off-by: Kai Vehmanen kai.vehmanen@linux.intel.com

Marking as draft until #9896 is merged (part of this PR).

@kv2019i
Copy link
Collaborator Author

kv2019i commented Mar 14, 2025

Note: using the Zephyr cmake style for all new/rewritten files, see https://github.com/orgs/thesofproject/discussions/9899

Copy link
Member

@lgirdwood lgirdwood left a comment

Choose a reason for hiding this comment

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

LGTM

kv2019i added 4 commits March 17, 2025 14:25
Adding all source files in a single, giant zephyr/CMakeLists.txt is
inconvenient and does not scale.

Link: thesofproject#8260
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Adding all source files in a single, giant zephyr/CMakeLists.txt is
inconvenient and does not scale.

Align new cmake files with:
https://docs.zephyrproject.org/latest/contribute/style/cmake.html

Link: thesofproject#8260
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Now that cmake rules are moved to same directory as source files,
no need to specify the full path for source files.

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Reorder the add_subdirectory() statements to alphabetical
order. There will be more entries here, so better to organize
this list now.

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
@kv2019i kv2019i force-pushed the 202403-cmake-decentr-dbg-tester-and-math branch from 970e7ae to 29f495e Compare March 17, 2025 12:43
@kv2019i kv2019i marked this pull request as ready for review March 17, 2025 12:45
if(CONFIG_CORDIC_FIXED)
add_local_sources(sof trig.c)
list(APPEND base_files trig.c)
endif()
Copy link
Collaborator

Choose a reason for hiding this comment

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

can a add_list_ifdef() cmake function be used? I'm not a cmake expert, so not sure whether objects are passed by reference

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@lyakh I was going back and forth with this. Not an cmake expert here either, but given we need new owners for cmake magic in SOF, we probably need to just learn more.

We could add a function, but we'd need to add it as a SOF extension (Zephyr has list_append_if() but we can't use that).
What I'm personally not sure is that is it worth it to save some lines in definitions versus keeping SOF cmake files as close to standard cmake files as possible. I.e. functions that are used are standard cmake functions. Most of people contributing to SOF will not be cmake experts either.

On the other hand, we have a LOT of use for add_local_sources_if(), so having a replacement macro that facilitates Zephyr/XTOS might still be useful.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Update: hmm, it seems add_local_sources_if() is already a "SOF'ism", a macro defined and used only in SOF. So it seems we've already gone the path to use SOF specific macros to avoid repetition. I can update to this approach.

@kv2019i kv2019i changed the title cmake/zephyr: decentralize src/{debug/tester,math} (on top of PR9896) cmake/zephyr: decentralize src/{debug/tester,math} Mar 18, 2025
@kv2019i kv2019i merged commit 96393fe into thesofproject:main Mar 18, 2025
46 of 49 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants