1# SPDX-License-Identifier: BSD-3-Clause
2
3include(tplg-targets.cmake)
4
5add_custom_target(topology2_ace)
6
7foreach(tplg ${TPLGS})
8	set(defines "")
9	list(LENGTH tplg length)
10	list(GET tplg 0 input)
11	list(GET tplg 1 output)
12
13	math(EXPR last_index "${length}-1")
14
15	# Get the pre-processor definitions from the 3rd item in the list for each topology
16	# ex: "hda-generic\;hda-generic-2ch\;HDA_CONFIG=gain,DMIC_CH=2", "defines" would contain "HDA_CONFIG=gain,DMIC_CH=2"
17	if (${last_index} EQUAL 2)
18		list(GET tplg ${last_index} defines)
19	endif()
20
21	add_alsatplg2_command("${CMAKE_CURRENT_BINARY_DIR}/../abi.conf" abi_target
22	  "${CMAKE_CURRENT_SOURCE_DIR}/../${input}" "${output}"
23	  "${CMAKE_CURRENT_SOURCE_DIR}/../" "${defines}")
24
25	add_custom_target(topology2_ace_${output} DEPENDS ${output}.tplg)
26	add_dependencies(topology2_ace topology2_ace_${output})
27endforeach()
28