From 1b1ec6c4920f9e607259a5ad5e1a5580a9cd6fbd Mon Sep 17 00:00:00 2001 From: Marc Herbert Date: Mon, 23 Oct 2023 15:08:51 -0700 Subject: [PATCH] topology/cmake: skip all topologies when alsatplg < 1.2.5 Stop producing corrupted .tplg files when using `codec_consumer` (e.g.: sof-imx8mp-btsco-dual-8ch.tplg, sof-imx8ulp-9x9-btsco-16k.tplg, ...) Then we'll be able to finally search/replace "codec_master", see revert Signed-off-by: Marc Herbert --- tools/topology/CMakeLists.txt | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/tools/topology/CMakeLists.txt b/tools/topology/CMakeLists.txt index 23b5f9ae7..33722120e 100644 --- a/tools/topology/CMakeLists.txt +++ b/tools/topology/CMakeLists.txt @@ -25,6 +25,25 @@ ${stdout}") endfunction() +# Being written in C, `alsatplg` silently ignores some invalid inputs +# and produces an corrupt .tplg file instead of returning an error code +# that fails the build. For instance, alsatplg versions < 1.2.5 silently +# corrupt `codec_consumer` and turn it into `codec_master` instead. +# Longer story in #5192. +alsatplg_version(STATUS ALSATPLG_VERSION_NUMBER) +if(NOT STATUS EQUAL 0) + message(WARNING "alsatplg failed: ${STATUS}; all topologies skipped") + return() +else() + if(${ALSATPLG_VERSION_NUMBER} VERSION_LESS "1.2.5") + message(WARNING "All topologies skipped: minimum alsatplg version 1.2.5,\ + found ${ALSATPLG_VERSION_NUMBER}.") + return() + endif() + # success +endif() + + # This use of VERBOSE relies on original CMake behavior. # From the add_custom_command() manual: #