summaryrefslogtreecommitdiffstats
path: root/third_party/widevine/cdm/BUILD.gn
blob: 79fad228776fff4357b9c27551fa44253db37c2f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

widevine_arch = cpu_arch
if (widevine_arch == "x86") {
  widevine_arch = "ia32"
}

if (is_android) {
  # Always available on Android regardless of branding.
  widevine_cdm_version_h_file = "android/widevine_cdm_version.h"
  widevine_cdm_binary_files = []
} else if (is_chrome_branded) {
  if (is_chromeos) {
    widevine_cdm_version_h_file =
      "chromeos/$widevine_arch/widevine_cdm_version.h"
    widevine_cdm_binary_files = [
      "chromeos/$widevine_arch/libwidevinecdm.so",
    ]
  } else if (is_linux) {
    widevine_cdm_version_h_file =
      "linux/$widevine_arch/widevine_cdm_version.h"
    widevine_cdm_binary_files = [
      "linux/$widevine_arch/libwidevinecdm.so",
    ]
  } else if (is_win) {
    widevine_cdm_version_h_file =
      "win/$widevine_arch/widevine_cdm_version.h"
    widevine_cdm_binary_files = [
      "win/$widevine_arch/widevinecdm.dll",
      "win/$widevine_arch/widevinecdm.dll.lib",
    ]
  } else if (is_mac) {
    widevine_cdm_version_h_file =
      "mac/$widevine_arch/widevine_cdm_version.h"
    widevine_cdm_binary_files = [
      "mac/$widevine_arch/libwidevinecdm.dylib",
    ]
  } else {
    # Other platforms, use the default one.
    widevine_cdm_version_h_file = "widevine_cdm_version.h"
    widevine_cdm_binary_files = []
  }
} else {
  # No branding, use the default one.
  widevine_cdm_version_h_file = "widevine_cdm_version.h"
  widevine_cdm_binary_files = []
}

# GYP version: third_party/widevine/cdm/widevine_cdm.gyp:widevine_cdm_version_h
copy("version_h") {
  sources = [ widevine_cdm_version_h_file ]
  # TODO(brettw) this should go into target_out_dir and callers should include
  # it from there. This requires, however, renaming the default
  # widevine_cdm_version.h in this directory to avoid conflicts.
  outputs = [ "$root_gen_dir/widevine_cdm_version.h" ]
}

# GYP version: third_party/widevine/cdm/widevine_cdm.gyp:widevine_cdm_binaries
if (widevine_cdm_binary_files == []) {
  group("binaries") {
    # NOP
  }
} else {
  copy("binaries") {
    sources = widevine_cdm_binary_files
    outputs = [ "$root_out_dir/{{source_file_part}}" ]
    # TODO(GYP)
    # 'COPY_PHASE_STRIP': 'NO',
  }
}

source_set("adapter") {
  if (is_chrome_branded) {
    deps = [
      ":widevine_cdm_version_h",
      ":widevine_cdm_binaries",
      "//ppapi:ppapi_cpp",
      #'<(DEPTH)/media/media_cdm_adapter.gyp:cdmadapter',  TODO(GYP)
    ]
  }

  if (is_linux) {
    libs = [ "$root_out_dir/libwidevinecdm.sp" ]
  } else if (is_win) {
    libs = [ "$root_out_dir/widevinecdm.dll.lib" ]
  } else if (is_mac) {
    libs = [ "$root_out_dir/libwidevinecdm.dylib" ]
  }
}

# This target exists for tests to depend on that pulls in a runtime dependency
# on the license server.
source_set("widevine_test_license_server") {
  if (is_chrome_branded && is_linux) {
    deps = [
      # TODO(GYP)
      #"//third_party/widevine/test/license_server/license_server.gyp:test_license_server"
    ]
  }
}