Chromium Code Reviews| Index: third_party/openh264/BUILD.gn |
| diff --git a/third_party/openh264/BUILD.gn b/third_party/openh264/BUILD.gn |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..c449b2e1454c250962a737c9defd66f1d77969f1 |
| --- /dev/null |
| +++ b/third_party/openh264/BUILD.gn |
| @@ -0,0 +1,112 @@ |
| +# 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("//third_party/openh264/openh264_args.gni") |
| + |
| +if (use_openh264) { |
| + # Import source and include variables from openh264.gypi. |
| + openh264_gypi_values = exec_script("//build/gypi_to_gn.py", |
| + [ rebase_path("openh264.gypi") ], |
| + "scope") |
| + |
| + # Config shared by all openh264 targets. |
| + config("openh264_config") { |
| + cflags = [] |
| + defines = [] |
| + |
| + # Compiler warnings to ignore. |
| + if (!is_win) { |
| + # GCC flags |
| + cflags += [ |
| + "-Wno-header-hygiene", |
| + "-Wno-unused-value", |
| + ] |
| + } |
| + |
| + # Platform-specific defines. |
| + if (is_android) { |
| + defines += [ "ANDROID_NDK" ] |
|
brettw
2015/11/24 00:05:19
Can you comment why this is necessary?
hbos_chromium
2015/11/25 16:17:02
Done.
|
| + } |
| + |
| + # Workaround relating to the VERSION_NUMBER macro in version.h. |
| + # TODO(hbos): Fix cause of the issue instead of this workaround. |
| + if (!is_android) { |
| + # On some builds VERSION_NUMBER is not defined when including version.h |
| + # (probably another file is included named version.h, I have not been able |
| + # to reproduce the problem on a local machine). Since the macro is only |
| + # used for debug printing in wels[En/De]coderExt.cpp we can get around the |
| + # undeclared identifier error by giving it a default value ourselves. |
| + defines += [ "VERSION_NUMBER=\"openh264 v.?.?\"" ] |
|
brettw
2015/11/24 00:05:19
This seems pretty fishy. If your include directori
hbos_chromium
2015/11/25 16:17:02
Can't remember if I had this problem on GN or not.
hbos_chromium
2015/11/25 16:56:44
Oh wow, thanks a million, I got rid of it with you
|
| + |
| + # For other builds we end up with a macro redefinition and have to |
| + # suppress the macro redefined warning. Suppressing it does not work on |
| + # android, but that's OK because we do not have the version.h problem on |
| + # android, thus the if (!is_android) above. |
| + if (!is_win) { |
| + # GCC flags |
| + cflags += [ "-Wno-macro-redefined" ] |
| + } else { |
| + # MSVC flags |
| + cflags += [ "/wd4005" ] # macro redefinition |
| + } |
| + } |
| + } |
| + |
| + source_set("openh264_common") { |
|
brettw
2015/11/24 00:05:19
These names should not duplicate the directory nam
hbos_chromium
2015/11/25 16:17:02
Are you sure? They're the names used when you ninj
brettw
2015/11/25 19:26:34
Yes. GN style is to not duplicate names like this.
hbos_chromium
2015/11/26 12:19:24
Done.
|
| + sources = openh264_gypi_values.openh264_common_sources |
| + include_dirs = openh264_gypi_values.openh264_common_includes |
| + configs -= [ "//build/config/compiler:chromium_code" ] |
| + configs += [ "//build/config/compiler:no_chromium_code" ] |
| + configs += [ ":openh264_config" ] |
| + deps = [] |
| + if (is_android) { |
| + deps += [ |
| + # Defines "android_get/setCpu..." functions. The original OpenH264 build |
| + # files replaces these using macros for "wels_..." versions of the same |
| + # functions. We do not have access to these and use the <cpu-features.h> |
| + # ones instead. |
| + "//third_party/android_tools:cpu_features", |
| + ] |
| + } |
| + } |
| + |
| + source_set("openh264_processing") { |
| + sources = openh264_gypi_values.openh264_processing_sources |
| + include_dirs = openh264_gypi_values.openh264_processing_includes |
| + configs -= [ "//build/config/compiler:chromium_code" ] |
| + configs += [ "//build/config/compiler:no_chromium_code" ] |
| + configs += [ ":openh264_config" ] |
| + deps = [ |
| + ":openh264_common", |
| + ] |
| + } |
| + |
| + source_set("openh264_encoder") { |
| + sources = openh264_gypi_values.openh264_encoder_sources |
| + include_dirs = openh264_gypi_values.openh264_encoder_includes |
| + configs -= [ "//build/config/compiler:chromium_code" ] |
| + configs += [ "//build/config/compiler:no_chromium_code" ] |
| + configs += [ ":openh264_config" ] |
| + deps = [ |
| + ":openh264_common", |
| + ":openh264_processing", |
| + ] |
| + } |
| + |
| + source_set("openh264_decoder") { |
| + sources = openh264_gypi_values.openh264_decoder_sources |
| + include_dirs = openh264_gypi_values.openh264_decoder_includes |
| + configs -= [ "//build/config/compiler:chromium_code" ] |
| + configs += [ "//build/config/compiler:no_chromium_code" ] |
| + configs += [ ":openh264_config" ] |
| + deps = [ |
| + ":openh264_common", |
| + ":openh264_processing", |
| + ] |
| + defines = [ |
| + # Disables decoder_core.cpp debug prints. |
| + "CODEC_FOR_TESTBED", |
| + ] |
| + } |
| +} |