diff --git a/tools/topology/CMakeLists.txt b/tools/topology/CMakeLists.txt index 4b7b36d1a..a25135402 100644 --- a/tools/topology/CMakeLists.txt +++ b/tools/topology/CMakeLists.txt @@ -28,21 +28,24 @@ macro(add_alsatplg_command) ) endmacro() -macro(add_alsatplg2_command input_file output_file include_path) +macro(add_alsatplg2_command conf_header input_name output_name include_path) # command line definitions are optional # Set defines if there is an optional argument - if (${ARGC} GREATER 3) - set (defines ${ARGV3}) + if (${ARGC} GREATER 4) + set (defines ${ARGV4}) else() set (defines "") endif() add_custom_command( - MAIN_DEPENDENCY ${input_file} - OUTPUT ${output_file} + MAIN_DEPENDENCY ${input_name}.conf + OUTPUT ${output_name}.tplg + + COMMAND cat ${conf_header} ${input_name}.conf > ${output_name}.conf + # -p to pre-process Topology2.0 conf file COMMAND ALSA_CONFIG_DIR=${CMAKE_SOURCE_DIR}/topology/topology2 alsatplg \$\${VERBOSE:+-v 1} - -I ${include_path} -D "'${defines}'" -p -c ${input_file} -o ${output_file} + -I ${include_path} -D "'${defines}'" -p -c ${output_name}.conf -o ${output_name}.tplg USES_TERMINAL ) endmacro() diff --git a/tools/topology/topology2/cavs/CMakeLists.txt b/tools/topology/topology2/cavs/CMakeLists.txt index ee60915e5..a9d89fba4 100644 --- a/tools/topology/topology2/cavs/CMakeLists.txt +++ b/tools/topology/topology2/cavs/CMakeLists.txt @@ -68,15 +68,9 @@ foreach(tplg ${TPLGS}) list(GET tplg ${last_index} defines) endif() - # copy ABI and input conf file contents - # - # BUG: move this from CMake configuration time to build time to - # fix incremental builds - configure_file(${CMAKE_CURRENT_BINARY_DIR}/abi.conf ${CMAKE_CURRENT_BINARY_DIR}/${output}.conf) - file(READ ${CMAKE_CURRENT_SOURCE_DIR}/${input}.conf CONTENTS) - file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/${output}.conf "${CONTENTS}") - - add_alsatplg2_command("${output}.conf" "${output}.tplg" "${CMAKE_CURRENT_SOURCE_DIR}" "${defines}") + add_alsatplg2_command("${CMAKE_CURRENT_BINARY_DIR}/abi.conf" + "${CMAKE_CURRENT_SOURCE_DIR}/${input}" "${output}" + "${CMAKE_CURRENT_SOURCE_DIR}" "${defines}") add_custom_target(topology2_${output} DEPENDS ${output}.tplg) add_dependencies(topology2_cavs topology2_${output}) endforeach() diff --git a/tools/topology/topology2/get_abi.sh b/tools/topology/topology2/get_abi.sh index 73a0bac5c..1ddb8549b 100755 --- a/tools/topology/topology2/get_abi.sh +++ b/tools/topology/topology2/get_abi.sh @@ -36,4 +36,4 @@ case "$2" in ipc4) print_2bytes "$ABI_PATCH" ;; esac -printf '\"\n\t}\n}' +printf '\"\n\t}\n}\n'