mirror of https://github.com/thesofproject/sof.git
topology2: fix build issues with no command line definitions
If there are no command line definitions, the build fails because the 4th argument to the add_alsatplg2_command macro is NULL. Fix this by using named arguments for the macro and checking for the optional argument for command line definitions. Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
This commit is contained in:
parent
95d8e941cf
commit
cb80023b22
|
@ -28,14 +28,34 @@ macro(add_alsatplg_command)
|
||||||
)
|
)
|
||||||
endmacro()
|
endmacro()
|
||||||
|
|
||||||
macro(add_alsatplg2_command)
|
macro(add_alsatplg2_command input_file output_file include_path)
|
||||||
add_custom_command(
|
# command line definitions are optional
|
||||||
MAIN_DEPENDENCY ${ARGV0}
|
set (defines "")
|
||||||
OUTPUT ${ARGV1}
|
set (optional_args ${ARGN})
|
||||||
# -p to pre-process Topology2.0 conf file
|
|
||||||
COMMAND alsatplg \$\${VERBOSE:+-v 1} -I ${ARGV2} -D ${ARGV3} -p -c ${ARGV0} -o ${ARGV1}
|
# Set defines if there is an optional argument
|
||||||
USES_TERMINAL
|
list(LENGTH optional_args optional_args_count)
|
||||||
)
|
if (${optional_args_count} GREATER 0)
|
||||||
|
list(GET optional_args 0 defines)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (defines STREQUAL "")
|
||||||
|
add_custom_command(
|
||||||
|
MAIN_DEPENDENCY ${input_file}
|
||||||
|
OUTPUT ${output_file}
|
||||||
|
# -p to pre-process Topology2.0 conf file
|
||||||
|
COMMAND alsatplg \$\${VERBOSE:+-v 1} -I ${include_path} -p -c ${input_file} -o ${output_file}
|
||||||
|
USES_TERMINAL
|
||||||
|
)
|
||||||
|
else()
|
||||||
|
add_custom_command(
|
||||||
|
MAIN_DEPENDENCY ${input_file}
|
||||||
|
OUTPUT ${output_file}
|
||||||
|
# -p to pre-process Topology2.0 conf file
|
||||||
|
COMMAND alsatplg \$\${VERBOSE:+-v 1} -I ${include_path} -D ${defines} -p -c ${input_file} -o ${output_file}
|
||||||
|
USES_TERMINAL
|
||||||
|
)
|
||||||
|
endif()
|
||||||
endmacro()
|
endmacro()
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -41,7 +41,7 @@ foreach(tplg ${TPLGS})
|
||||||
file(READ ${CMAKE_CURRENT_SOURCE_DIR}/${input}.conf CONTENTS)
|
file(READ ${CMAKE_CURRENT_SOURCE_DIR}/${input}.conf CONTENTS)
|
||||||
file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/${output}.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("${output}.conf" "${output}.tplg" "${CMAKE_CURRENT_SOURCE_DIR}" "${defines}")
|
||||||
add_custom_target(topology2_${output} DEPENDS ${output}.tplg)
|
add_custom_target(topology2_${output} DEPENDS ${output}.tplg)
|
||||||
add_dependencies(topology2_cavs topology2_${output})
|
add_dependencies(topology2_cavs topology2_${output})
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
Loading…
Reference in New Issue