-
Notifications
You must be signed in to change notification settings - Fork 349
cmake/zephyr: decentralize src/{debug/tester,math} #9901
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
kv2019i
merged 4 commits into
thesofproject:main
from
kv2019i:202403-cmake-decentr-dbg-tester-and-math
Mar 18, 2025
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
1216614
cmake/zephyr: decentralize src/debug/tester/
kv2019i 5a2a069
cmake/zephyr: decentralize src/math/
kv2019i 09566cd
schedule: trim unnecessary paths from source files
kv2019i 29f495e
cmake/zephyr: sort the add_subdirectory() statement list
kv2019i File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,3 +1,27 @@ | ||
| add_local_sources(tester.c) | ||
| add_local_sources(tester_dummy_test.c) | ||
| add_local_sources(tester_simple_dram_test.c) | ||
| # SPDX-License-Identifier: BSD-3-Clause | ||
|
|
||
| set(base_files | ||
| tester.c | ||
| tester_dummy_test.c | ||
| tester_simple_dram_test.c | ||
| ) | ||
|
|
||
| is_zephyr(it_is) | ||
| if(it_is) ### Zephyr ### | ||
|
|
||
| if(CONFIG_COMP_TESTER STREQUAL "m") | ||
|
|
||
| add_subdirectory(llext ${PROJECT_BINARY_DIR}/tester_llext) | ||
| add_dependencies(app tester) | ||
|
|
||
| elseif(CONFIG_COMP_TESTER) | ||
|
|
||
| zephyr_library_sources(${base_files}) | ||
|
|
||
| endif() | ||
|
|
||
| else() ### XTOS ### | ||
|
|
||
| add_local_sources(sof ${base_files}) | ||
|
|
||
| endif() |
This file contains hidden or 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,58 +1,92 @@ | ||
| # SPDX-License-Identifier: BSD-3-Clause | ||
|
|
||
| if(BUILD_LIBRARY) | ||
| add_local_sources(sof numbers.c) | ||
| return() | ||
| add_local_sources(sof numbers.c) | ||
| return() | ||
| endif() | ||
|
|
||
| add_local_sources(sof numbers.c) | ||
| set(base_files numbers.c) | ||
|
|
||
| if(CONFIG_CORDIC_FIXED) | ||
| add_local_sources(sof trig.c) | ||
| list(APPEND base_files trig.c) | ||
| endif() | ||
|
|
||
| add_local_sources_ifdef(CONFIG_MATH_LUT_SINE_FIXED sof lut_trig.c) | ||
| if(CONFIG_MATH_LUT_SINE_FIXED) | ||
| list(APPEND base_files lut_trig.c) | ||
| endif() | ||
|
|
||
| add_local_sources_ifdef(CONFIG_SQRT_FIXED sof sqrt_int16.c) | ||
| if(CONFIG_SQRT_FIXED) | ||
| list(APPEND base_files sqrt_int16.c) | ||
| endif() | ||
|
|
||
| add_local_sources_ifdef(CONFIG_MATH_EXP sof exp_fcn.c exp_fcn_hifi.c) | ||
| if(CONFIG_MATH_EXP) | ||
| list(APPEND base_files exp_fcn.c exp_fcn_hifi.c) | ||
| endif() | ||
|
|
||
| if(CONFIG_MATH_DECIBELS) | ||
| add_local_sources(sof decibels.c) | ||
| list(APPEND base_files decibels.c) | ||
| endif() | ||
|
|
||
| add_local_sources_ifdef(CONFIG_NATURAL_LOGARITHM_FIXED sof log_e.c) | ||
| if(CONFIG_NATURAL_LOGARITHM_FIXED) | ||
| list(APPEND base_files log_e.c) | ||
| endif() | ||
|
|
||
| add_local_sources_ifdef(CONFIG_COMMON_LOGARITHM_FIXED sof log_10.c) | ||
| if(CONFIG_COMMON_LOGARITHM_FIXED) | ||
| list(APPEND base_files log_10.c) | ||
| endif() | ||
|
|
||
| add_local_sources_ifdef(CONFIG_POWER_FIXED sof power.c) | ||
| if(CONFIG_POWER_FIXED) | ||
| list(APPEND base_files power.c) | ||
| endif() | ||
|
|
||
| add_local_sources_ifdef(CONFIG_BINARY_LOGARITHM_FIXED sof base2log.c) | ||
| if(CONFIG_BINARY_LOGARITHM_FIXED) | ||
| list(APPEND base_files base2log.c) | ||
| endif() | ||
|
|
||
| add_local_sources_ifdef(CONFIG_MATH_FIR sof fir_generic.c fir_hifi2ep.c fir_hifi3.c fir_hifi5.c) | ||
| if(CONFIG_MATH_FIR STREQUAL "m") | ||
| add_subdirectory(fir_llext ${PROJECT_BINARY_DIR}/fir_llext) | ||
| add_dependencies(app fir) | ||
| elseif(CONFIG_MATH_FIR) | ||
| list(APPEND base_files fir_generic.c fir_hifi2ep.c fir_hifi3.c fir_hifi5.c) | ||
| endif() | ||
|
|
||
| if(CONFIG_MATH_FFT) | ||
| add_subdirectory(fft) | ||
| add_subdirectory(fft) | ||
| endif() | ||
|
|
||
| add_local_sources_ifdef(CONFIG_MATH_IIR_DF2T sof | ||
| iir_df2t_generic.c iir_df2t_hifi3.c iir_df2t.c) | ||
| if(CONFIG_MATH_IIR_DF2T) | ||
| list(APPEND base_files iir_df2t_generic.c iir_df2t_hifi3.c iir_df2t.c) | ||
| endif() | ||
|
|
||
| add_local_sources_ifdef(CONFIG_MATH_IIR_DF1 sof | ||
| iir_df1_generic.c iir_df1_hifi3.c iir_df1_hifi4.c iir_df1_hifi5.c iir_df1.c) | ||
| if(CONFIG_MATH_IIR_DF1) | ||
| list(APPEND base_files iir_df1_generic.c iir_df1_hifi3.c iir_df1_hifi4.c iir_df1_hifi5.c iir_df1.c) | ||
| endif() | ||
|
|
||
| if(CONFIG_MATH_WINDOW) | ||
| add_local_sources(sof window.c) | ||
| list(APPEND base_files window.c) | ||
| endif() | ||
|
|
||
| if(CONFIG_MATH_MATRIX) | ||
| add_local_sources(sof matrix.c) | ||
| list(APPEND base_files matrix.c) | ||
| endif() | ||
|
|
||
| if(CONFIG_MATH_AUDITORY) | ||
| add_subdirectory(auditory) | ||
| add_subdirectory(auditory) | ||
| endif() | ||
|
|
||
| if(CONFIG_MATH_DCT) | ||
| add_local_sources(sof dct.c) | ||
| list(APPEND base_files dct.c) | ||
| endif() | ||
|
|
||
| is_zephyr(it_is) | ||
| if(it_is) ### Zephyr ### | ||
|
|
||
| zephyr_library_sources( | ||
| ${base_files} | ||
| ) | ||
|
|
||
| else() ### XTOS ### | ||
|
|
||
| add_local_sources(sof ${base_files}) | ||
|
|
||
| endif() | ||
This file contains hidden or 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,7 +1,24 @@ | ||
| # SPDX-License-Identifier: BSD-3-Clause | ||
|
|
||
| add_local_sources(sof auditory.c) | ||
| set(base_files auditory.c) | ||
|
|
||
| add_local_sources_ifdef(CONFIG_MATH_16BIT_MEL_FILTERBANK sof mel_filterbank_16.c) | ||
| if(CONFIG_MATH_16BIT_MEL_FILTERBANK) | ||
| list(APPEND base_files mel_filterbank_16.c) | ||
| endif() | ||
|
|
||
| add_local_sources_ifdef(CONFIG_MATH_32BIT_MEL_FILTERBANK sof mel_filterbank_32.c) | ||
| if(CONFIG_MATH_32BIT_MEL_FILTERBANK) | ||
| list(APPEND base_files mel_filterbank_32.c) | ||
| endif() | ||
|
|
||
| is_zephyr(it_is) | ||
| if(it_is) ### Zephyr ### | ||
|
|
||
| zephyr_library_sources( | ||
| ${base_files} | ||
| ) | ||
|
|
||
| else() ### XTOS ### | ||
|
|
||
| add_local_sources(sof ${base_files}) | ||
|
|
||
| endif() |
This file contains hidden or 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,7 +1,24 @@ | ||
| # SPDX-License-Identifier: BSD-3-Clause | ||
|
|
||
| add_local_sources(sof fft_common.c) | ||
| set(base_files fft_common.c) | ||
|
|
||
| add_local_sources_ifdef(CONFIG_MATH_16BIT_FFT sof fft_16.c fft_16_hifi3.c) | ||
| if(CONFIG_MATH_16BIT_FFT) | ||
| list(APPEND base_files fft_16.c fft_16_hifi3.c) | ||
| endif() | ||
|
|
||
| add_local_sources_ifdef(CONFIG_MATH_32BIT_FFT sof fft_32.c fft_32_hifi3.c) | ||
| if(CONFIG_MATH_32BIT_FFT) | ||
| list(APPEND base_files fft_32.c fft_32_hifi3.c) | ||
| endif() | ||
|
|
||
| is_zephyr(it_is) | ||
| if(it_is) ### Zephyr ### | ||
|
|
||
| zephyr_library_sources( | ||
| ${base_files} | ||
| ) | ||
|
|
||
| else() ### XTOS ### | ||
|
|
||
| add_local_sources(sof ${base_files}) | ||
|
|
||
| endif() |
This file contains hidden or 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 hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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 referenceThere was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.