| # Copyright 2015 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. |
| |
| import("//build/util/process_version.gni") |
| import("//chromecast/chromecast.gni") |
| import("//testing/test.gni") |
| |
| if (is_android) { |
| import("//build/config/android/rules.gni") |
| } |
| |
| declare_args() { |
| # Denotes the type of Cast product. This is #defined as CAST_PRODUCT_TYPE in |
| # version.h. This is an integer in the range [0-4]. |
| if (is_android) { |
| cast_product_type = 4 |
| } else { |
| cast_product_type = 0 |
| } |
| } |
| |
| if (is_android) { |
| assert(cast_product_type == 4) |
| } else { |
| assert(cast_product_type >= 0 && cast_product_type <= 3) |
| } |
| |
| source_set("base") { |
| sources = [ |
| "android/dumpstate_writer.cc", |
| "android/dumpstate_writer.h", |
| "android/system_time_change_notifier_android.cc", |
| "android/system_time_change_notifier_android.h", |
| "bind_to_task_runner.h", |
| "cast_constants.cc", |
| "cast_constants.h", |
| "cast_paths.cc", |
| "cast_paths.h", |
| "cast_resource.cc", |
| "cast_resource.h", |
| "chromecast_config_android.cc", |
| "chromecast_config_android.h", |
| "device_capabilities.h", |
| "device_capabilities_impl.cc", |
| "device_capabilities_impl.h", |
| "error_codes.cc", |
| "error_codes.h", |
| "file_utils.cc", |
| "file_utils.h", |
| "path_utils.cc", |
| "path_utils.h", |
| "pref_names.cc", |
| "pref_names.h", |
| "process_utils.cc", |
| "process_utils.h", |
| "serializers.cc", |
| "serializers.h", |
| "system_time_change_notifier.cc", |
| "system_time_change_notifier.h", |
| "task_runner_impl.cc", |
| "task_runner_impl.h", |
| ] |
| |
| public_deps = [ |
| ":chromecast_switches", |
| ":init_shlib", |
| "//chromecast/base/metrics", |
| "//chromecast/public", |
| ] |
| |
| deps = [ |
| "//base", |
| ] |
| |
| if (is_android) { |
| deps += [ ":jni_headers" ] |
| } |
| } |
| |
| # chromecast related switch values |
| # b/30398176 components that depend on switch values should depend on |
| # this target directly instead of depend on //chromecast/base to avoid |
| # unnecessary size increase. |
| source_set("chromecast_switches") { |
| sources = [ |
| "chromecast_switches.cc", |
| "chromecast_switches.h", |
| ] |
| |
| deps = [ |
| "//base", |
| ] |
| } |
| |
| # command line initialization code for shared libs |
| # b/30398176 shared libs that depend on InitCommandLineShlib() only should |
| # use this target instead of //chromecast/base |
| source_set("init_shlib") { |
| sources = [ |
| "init_command_line_shlib.cc", |
| "init_command_line_shlib.h", |
| ] |
| |
| deps = [ |
| "//base", |
| ] |
| } |
| |
| source_set("test_support") { |
| sources = [ |
| "scoped_temp_file.cc", |
| "scoped_temp_file.h", |
| ] |
| |
| public_deps = [ |
| ":base", |
| "//base", |
| ] |
| } |
| |
| test("cast_base_unittests") { |
| sources = [ |
| "bind_to_task_runner_unittest.cc", |
| "device_capabilities_impl_unittest.cc", |
| "error_codes_unittest.cc", |
| "path_utils_unittest.cc", |
| "process_utils_unittest.cc", |
| "serializers_unittest.cc", |
| "system_time_change_notifier_unittest.cc", |
| ] |
| |
| deps = [ |
| ":test_support", |
| "//base/test:run_all_unittests", |
| "//base/test:test_support", |
| "//testing/gmock", |
| "//testing/gtest", |
| ] |
| } |
| |
| source_set("cast_sys_info") { |
| sources = [ |
| "cast_sys_info_android.cc", |
| "cast_sys_info_android.h", |
| "cast_sys_info_dummy.cc", |
| "cast_sys_info_dummy.h", |
| "cast_sys_info_util.h", |
| ] |
| |
| deps = [ |
| "//base", |
| "//chromecast/public", |
| ] |
| |
| if (is_android) { |
| deps += [ |
| ":cast_version", |
| "//chromecast/browser:jni_headers", |
| ] |
| } else if (chromecast_branding == "public") { |
| sources += [ "cast_sys_info_util_simple.cc" ] |
| } |
| } |
| |
| # Target for OEM partners to override sys_info shared library, i.e. |
| # libcast_sys_info_1.0.so. |
| shared_library("libcast_sys_info_1.0") { |
| sources = [ |
| "cast_sys_info_dummy.cc", |
| "cast_sys_info_dummy.h", |
| "cast_sys_info_shlib.cc", |
| ] |
| |
| deps = [ |
| "//chromecast/public", |
| ] |
| } |
| |
| # Note: Android links //chromecast/base:cast_sys_info statically. |
| source_set("cast_sys_info_shlib") { |
| if (!is_android) { |
| sources = [ |
| "cast_sys_info_util_shlib.cc", |
| ] |
| |
| deps = [ |
| ":cast_sys_info", |
| ":libcast_sys_info_1.0", |
| "//base", |
| "//chromecast/public", |
| ] |
| } |
| } |
| |
| process_version("cast_version") { |
| template_file = "version.h.in" |
| output = "$target_gen_dir/version.h" |
| |
| sources = [ |
| "//chrome/VERSION", |
| ] |
| extra_args = [ |
| "-e", |
| "VERSION_FULL=\"%s.%s.%s.%s\"%(MAJOR,MINOR,BUILD,PATCH)", |
| "-e", |
| "CAST_BUILD_RELEASE=\"$cast_build_release\"", |
| "-e", |
| "CAST_BUILD_INCREMENTAL=\"$cast_build_incremental\"", |
| "-e", |
| "CAST_PRODUCT_TYPE=$cast_product_type", |
| ] |
| |
| if (cast_is_debug) { |
| extra_args += [ |
| "-e", |
| "CAST_IS_DEBUG_BUILD=1", |
| ] |
| } else { |
| extra_args += [ |
| "-e", |
| "CAST_IS_DEBUG_BUILD=0", |
| ] |
| } |
| } |
| |
| if (is_android) { |
| generate_jni("jni_headers") { |
| sources = [ |
| "java/src/org/chromium/chromecast/base/ChromecastConfigAndroid.java", |
| "java/src/org/chromium/chromecast/base/DumpstateWriter.java", |
| "java/src/org/chromium/chromecast/base/SystemTimeChangeNotifierAndroid.java", |
| ] |
| |
| jni_package = "chromecast" |
| } |
| |
| android_library("base_java") { |
| java_src_dir = "//chromecast/base/java/src" |
| java_files = [ |
| "$java_src_dir/org/chromium/chromecast/base/CastSettingsManager.java", |
| "$java_src_dir/org/chromium/chromecast/base/ChromecastConfigAndroid.java", |
| "$java_src_dir/org/chromium/chromecast/base/DumpstateWriter.java", |
| "$java_src_dir/org/chromium/chromecast/base/SystemTimeChangeNotifierAndroid.java", |
| ] |
| |
| deps = [ |
| "//base:base_java", |
| ] |
| } |
| } |