xref: /aosp_15_r20/external/openscreen/cast/standalone_receiver/BUILD.gn (revision 3f982cf4871df8771c9d4abe6e9a6f8d829b2736)
1# Copyright 2019 The Chromium Authors. All rights reserved.
2# Use of this source code is governed by a BSD-style license that can be
3# found in the LICENSE file.
4
5import("//build/config/external_libraries.gni")
6import("//build_overrides/build.gni")
7
8# Define the executable target only when the build is configured to use the
9# standalone platform implementation; since this is itself a standalone
10# application.
11#
12# See [external_libraries.md](../../build/config/external_libraries.md) for more information.
13if (!build_with_chromium) {
14  shared_sources = [
15    "cast_service.cc",
16    "cast_service.h",
17    "mirroring_application.cc",
18    "mirroring_application.h",
19    "simple_remoting_receiver.cc",
20    "simple_remoting_receiver.h",
21    "streaming_playback_controller.cc",
22    "streaming_playback_controller.h",
23  ]
24
25  shared_deps = [
26    "../../discovery:dnssd",
27    "../../discovery:public",
28    "../../platform:standalone_impl",
29    "../common:public",
30    "../receiver:agent",
31    "../receiver:channel",
32    "../streaming:receiver",
33  ]
34
35  have_external_libs = have_ffmpeg && have_libsdl2
36
37  if (have_external_libs) {
38    source_set("standalone_receiver_sdl") {
39      sources = shared_sources
40      deps = shared_deps
41
42      defines = [ "CAST_STANDALONE_RECEIVER_HAVE_EXTERNAL_LIBS" ]
43      sources += [
44        "avcodec_glue.h",
45        "decoder.cc",
46        "decoder.h",
47        "sdl_audio_player.cc",
48        "sdl_audio_player.h",
49        "sdl_glue.cc",
50        "sdl_glue.h",
51        "sdl_player_base.cc",
52        "sdl_player_base.h",
53        "sdl_video_player.cc",
54        "sdl_video_player.h",
55      ]
56      include_dirs = ffmpeg_include_dirs + libsdl2_include_dirs
57      lib_dirs = ffmpeg_lib_dirs + libsdl2_lib_dirs
58      libs = ffmpeg_libs + libsdl2_libs
59    }
60  }
61
62  source_set("standalone_receiver_dummy") {
63    sources = shared_sources
64    deps = shared_deps
65
66    sources += [
67      "dummy_player.cc",
68      "dummy_player.h",
69    ]
70  }
71
72  executable("cast_receiver") {
73    sources = [ "main.cc" ]
74
75    deps = shared_deps
76    configs += [ "../common:certificate_config" ]
77
78    if (have_external_libs) {
79      deps += [ ":standalone_receiver_sdl" ]
80    } else {
81      deps += [ ":standalone_receiver_dummy" ]
82    }
83  }
84}
85