2021-06-17 03:42:11 +08:00
|
|
|
set(SOF_TOPOLOGY_BINARY_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
|
2019-02-03 08:09:01 +08:00
|
|
|
|
2021-12-11 08:09:43 +08:00
|
|
|
# This use of VERBOSE relies on original CMake behavior.
|
|
|
|
# From the add_custom_command() manual:
|
|
|
|
#
|
|
|
|
# Use of VERBATIM is recommended as it enables correct behavior.
|
|
|
|
# When VERBATIM is not given the behavior is platform specific because
|
|
|
|
# there is no protection of tool-specific special characters.
|
|
|
|
#
|
|
|
|
# This is fine because:
|
|
|
|
# - We don't expect alsatplg to work on Windows any time soon.
|
|
|
|
# - CMake is too afraid to remove the original, no-VERBATIM behavior:
|
|
|
|
# https://gitlab.kitware.com/cmake/cmake/issues/18849
|
|
|
|
#
|
|
|
|
# Also note that in alsa-utils commit v1.2.2~15-gcbabe7a3f0cc, alsatplg
|
|
|
|
# (accidentally?) started ignoring the verbosity level, now it's just
|
|
|
|
# verbose or not.
|
|
|
|
macro(add_alsatplg_command)
|
|
|
|
add_custom_command(
|
|
|
|
MAIN_DEPENDENCY ${ARGV0}
|
|
|
|
OUTPUT ${ARGV1}
|
2021-12-24 16:09:36 +08:00
|
|
|
# Warning: before alsa-utils fix 8e71fba810b87c,
|
|
|
|
# permissions are hardcoded and only the user can read
|
|
|
|
# the -o(utput) file.
|
|
|
|
# See bug https://github.com/alsa-project/alsa-utils/issues/126
|
|
|
|
COMMAND alsatplg \$\${VERBOSE:+-v 1} -c ${ARGV0} -o ${ARGV1}
|
2021-12-11 08:09:43 +08:00
|
|
|
USES_TERMINAL
|
|
|
|
)
|
|
|
|
endmacro()
|
|
|
|
|
2022-09-27 17:00:21 +08:00
|
|
|
macro(add_alsatplg2_command conf_header conf_target input_name output_name include_path)
|
2022-01-24 12:28:32 +08:00
|
|
|
# command line definitions are optional
|
|
|
|
# Set defines if there is an optional argument
|
2022-09-27 17:00:21 +08:00
|
|
|
if (${ARGC} GREATER 5)
|
|
|
|
set (defines ${ARGV5})
|
2022-01-25 09:45:32 +08:00
|
|
|
else()
|
|
|
|
set (defines "")
|
2022-01-24 12:28:32 +08:00
|
|
|
endif()
|
|
|
|
|
2022-01-25 09:45:32 +08:00
|
|
|
add_custom_command(
|
2022-09-27 08:00:52 +08:00
|
|
|
MAIN_DEPENDENCY ${input_name}.conf
|
2022-09-27 17:00:21 +08:00
|
|
|
# The conf_header file is the real dependency that
|
|
|
|
# triggers a rebuild. conf_target is the target that
|
|
|
|
# avoids a race to rebuild conf_header. See the CMake FAQ
|
|
|
|
# or (better) Sam Thursfield's blog about custom
|
|
|
|
# targets.
|
|
|
|
DEPENDS ${conf_header} ${conf_target}
|
2022-09-27 08:00:52 +08:00
|
|
|
OUTPUT ${output_name}.tplg
|
|
|
|
|
|
|
|
COMMAND cat ${conf_header} ${input_name}.conf > ${output_name}.conf
|
|
|
|
|
2022-01-25 09:45:32 +08:00
|
|
|
# -p to pre-process Topology2.0 conf file
|
2022-01-25 10:01:12 +08:00
|
|
|
COMMAND ALSA_CONFIG_DIR=${CMAKE_SOURCE_DIR}/topology/topology2 alsatplg \$\${VERBOSE:+-v 1}
|
2022-09-27 08:00:52 +08:00
|
|
|
-I ${include_path} -D "'${defines}'" -p -c ${output_name}.conf -o ${output_name}.tplg
|
2022-01-25 09:45:32 +08:00
|
|
|
USES_TERMINAL
|
2022-01-24 12:28:32 +08:00
|
|
|
)
|
2022-01-06 05:14:13 +08:00
|
|
|
endmacro()
|
|
|
|
|
2021-12-11 08:09:43 +08:00
|
|
|
|
2019-02-03 08:09:01 +08:00
|
|
|
add_custom_target(topologies ALL)
|
2021-06-17 03:42:11 +08:00
|
|
|
add_dependencies(topologies topologies1)
|
2019-02-03 08:09:01 +08:00
|
|
|
|
2021-06-17 03:42:11 +08:00
|
|
|
add_subdirectory(topology1)
|
2022-01-06 05:14:13 +08:00
|
|
|
add_subdirectory(topology2)
|