Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 24 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,33 @@ endif()

# Resolve SOF ABI header (include/kernel/abi.h)
# 1. Explicit -DSOF_ABI_HEADER=/path/to/abi.h
# 2. External SOF checkout via -DSOF_ROOT_SOURCE_DIRECTORY=/path/to/sof
# 2. External SOF checkout via -DSOF_ROOT_SOURCE_DIRECTORY=/path/to/sof,
# $SOF_SRC_DIR / $SOF_ROOT, `west list -f "{abspath}" sof`, or ../sof
# 3. Local standalone copy in ${PROJECT_SOURCE_DIR}/include/kernel/abi.h
if(NOT SOF_ABI_HEADER)
if(NOT DEFINED SOF_ROOT_SOURCE_DIRECTORY)
if(DEFINED ENV{SOF_SRC_DIR} AND EXISTS "$ENV{SOF_SRC_DIR}/src/include/kernel/abi.h")
set(SOF_ROOT_SOURCE_DIRECTORY "$ENV{SOF_SRC_DIR}")
elseif(DEFINED ENV{SOF_ROOT} AND EXISTS "$ENV{SOF_ROOT}/src/include/kernel/abi.h")
set(SOF_ROOT_SOURCE_DIRECTORY "$ENV{SOF_ROOT}")
else()
execute_process(
COMMAND west list -f "{abspath}" sof
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
OUTPUT_VARIABLE _west_sof_dir
OUTPUT_STRIP_TRAILING_WHITESPACE
ERROR_QUIET
)
if(_west_sof_dir AND EXISTS "${_west_sof_dir}/src/include/kernel/abi.h")
set(SOF_ROOT_SOURCE_DIRECTORY "${_west_sof_dir}")
elseif(EXISTS "${PROJECT_SOURCE_DIR}/../sof/src/include/kernel/abi.h")
set(SOF_ROOT_SOURCE_DIRECTORY "${PROJECT_SOURCE_DIR}/../sof")
endif()
endif()
endif()

if(DEFINED SOF_ROOT_SOURCE_DIRECTORY AND EXISTS "${SOF_ROOT_SOURCE_DIRECTORY}/src/include/kernel/abi.h")
get_filename_component(SOF_ROOT_SOURCE_DIRECTORY "${SOF_ROOT_SOURCE_DIRECTORY}" ABSOLUTE)
set(SOF_ABI_HEADER "${SOF_ROOT_SOURCE_DIRECTORY}/src/include/kernel/abi.h")
else()
set(SOF_ABI_HEADER "${PROJECT_SOURCE_DIR}/include/kernel/abi.h")
Expand Down
10 changes: 10 additions & 0 deletions cmake/alsatplg.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,16 @@ if(NOT ALSATPLG_CMD)
if(DEFINED ENV{SOF_WORKSPACE})
list(APPEND _alsa_candidates "$ENV{SOF_WORKSPACE}/tools/bin/alsatplg")
endif()
execute_process(
COMMAND west topdir
WORKING_DIRECTORY "${CMAKE_CURRENT_LIST_DIR}"
OUTPUT_VARIABLE _west_topdir
OUTPUT_STRIP_TRAILING_WHITESPACE
ERROR_QUIET
)
if(_west_topdir)
list(APPEND _alsa_candidates "${_west_topdir}/tools/bin/alsatplg")
endif()
list(APPEND _alsa_candidates
"${PROJECT_SOURCE_DIR}/../tools/bin/alsatplg"
"${CMAKE_CURRENT_LIST_DIR}/../../tools/bin/alsatplg"
Expand Down
4 changes: 2 additions & 2 deletions scripts/build-alsa-tools.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ declare -a COMMIT_ID=(
# Directory where repositories and tools/ will be cloned/installed.
if [[ -n "${SOF_WORKSPACE:-}" ]]; then
BASE_DIR="$SOF_WORKSPACE"
elif [[ -d "$(dirname "$REPO_ROOT")/sof" ]]; then
BASE_DIR="$(dirname "$REPO_ROOT")"
elif command -v west >/dev/null 2>&1 && _west_top="$(cd "$REPO_ROOT" && west topdir 2>/dev/null)" && [[ -n "$_west_top" ]]; then
BASE_DIR="$_west_top"
else
BASE_DIR="$(dirname "$REPO_ROOT")"
fi
Expand Down
5 changes: 5 additions & 0 deletions scripts/build-topology.sh
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,11 @@ make_target()
sync_compat_links()
{
local sof_repo="${SOF_WORKSPACE:+${SOF_WORKSPACE}/sof}"
if [ -z "$sof_repo" ] || [ ! -d "$sof_repo" ]; then
if command -v west >/dev/null 2>&1; then
sof_repo="$(cd "$SOF_TOPOLOGY_REPO" && west list -f "{abspath}" sof 2>/dev/null || true)"
fi
fi
if [ -z "$sof_repo" ] || [ ! -d "$sof_repo" ]; then
sof_repo="$(dirname "$SOF_TOPOLOGY_REPO")/sof"
fi
Expand Down
11 changes: 10 additions & 1 deletion west.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
# SPDX-License-Identifier: BSD-3-Clause
#
# West manifest for standalone sof-topology usage.
# West manifest for standalone sof-topologies usage.
#
# Usage & update conventions:
# - Standalone topology workspace (uses local include/kernel/abi.h, no SOF/Zephyr clone):
# west init -l sof-topologies && west update
# Update `self` (sof-topologies) with Git, then sync ALSA dependencies with West:
# git -C sof-topologies pull && west update
# - Full SOF workspace (`west init -l sof`):
# `sof/west.yml` imports `alsa-lib` and `alsa-utils` from this file so the
# pinned ALSA commits are maintained in a single place.

manifest:
version: "0.13"
Expand Down
Loading