From 2c760aa1c7e88720233312f65e8784c95eff0499 Mon Sep 17 00:00:00 2001 From: Marc Herbert Date: Fri, 17 Nov 2023 23:09:13 +0000 Subject: [PATCH] zephyr/cmake: move math/*.c files to now common math/CMakeLists.txt CMake decentralization per #8260 The purpose of #8260 is to divide and conquer the giant zephyr/CMakeLists.txt file while staying _bug-for-bug compatible_. Signed-off-by: Marc Herbert --- src/math/CMakeLists.txt | 17 ++++++++++++++--- zephyr/CMakeLists.txt | 34 +--------------------------------- 2 files changed, 15 insertions(+), 36 deletions(-) diff --git a/src/math/CMakeLists.txt b/src/math/CMakeLists.txt index afbc4718fa59..8e78bf2edefa 100644 --- a/src/math/CMakeLists.txt +++ b/src/math/CMakeLists.txt @@ -5,9 +5,13 @@ if(BUILD_LIBRARY) return() endif() +is_zephyr(it_is_zephyr) + add_local_sources(sof numbers.c) -if(CONFIG_CORDIC_FIXED) +# Up to now, trig.c has never been optional in Zephyr. +# Maybe it should be in the future. +if(CONFIG_CORDIC_FIXED OR it_is_zephyr) add_local_sources(sof trig.c) endif() @@ -15,10 +19,13 @@ add_local_sources_ifdef(CONFIG_SQRT_FIXED sof sqrt_int16.c) add_local_sources_ifdef(CONFIG_MATH_EXP sof exp_fcn.c exp_fcn_hifi.c) -if(CONFIG_MATH_DECIBELS) +# Up to now, decibels.c has never been optional in Zephyr. +# Maybe it should be in the future. +if(CONFIG_MATH_DECIBELS OR it_is_zephyr) add_local_sources(sof decibels.c) endif() +if(NOT it_is_zephyr) # So far none of these has ever been enabled in Zephyr. add_local_sources_ifdef(CONFIG_NATURAL_LOGARITHM_FIXED sof log_e.c) add_local_sources_ifdef(CONFIG_COMMON_LOGARITHM_FIXED sof log_10.c) @@ -26,10 +33,12 @@ add_local_sources_ifdef(CONFIG_COMMON_LOGARITHM_FIXED sof log_10.c) add_local_sources_ifdef(CONFIG_POWER_FIXED sof power.c) add_local_sources_ifdef(CONFIG_BINARY_LOGARITHM_FIXED sof base2log.c) +endif() add_local_sources_ifdef(CONFIG_MATH_FIR sof fir_generic.c fir_hifi2ep.c fir_hifi3.c) -if(CONFIG_MATH_FFT) +# So far this directory has never been enabled in Zephyr. +if(CONFIG_MATH_FFT AND NOT it_is_zephyr) add_subdirectory(fft) endif() @@ -39,6 +48,7 @@ add_local_sources_ifdef(CONFIG_MATH_IIR_DF2T sof add_local_sources_ifdef(CONFIG_MATH_IIR_DF1 sof iir_df1_generic.c iir_df1_hifi3.c iir_df1.c) +if(NOT it_is_zephyr) # So far none of these has ever been enabled in Zephyr. if(CONFIG_MATH_WINDOW) add_local_sources(sof window.c) endif() @@ -54,3 +64,4 @@ endif() if(CONFIG_MATH_DCT) add_local_sources(sof dct.c) endif() +endif() # not Zephyr diff --git a/zephyr/CMakeLists.txt b/zephyr/CMakeLists.txt index 06e4ea9970c1..3cbb8739dbb3 100644 --- a/zephyr/CMakeLists.txt +++ b/zephyr/CMakeLists.txt @@ -56,7 +56,6 @@ set(SOF_SAMPLES_PATH "${SOF_SRC_PATH}/samples") set(SOF_LIB_PATH "${SOF_SRC_PATH}/lib") set(SOF_DRIVERS_PATH "${SOF_SRC_PATH}/drivers") set(SOF_DEBUG_PATH "${SOF_SRC_PATH}/debug") -set(SOF_MATH_PATH "${SOF_SRC_PATH}/math") set(SOF_TRACE_PATH "${SOF_SRC_PATH}/trace") set(RIMAGE_TOP ${sof_top_dir}/tools/rimage) @@ -146,6 +145,7 @@ endmacro() add_subdirectory(../src/init/ init_unused_install/) add_subdirectory(../src/ipc/ ipc_unused_install/) +add_subdirectory(../src/math/ math_unused_install/) @@ -366,11 +366,6 @@ zephyr_include_directories(${SOF_PLATFORM_PATH}/${PLATFORM}/include) # Commented files will be added/removed as integration dictates. zephyr_library_sources( - # SOF math utilities - ${SOF_MATH_PATH}/decibels.c - ${SOF_MATH_PATH}/numbers.c - ${SOF_MATH_PATH}/trig.c - # SOF library - parts to transition to Zephyr over time ${SOF_LIB_PATH}/clk.c ${SOF_LIB_PATH}/notifier.c @@ -485,24 +480,6 @@ elseif(CONFIG_IPC_MAJOR_4) ) endif() -zephyr_library_sources_ifdef(CONFIG_MATH_FIR - ${SOF_MATH_PATH}/fir_generic.c - ${SOF_MATH_PATH}/fir_hifi2ep.c - ${SOF_MATH_PATH}/fir_hifi3.c -) - -zephyr_library_sources_ifdef(CONFIG_MATH_IIR_DF1 - ${SOF_MATH_PATH}/iir_df1_generic.c - ${SOF_MATH_PATH}/iir_df1_hifi3.c - ${SOF_MATH_PATH}/iir_df1.c -) - -zephyr_library_sources_ifdef(CONFIG_MATH_IIR_DF2T - ${SOF_MATH_PATH}/iir_df2t_generic.c - ${SOF_MATH_PATH}/iir_df2t_hifi3.c - ${SOF_MATH_PATH}/iir_df2t.c -) - zephyr_library_sources_ifdef(CONFIG_COMP_ASRC ${SOF_AUDIO_PATH}/asrc/asrc.c ${SOF_AUDIO_PATH}/asrc/asrc_farrow_hifi3.c @@ -785,15 +762,6 @@ zephyr_library_sources_ifdef(CONFIG_COMP_TDFB ${SOF_AUDIO_PATH}/tdfb/tdfb_hifi3.c ) -zephyr_library_sources_ifdef(CONFIG_SQRT_FIXED - ${SOF_MATH_PATH}/sqrt_int16.c -) - -zephyr_library_sources_ifdef(CONFIG_MATH_EXP - ${SOF_MATH_PATH}/exp_fcn.c - ${SOF_MATH_PATH}/exp_fcn_hifi.c -) - zephyr_library_sources_ifdef(CONFIG_COMP_UP_DOWN_MIXER ${SOF_AUDIO_PATH}/up_down_mixer/up_down_mixer.c ${SOF_AUDIO_PATH}/up_down_mixer/up_down_mixer_hifi3.c