chromium/media/cdm/library_cdm/cdm_paths.gni

# Copyright 2016 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

import("//build/config/chromeos/ui_mode.gni")
import("//media/media_options.gni")

# This file defines output paths for the CDM adapters and CDMs.
assert(enable_library_cdms)

# Naming and folder structure below are following the recommendation for Chrome
# components. Component-updated CDMs must follow the same recommendation.

# OS name for components is close to "target_os" but has some differences.
# Explicitly define what we use to avoid confusion.
if (is_chromeos) {
  component_os = "cros"
} else if (is_linux) {
  component_os = "linux"
} else if (is_win) {
  component_os = "win"
} else if (is_mac) {
  component_os = "mac"
} else if (is_fuchsia) {
  component_os = "fuchsia"
} else {
  assert(false, "unsupported_platform")
}

component_arch = "$current_cpu"

# Enable platform specific paths. This is required when the CDMs are Chrome
# components, but is optional for other platforms.
# Note:
# - |cdm_platform_specific_path| is exported as a BUILDFLAG to cdm_paths.cc.
cdm_platform_specific_path =
    "_platform_specific/$component_os" + "_" + "$component_arch"

# Path of Clear Key and Widevine CDMs relative to the output dir.
clearkey_cdm_path = "ClearKeyCdm/$cdm_platform_specific_path"
widevine_cdm_path = "WidevineCdm/$cdm_platform_specific_path"

# Shared libraries must be within lib/ on Fuchsia.
# TODO(fxbug.dev/105910): Remove when the GN SDK drops this limitation.
if (is_fuchsia) {
  clearkey_cdm_path = "lib/" + clearkey_cdm_path
  widevine_cdm_path = "lib/" + clearkey_cdm_path
}