blob: e14775476d5a14af71473b1a066fea43535bb1bb [file] [log] [blame]
James Robinson646469d2014-10-03 15:33:28 -07001# Copyright 2014 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
5# Config for us and everybody else depending on BoringSSL.
6config("openssl_config") {
7 include_dirs = []
8 include_dirs += [ "src/include" ]
9 if (is_component_build) {
James Robinson6a64b812014-12-03 13:38:42 -080010 defines = [ "BORINGSSL_SHARED_LIBRARY" ]
James Robinson646469d2014-10-03 15:33:28 -070011 }
12}
13
14# Config internal to this build file.
15config("openssl_internal_config") {
16 visibility = [ ":*" ] # Only targets in this file can depend on this.
17}
18
19# The list of BoringSSL files is kept in boringssl.gypi.
James Robinson6a64b812014-12-03 13:38:42 -080020gypi_values =
21 exec_script("//build/gypi_to_gn.py",
22 [ rebase_path("//third_party/boringssl/boringssl.gypi") ],
23 "scope",
24 [ "//third_party/boringssl/boringssl.gypi" ])
James Robinson646469d2014-10-03 15:33:28 -070025
James Robinson1ae030a2014-11-07 08:32:47 -080026# Windows' assembly is built with Yasm. The other platforms use the platform
27# assembler.
28if (is_win) {
James Robinson7f480212014-10-31 10:28:08 -070029 import("//third_party/yasm/yasm_assemble.gni")
30 yasm_assemble("boringssl_asm") {
Benjamin Lermane8ca9b72015-02-24 16:42:13 +010031 if (current_cpu == "x64") {
James Robinson1ae030a2014-11-07 08:32:47 -080032 sources = gypi_values.boringssl_win_x86_64_sources
Benjamin Lermane8ca9b72015-02-24 16:42:13 +010033 } else if (current_cpu == "x86") {
James Robinson1ae030a2014-11-07 08:32:47 -080034 sources = gypi_values.boringssl_win_x86_sources
35 }
James Robinson7f480212014-10-31 10:28:08 -070036 }
37}
38
James Robinson646469d2014-10-03 15:33:28 -070039component("boringssl") {
40 sources = gypi_values.boringssl_lib_sources
41
42 public_configs = [ ":openssl_config" ]
43
44 cflags = []
45 defines = [
46 "BORINGSSL_IMPLEMENTATION",
47 "BORINGSSL_NO_STATIC_INITIALIZER",
48 ]
James Robinsonb96d28f2014-12-03 16:55:21 -080049 deps = []
James Robinson646469d2014-10-03 15:33:28 -070050 if (is_component_build) {
James Robinson6a64b812014-12-03 13:38:42 -080051 defines += [ "BORINGSSL_SHARED_LIBRARY" ]
James Robinson646469d2014-10-03 15:33:28 -070052 }
53
54 configs -= [ "//build/config/compiler:chromium_code" ]
Benjamin Lermane8ca9b72015-02-24 16:42:13 +010055 configs += [
56 "//build/config/compiler:no_chromium_code",
57
58 # TODO(davidben): Fix size_t truncations in BoringSSL.
59 # https://crbug.com/429039
60 "//build/config/compiler:no_size_t_to_int_warning",
61 ]
James Robinson646469d2014-10-03 15:33:28 -070062
63 # Also gets the include dirs from :openssl_config
64 include_dirs = [
65 "src/include",
James Robinson6a64b812014-12-03 13:38:42 -080066
James Robinson646469d2014-10-03 15:33:28 -070067 # This is for arm_arch.h, which is needed by some asm files. Since the
68 # asm files are generated and kept in a different directory, they
69 # cannot use relative paths to find this file.
70 "src/crypto",
71 ]
72
Benjamin Lermane8ca9b72015-02-24 16:42:13 +010073 if (current_cpu == "x64") {
James Robinson646469d2014-10-03 15:33:28 -070074 if (is_mac) {
75 sources += gypi_values.boringssl_mac_x86_64_sources
76 } else if (is_linux || is_android) {
77 sources += gypi_values.boringssl_linux_x86_64_sources
78 } else if (is_win) {
James Robinson1ae030a2014-11-07 08:32:47 -080079 deps += [ ":boringssl_asm" ]
James Robinson646469d2014-10-03 15:33:28 -070080 } else {
81 defines += [ "OPENSSL_NO_ASM" ]
82 }
Benjamin Lermane8ca9b72015-02-24 16:42:13 +010083 } else if (current_cpu == "x86") {
James Robinson646469d2014-10-03 15:33:28 -070084 if (is_mac) {
85 sources += gypi_values.boringssl_mac_x86_sources
86 } else if (is_linux || is_android) {
87 sources += gypi_values.boringssl_linux_x86_sources
James Robinson7f480212014-10-31 10:28:08 -070088 } else if (is_win) {
89 deps += [ ":boringssl_asm" ]
James Robinson646469d2014-10-03 15:33:28 -070090 } else {
91 defines += [ "OPENSSL_NO_ASM" ]
92 }
Benjamin Lermane8ca9b72015-02-24 16:42:13 +010093 } else if (current_cpu == "arm") {
James Robinson646469d2014-10-03 15:33:28 -070094 sources += gypi_values.boringssl_linux_arm_sources
Benjamin Lermane8ca9b72015-02-24 16:42:13 +010095 } else if (current_cpu == "arm64") {
James Robinson5e66a792015-01-21 17:02:08 -080096 sources += gypi_values.boringssl_linux_aarch64_sources
James Robinson646469d2014-10-03 15:33:28 -070097 } else {
98 defines += [ "OPENSSL_NO_ASM" ]
99 }
100}