Corentin Wallez | d4bcfa2 | 2015-09-01 10:32:30 -0400 | [diff] [blame] | 1 | # Copyright 2014-2015 The Chromium Authors. All rights reserved. |
Jamie Madill | 72f5b5e | 2014-06-23 15:13:02 -0400 | [diff] [blame] | 2 | # Use of this source code is governed by a BSD-style license that can be |
| 3 | # found in the LICENSE file. |
| 4 | |
Corentin Wallez | 51e2ad1 | 2015-05-26 11:32:58 -0400 | [diff] [blame] | 5 | # import the use_x11 variable |
Jamie Madill | e31fd87 | 2016-05-27 08:35:36 -0400 | [diff] [blame] | 6 | import("//build/config/dcheck_always_on.gni") |
Frank Henigman | 77df676 | 2016-06-13 16:39:01 -0400 | [diff] [blame] | 7 | import("//build/config/linux/pkg_config.gni") |
Corentin Wallez | 51e2ad1 | 2015-05-26 11:32:58 -0400 | [diff] [blame] | 8 | import("//build/config/ui.gni") |
Corentin Wallez | 28b6528 | 2016-06-16 07:24:50 -0700 | [diff] [blame] | 9 | import("//testing/libfuzzer/fuzzer_test.gni") |
Corentin Wallez | 7f07caa | 2016-10-25 07:43:33 -0400 | [diff] [blame] | 10 | import("//third_party/angle/gni/angle.gni") |
Frank Henigman | e8d5c5c | 2016-07-07 13:17:47 -0400 | [diff] [blame] | 11 | import("//ui/ozone/ozone.gni") |
Corentin Wallez | 51e2ad1 | 2015-05-26 11:32:58 -0400 | [diff] [blame] | 12 | |
Frank Henigman | e8d5c5c | 2016-07-07 13:17:47 -0400 | [diff] [blame] | 13 | if (ozone_platform_gbm) { |
Frank Henigman | 62ba962 | 2016-06-27 17:08:28 -0400 | [diff] [blame] | 14 | pkg_config("libdrm") { |
| 15 | packages = [ "libdrm" ] |
| 16 | } |
Frank Henigman | 77df676 | 2016-06-13 16:39:01 -0400 | [diff] [blame] | 17 | } |
| 18 | |
Tomasz Moniuszko | 319fb898 | 2015-07-30 14:34:54 +0200 | [diff] [blame] | 19 | angle_git_is_present = exec_script("src/commit_id.py", |
| 20 | [ |
| 21 | "check", |
| 22 | rebase_path(".", root_build_dir), |
| 23 | ], |
| 24 | "value") |
| 25 | |
| 26 | angle_use_commit_id = angle_git_is_present == 1 |
| 27 | |
Jamie Madill | edbc244 | 2016-01-04 11:25:00 -0500 | [diff] [blame] | 28 | gles_gypi = exec_script("//build/gypi_to_gn.py", |
| 29 | [ rebase_path("src/libGLESv2.gypi") ], |
| 30 | "scope", |
| 31 | [ "src/libGLESv2.gypi" ]) |
Brett Wilson | 04bac60 | 2014-07-16 14:19:18 -0700 | [diff] [blame] | 32 | |
Jamie Madill | edbc244 | 2016-01-04 11:25:00 -0500 | [diff] [blame] | 33 | compiler_gypi = exec_script("//build/gypi_to_gn.py", |
| 34 | [ rebase_path("src/compiler.gypi") ], |
| 35 | "scope", |
| 36 | [ "src/compiler.gypi" ]) |
Brett Wilson | 04bac60 | 2014-07-16 14:19:18 -0700 | [diff] [blame] | 37 | |
Brett Wilson | 2f5469c | 2014-07-22 17:00:17 -0700 | [diff] [blame] | 38 | # This config is exported to dependent targets (and also applied to internal |
| 39 | # ones). |
| 40 | config("external_config") { |
Jamie Madill | edbc244 | 2016-01-04 11:25:00 -0500 | [diff] [blame] | 41 | include_dirs = [ "include" ] |
Brett Wilson | 2f5469c | 2014-07-22 17:00:17 -0700 | [diff] [blame] | 42 | } |
| 43 | |
Jamie Madill | 72f5b5e | 2014-06-23 15:13:02 -0400 | [diff] [blame] | 44 | # This config is applied to internal Angle targets (not pushed to dependents). |
| 45 | config("internal_config") { |
| 46 | include_dirs = [ |
| 47 | "include", |
| 48 | "src", |
| 49 | ] |
Jamie Madill | 80ab03c | 2017-01-03 11:03:23 -0500 | [diff] [blame] | 50 | |
| 51 | # Prevent the GL headers from redeclaring ANGLE entry points. |
| 52 | defines = [ |
| 53 | "GL_GLEXT_PROTOTYPES", |
| 54 | "EGL_EGLEXT_PROTOTYPES", |
| 55 | ] |
Jamie Madill | 72f5b5e | 2014-06-23 15:13:02 -0400 | [diff] [blame] | 56 | } |
| 57 | |
Jamie Madill | 509a1d4 | 2016-07-18 10:10:29 -0400 | [diff] [blame] | 58 | config("extra_warnings") { |
| 59 | # Enable more default warnings on Windows. |
| 60 | if (is_win) { |
| 61 | cflags = [ |
| 62 | "/we4244", # Conversion: possible loss of data. |
| 63 | "/we4456", # Variable shadowing. |
Jamie Madill | 1db8a26 | 2016-09-22 13:53:47 -0400 | [diff] [blame] | 64 | "/we4458", # declaration hides class member. |
Jamie Madill | 509a1d4 | 2016-07-18 10:10:29 -0400 | [diff] [blame] | 65 | ] |
| 66 | } |
| 67 | } |
| 68 | |
Daniel Bratell | 73941de | 2015-02-25 14:34:49 +0100 | [diff] [blame] | 69 | if (is_win) { |
Daniel Bratell | 73941de | 2015-02-25 14:34:49 +0100 | [diff] [blame] | 70 | copy("copy_compiler_dll") { |
Jamie Madill | edbc244 | 2016-01-04 11:25:00 -0500 | [diff] [blame] | 71 | sources = [ |
| 72 | "$windows_sdk_path/Redist/D3D/$target_cpu/d3dcompiler_47.dll", |
| 73 | ] |
| 74 | outputs = [ |
| 75 | "$root_out_dir/d3dcompiler_47.dll", |
| 76 | ] |
Daniel Bratell | 73941de | 2015-02-25 14:34:49 +0100 | [diff] [blame] | 77 | } |
Daniel Bratell | 73941de | 2015-02-25 14:34:49 +0100 | [diff] [blame] | 78 | } |
| 79 | |
Jamie Madill | a8503ce | 2016-07-18 13:47:12 -0400 | [diff] [blame] | 80 | angle_undefine_configs = [ "//build/config/compiler:default_include_dirs" ] |
Jamie Madill | e2e406c | 2016-06-02 13:04:10 -0400 | [diff] [blame] | 81 | |
Jamie Madill | 72f5b5e | 2014-06-23 15:13:02 -0400 | [diff] [blame] | 82 | # Holds the shared includes so we only need to list them once. |
| 83 | source_set("includes") { |
| 84 | sources = [ |
| 85 | "include/EGL/egl.h", |
| 86 | "include/EGL/eglext.h", |
| 87 | "include/EGL/eglplatform.h", |
| 88 | "include/GLES2/gl2.h", |
| 89 | "include/GLES2/gl2ext.h", |
| 90 | "include/GLES2/gl2platform.h", |
| 91 | "include/GLES3/gl3.h", |
Geoff Lang | ee48376 | 2015-09-15 13:12:07 -0400 | [diff] [blame] | 92 | "include/GLES3/gl31.h", |
| 93 | "include/GLES3/gl32.h", |
Jamie Madill | edbc244 | 2016-01-04 11:25:00 -0500 | [diff] [blame] | 94 | "include/GLES3/gl3platform.h", |
Jamie Madill | 72f5b5e | 2014-06-23 15:13:02 -0400 | [diff] [blame] | 95 | "include/GLSLANG/ShaderLang.h", |
| 96 | "include/KHR/khrplatform.h", |
| 97 | ] |
| 98 | } |
| 99 | |
| 100 | static_library("preprocessor") { |
Brett Wilson | 04bac60 | 2014-07-16 14:19:18 -0700 | [diff] [blame] | 101 | sources = rebase_path(compiler_gypi.angle_preprocessor_sources, ".", "src") |
Jamie Madill | 72f5b5e | 2014-06-23 15:13:02 -0400 | [diff] [blame] | 102 | |
Jamie Madill | e2e406c | 2016-06-02 13:04:10 -0400 | [diff] [blame] | 103 | configs -= angle_undefine_configs |
Jamie Madill | a8503ce | 2016-07-18 13:47:12 -0400 | [diff] [blame] | 104 | configs += [ ":internal_config" ] |
Corentin Wallez | 054f7ed | 2016-09-20 17:15:59 -0400 | [diff] [blame] | 105 | |
| 106 | public_deps = [ |
| 107 | ":angle_common", |
| 108 | ] |
Jamie Madill | 72f5b5e | 2014-06-23 15:13:02 -0400 | [diff] [blame] | 109 | } |
| 110 | |
Corentin Wallez | a5615c6 | 2016-09-19 09:54:44 -0400 | [diff] [blame] | 111 | config("translator_disable_pool_alloc") { |
| 112 | defines = [ "ANGLE_TRANSLATOR_DISABLE_POOL_ALLOC" ] |
Jamie Madill | e5c97ab | 2014-08-07 12:31:38 -0400 | [diff] [blame] | 113 | } |
| 114 | |
Cooper Partin | 75da197 | 2015-06-16 15:03:14 -0700 | [diff] [blame] | 115 | config("debug_annotations_config") { |
| 116 | if (is_debug) { |
Jamie Madill | edbc244 | 2016-01-04 11:25:00 -0500 | [diff] [blame] | 117 | defines = [ "ANGLE_ENABLE_DEBUG_ANNOTATIONS" ] |
Cooper Partin | 75da197 | 2015-06-16 15:03:14 -0700 | [diff] [blame] | 118 | } |
| 119 | } |
| 120 | |
Jamie Madill | e31fd87 | 2016-05-27 08:35:36 -0400 | [diff] [blame] | 121 | config("angle_release_asserts_config") { |
| 122 | if (dcheck_always_on) { |
| 123 | defines = [ "ANGLE_ENABLE_RELEASE_ASSERTS" ] |
| 124 | } |
| 125 | } |
| 126 | |
Jamie Madill | e2e406c | 2016-06-02 13:04:10 -0400 | [diff] [blame] | 127 | config("angle_common_config") { |
| 128 | include_dirs = [ "src/common/third_party/numerics" ] |
| 129 | } |
| 130 | |
Jamie Madill | 562e81b | 2015-01-14 14:31:02 -0500 | [diff] [blame] | 131 | static_library("angle_common") { |
| 132 | sources = rebase_path(gles_gypi.libangle_common_sources, ".", "src") |
Cooper Partin | 75da197 | 2015-06-16 15:03:14 -0700 | [diff] [blame] | 133 | |
Jamie Madill | dcab56a | 2017-01-05 14:47:34 -0500 | [diff] [blame^] | 134 | if (is_linux || is_android) { |
| 135 | sources += rebase_path(gles_gypi.libangle_common_linux_sources, ".", "src") |
| 136 | } |
| 137 | |
| 138 | if (is_mac) { |
| 139 | sources += rebase_path(gles_gypi.libangle_common_mac_sources, ".", "src") |
| 140 | } |
| 141 | |
| 142 | if (is_win) { |
| 143 | sources += rebase_path(gles_gypi.libangle_common_win_sources, ".", "src") |
| 144 | } |
| 145 | |
Jamie Madill | e2e406c | 2016-06-02 13:04:10 -0400 | [diff] [blame] | 146 | configs -= angle_undefine_configs |
Jamie Madill | 562e81b | 2015-01-14 14:31:02 -0500 | [diff] [blame] | 147 | configs += [ |
Jamie Madill | e2e406c | 2016-06-02 13:04:10 -0400 | [diff] [blame] | 148 | ":angle_common_config", |
Cooper Partin | 75da197 | 2015-06-16 15:03:14 -0700 | [diff] [blame] | 149 | ":debug_annotations_config", |
Jamie Madill | 509a1d4 | 2016-07-18 10:10:29 -0400 | [diff] [blame] | 150 | ":extra_warnings", |
Jamie Madill | e2e406c | 2016-06-02 13:04:10 -0400 | [diff] [blame] | 151 | ":internal_config", |
Jamie Madill | 562e81b | 2015-01-14 14:31:02 -0500 | [diff] [blame] | 152 | ] |
Jeremy Roman | 06feb81 | 2016-04-06 16:39:52 -0400 | [diff] [blame] | 153 | |
Yuly Novikov | 87ae8cd | 2016-05-19 17:59:55 -0400 | [diff] [blame] | 154 | public_deps = [ |
| 155 | ":commit_id", |
| 156 | ] |
Jamie Madill | e2e406c | 2016-06-02 13:04:10 -0400 | [diff] [blame] | 157 | public_configs = [ |
| 158 | ":angle_release_asserts_config", |
| 159 | ":angle_common_config", |
| 160 | ] |
Jamie Madill | 562e81b | 2015-01-14 14:31:02 -0500 | [diff] [blame] | 161 | } |
| 162 | |
Geoff Lang | 6e4cfce | 2016-06-13 15:06:31 -0400 | [diff] [blame] | 163 | config("angle_image_util_config") { |
| 164 | include_dirs = [ |
| 165 | "include", |
| 166 | "src", |
| 167 | ] |
| 168 | } |
| 169 | |
Dirk Pranke | 313d944 | 2016-07-13 18:01:55 -0700 | [diff] [blame] | 170 | static_library("angle_image_util") { |
Geoff Lang | 6e4cfce | 2016-06-13 15:06:31 -0400 | [diff] [blame] | 171 | sources = rebase_path(gles_gypi.libangle_image_util_sources, ".", "src") |
| 172 | |
| 173 | configs -= angle_undefine_configs |
Jamie Madill | a8503ce | 2016-07-18 13:47:12 -0400 | [diff] [blame] | 174 | configs += [ ":internal_config" ] |
Geoff Lang | 6e4cfce | 2016-06-13 15:06:31 -0400 | [diff] [blame] | 175 | |
| 176 | public_configs = [ ":angle_image_util_config" ] |
| 177 | |
| 178 | public_deps = [ |
| 179 | ":angle_common", |
| 180 | ] |
| 181 | } |
| 182 | |
Yuly Novikov | ea58654 | 2016-11-10 17:33:43 -0500 | [diff] [blame] | 183 | static_library("translator") { |
Yuly Novikov | dfd7fb2 | 2016-11-11 16:05:11 -0500 | [diff] [blame] | 184 | sources = rebase_path(compiler_gypi.angle_translator_sources, ".", "src") |
Austin Kinross | 82b5ab6 | 2015-12-11 09:30:15 -0800 | [diff] [blame] | 185 | defines = [] |
| 186 | |
Corentin Wallez | 28b6528 | 2016-06-16 07:24:50 -0700 | [diff] [blame] | 187 | if (angle_enable_essl || use_libfuzzer) { |
Jamie Madill | edbc244 | 2016-01-04 11:25:00 -0500 | [diff] [blame] | 188 | sources += |
Yuly Novikov | dfd7fb2 | 2016-11-11 16:05:11 -0500 | [diff] [blame] | 189 | rebase_path(compiler_gypi.angle_translator_essl_sources, ".", "src") |
Austin Kinross | 82b5ab6 | 2015-12-11 09:30:15 -0800 | [diff] [blame] | 190 | defines += [ "ANGLE_ENABLE_ESSL" ] |
| 191 | } |
| 192 | |
Corentin Wallez | 28b6528 | 2016-06-16 07:24:50 -0700 | [diff] [blame] | 193 | if (angle_enable_glsl || use_libfuzzer) { |
Jamie Madill | edbc244 | 2016-01-04 11:25:00 -0500 | [diff] [blame] | 194 | sources += |
Yuly Novikov | dfd7fb2 | 2016-11-11 16:05:11 -0500 | [diff] [blame] | 195 | rebase_path(compiler_gypi.angle_translator_glsl_sources, ".", "src") |
Austin Kinross | 82b5ab6 | 2015-12-11 09:30:15 -0800 | [diff] [blame] | 196 | defines += [ "ANGLE_ENABLE_GLSL" ] |
| 197 | } |
Jamie Madill | 72f5b5e | 2014-06-23 15:13:02 -0400 | [diff] [blame] | 198 | |
Corentin Wallez | 28b6528 | 2016-06-16 07:24:50 -0700 | [diff] [blame] | 199 | if (angle_enable_hlsl || use_libfuzzer) { |
Jamie Madill | edbc244 | 2016-01-04 11:25:00 -0500 | [diff] [blame] | 200 | sources += |
Yuly Novikov | dfd7fb2 | 2016-11-11 16:05:11 -0500 | [diff] [blame] | 201 | rebase_path(compiler_gypi.angle_translator_hlsl_sources, ".", "src") |
Austin Kinross | 82b5ab6 | 2015-12-11 09:30:15 -0800 | [diff] [blame] | 202 | defines += [ "ANGLE_ENABLE_HLSL" ] |
Daniel Bratell | 73941de | 2015-02-25 14:34:49 +0100 | [diff] [blame] | 203 | } |
Jamie Madill | e2e406c | 2016-06-02 13:04:10 -0400 | [diff] [blame] | 204 | configs -= angle_undefine_configs |
Yuly Novikov | ea58654 | 2016-11-10 17:33:43 -0500 | [diff] [blame] | 205 | configs += [ ":internal_config" ] |
Brett Wilson | 10ac404 | 2014-09-24 10:20:56 -0700 | [diff] [blame] | 206 | public_configs = [ ":external_config" ] |
Corentin Wallez | a5615c6 | 2016-09-19 09:54:44 -0400 | [diff] [blame] | 207 | if (use_libfuzzer) { |
| 208 | all_dependent_configs = [ ":translator_disable_pool_alloc" ] |
| 209 | } |
Jamie Madill | 72f5b5e | 2014-06-23 15:13:02 -0400 | [diff] [blame] | 210 | |
| 211 | deps = [ |
| 212 | ":includes", |
| 213 | ":preprocessor", |
| 214 | ] |
Jamie Madill | 562e81b | 2015-01-14 14:31:02 -0500 | [diff] [blame] | 215 | |
| 216 | public_deps = [ |
| 217 | ":angle_common", |
| 218 | ] |
Jamie Madill | a8503ce | 2016-07-18 13:47:12 -0400 | [diff] [blame] | 219 | |
| 220 | if (is_win) { |
| 221 | # Necessary to suppress some system header xtree warnigns in Release. |
| 222 | # For some reason this warning doesn't get triggered in Chromium |
| 223 | cflags = [ "/wd4718" ] |
| 224 | } |
Jamie Madill | 72f5b5e | 2014-06-23 15:13:02 -0400 | [diff] [blame] | 225 | } |
| 226 | |
Corentin Wallez | 30e11ab | 2016-09-16 10:29:54 -0400 | [diff] [blame] | 227 | source_set("translator_fuzzer") { |
Corentin Wallez | 28b6528 | 2016-06-16 07:24:50 -0700 | [diff] [blame] | 228 | sources = [ |
| 229 | "src/compiler/fuzz/translator_fuzzer.cpp", |
| 230 | ] |
| 231 | |
| 232 | include_dirs = [ |
| 233 | "include", |
| 234 | "src", |
| 235 | ] |
| 236 | |
| 237 | deps = [ |
Yuly Novikov | e653403 | 2016-11-01 18:19:06 -0400 | [diff] [blame] | 238 | ":translator", |
Corentin Wallez | 28b6528 | 2016-06-16 07:24:50 -0700 | [diff] [blame] | 239 | ] |
| 240 | } |
| 241 | |
Jamie Madill | 72f5b5e | 2014-06-23 15:13:02 -0400 | [diff] [blame] | 242 | config("commit_id_config") { |
| 243 | include_dirs = [ "$root_gen_dir/angle" ] |
| 244 | } |
| 245 | |
Tomasz Moniuszko | 319fb898 | 2015-07-30 14:34:54 +0200 | [diff] [blame] | 246 | commit_id_output_file = "$root_gen_dir/angle/id/commit.h" |
| 247 | if (angle_use_commit_id) { |
| 248 | action("commit_id") { |
| 249 | script = "src/commit_id.py" |
| 250 | outputs = [ |
| 251 | commit_id_output_file, |
| 252 | ] |
Jamie Madill | 72f5b5e | 2014-06-23 15:13:02 -0400 | [diff] [blame] | 253 | |
Tomasz Moniuszko | 319fb898 | 2015-07-30 14:34:54 +0200 | [diff] [blame] | 254 | args = [ |
| 255 | "gen", |
| 256 | rebase_path(".", root_build_dir), |
| 257 | rebase_path(commit_id_output_file, root_build_dir), |
| 258 | ] |
Jamie Madill | 72f5b5e | 2014-06-23 15:13:02 -0400 | [diff] [blame] | 259 | |
Tomasz Moniuszko | 319fb898 | 2015-07-30 14:34:54 +0200 | [diff] [blame] | 260 | public_configs = [ ":commit_id_config" ] |
| 261 | } |
| 262 | } else { |
| 263 | copy("commit_id") { |
| 264 | sources = [ |
| 265 | "src/commit.h", |
| 266 | ] |
| 267 | outputs = [ |
| 268 | commit_id_output_file, |
| 269 | ] |
| 270 | public_configs = [ ":commit_id_config" ] |
| 271 | } |
Jamie Madill | 72f5b5e | 2014-06-23 15:13:02 -0400 | [diff] [blame] | 272 | } |
| 273 | |
Jamie Madill | 562e81b | 2015-01-14 14:31:02 -0500 | [diff] [blame] | 274 | config("libANGLE_config") { |
Austin Kinross | 4085347 | 2015-02-12 10:39:56 -0800 | [diff] [blame] | 275 | cflags = [] |
Jamie Madill | 562e81b | 2015-01-14 14:31:02 -0500 | [diff] [blame] | 276 | defines = [] |
| 277 | if (angle_enable_d3d9) { |
| 278 | defines += [ "ANGLE_ENABLE_D3D9" ] |
Geoff Lang | 2b5420c | 2014-11-19 14:20:15 -0500 | [diff] [blame] | 279 | } |
Jamie Madill | 562e81b | 2015-01-14 14:31:02 -0500 | [diff] [blame] | 280 | if (angle_enable_d3d11) { |
| 281 | defines += [ "ANGLE_ENABLE_D3D11" ] |
| 282 | } |
Geoff Lang | c588ac7 | 2015-02-13 15:41:41 -0500 | [diff] [blame] | 283 | if (angle_enable_gl) { |
| 284 | defines += [ "ANGLE_ENABLE_OPENGL" ] |
Steven Bennetts | 369d03c | 2016-05-05 10:37:38 -0700 | [diff] [blame] | 285 | if (use_x11) { |
| 286 | defines += [ "ANGLE_USE_X11" ] |
| 287 | } |
Corentin Wallez | 51e2ad1 | 2015-05-26 11:32:58 -0400 | [diff] [blame] | 288 | } |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 289 | if (angle_enable_vulkan) { |
| 290 | defines += [ "ANGLE_ENABLE_VULKAN" ] |
| 291 | } |
Geoff Lang | d08f3b3 | 2016-09-23 15:56:30 -0400 | [diff] [blame] | 292 | if (angle_enable_null) { |
| 293 | defines += [ "ANGLE_ENABLE_NULL" ] |
| 294 | } |
Jamie Madill | 80ab03c | 2017-01-03 11:03:23 -0500 | [diff] [blame] | 295 | defines += [ "LIBANGLE_IMPLEMENTATION" ] |
Corentin Wallez | beb8158 | 2015-09-02 10:30:55 -0400 | [diff] [blame] | 296 | |
| 297 | if (is_win) { |
Austin Kinross | 4085347 | 2015-02-12 10:39:56 -0800 | [diff] [blame] | 298 | cflags += [ "/wd4530" ] # C++ exception handler used, but unwind semantics are not enabled. |
| 299 | } |
Jamie Madill | 562e81b | 2015-01-14 14:31:02 -0500 | [diff] [blame] | 300 | } |
Geoff Lang | 2b5420c | 2014-11-19 14:20:15 -0500 | [diff] [blame] | 301 | |
Jamie Madill | 562e81b | 2015-01-14 14:31:02 -0500 | [diff] [blame] | 302 | static_library("libANGLE") { |
| 303 | sources = rebase_path(gles_gypi.libangle_sources, ".", "src") |
Geoff Lang | 2b5420c | 2014-11-19 14:20:15 -0500 | [diff] [blame] | 304 | |
Geoff Lang | c588ac7 | 2015-02-13 15:41:41 -0500 | [diff] [blame] | 305 | include_dirs = [] |
Jamie Madill | 562e81b | 2015-01-14 14:31:02 -0500 | [diff] [blame] | 306 | libs = [] |
Corentin Wallez | 64598b5 | 2016-11-11 08:25:44 -0500 | [diff] [blame] | 307 | defines = [] |
Jamie Madill | e2e406c | 2016-06-02 13:04:10 -0400 | [diff] [blame] | 308 | public_deps = [ |
Corentin Wallez | cc068e9 | 2016-02-29 16:37:04 -0500 | [diff] [blame] | 309 | ":angle_common", |
Jamie Madill | e2e406c | 2016-06-02 13:04:10 -0400 | [diff] [blame] | 310 | ] |
| 311 | deps = [ |
Geoff Lang | 6e4cfce | 2016-06-13 15:06:31 -0400 | [diff] [blame] | 312 | ":angle_image_util", |
Corentin Wallez | cc068e9 | 2016-02-29 16:37:04 -0500 | [diff] [blame] | 313 | ":commit_id", |
| 314 | ":includes", |
Yuly Novikov | e653403 | 2016-11-01 18:19:06 -0400 | [diff] [blame] | 315 | ":translator", |
Corentin Wallez | cc068e9 | 2016-02-29 16:37:04 -0500 | [diff] [blame] | 316 | ] |
| 317 | |
Jamie Madill | 562e81b | 2015-01-14 14:31:02 -0500 | [diff] [blame] | 318 | # Shared D3D sources. |
| 319 | if (angle_enable_d3d9 || angle_enable_d3d11) { |
| 320 | sources += rebase_path(gles_gypi.libangle_d3d_shared_sources, ".", "src") |
Jamie Madill | 72f5b5e | 2014-06-23 15:13:02 -0400 | [diff] [blame] | 321 | |
Jamie Madill | edbc244 | 2016-01-04 11:25:00 -0500 | [diff] [blame] | 322 | defines += [ "ANGLE_PRELOADED_D3DCOMPILER_MODULE_NAMES={ " + "\"d3dcompiler_47.dll\", \"d3dcompiler_46.dll\", \"d3dcompiler_43.dll\" }" ] |
Jamie Madill | 562e81b | 2015-01-14 14:31:02 -0500 | [diff] [blame] | 323 | } |
Geoff Lang | 2b5420c | 2014-11-19 14:20:15 -0500 | [diff] [blame] | 324 | |
Jamie Madill | 562e81b | 2015-01-14 14:31:02 -0500 | [diff] [blame] | 325 | if (angle_enable_d3d9) { |
| 326 | sources += rebase_path(gles_gypi.libangle_d3d9_sources, ".", "src") |
| 327 | libs += [ "d3d9.lib" ] |
| 328 | } |
Jamie Madill | 72f5b5e | 2014-06-23 15:13:02 -0400 | [diff] [blame] | 329 | |
Jamie Madill | 562e81b | 2015-01-14 14:31:02 -0500 | [diff] [blame] | 330 | if (angle_enable_d3d11) { |
| 331 | sources += rebase_path(gles_gypi.libangle_d3d11_sources, ".", "src") |
| 332 | sources += rebase_path(gles_gypi.libangle_d3d11_win32_sources, ".", "src") |
Austin Kinross | 91e71ed | 2016-08-23 09:29:22 -0700 | [diff] [blame] | 333 | libs += [ "dxguid.lib" ] |
Jamie Madill | 562e81b | 2015-01-14 14:31:02 -0500 | [diff] [blame] | 334 | } |
| 335 | |
Geoff Lang | c588ac7 | 2015-02-13 15:41:41 -0500 | [diff] [blame] | 336 | if (angle_enable_gl) { |
| 337 | sources += rebase_path(gles_gypi.libangle_gl_sources, ".", "src") |
| 338 | include_dirs += [ "src/third_party/khronos" ] |
| 339 | |
| 340 | if (is_win) { |
| 341 | sources += rebase_path(gles_gypi.libangle_gl_wgl_sources, ".", "src") |
| 342 | } |
Corentin Wallez | 51e2ad1 | 2015-05-26 11:32:58 -0400 | [diff] [blame] | 343 | if (use_x11) { |
Corentin Wallez | 47fc1fe | 2015-05-14 10:54:18 -0400 | [diff] [blame] | 344 | sources += rebase_path(gles_gypi.libangle_gl_glx_sources, ".", "src") |
Yuly Novikov | 87ae8cd | 2016-05-19 17:59:55 -0400 | [diff] [blame] | 345 | deps += [ "src/third_party/libXNVCtrl:libXNVCtrl" ] |
Corentin Wallez | cc068e9 | 2016-02-29 16:37:04 -0500 | [diff] [blame] | 346 | libs += [ |
| 347 | "X11", |
| 348 | "Xi", |
| 349 | "Xext", |
| 350 | ] |
Corentin Wallez | 47fc1fe | 2015-05-14 10:54:18 -0400 | [diff] [blame] | 351 | } |
Nico Weber | de44d3a | 2016-05-13 17:27:57 -0400 | [diff] [blame] | 352 | if (is_mac) { |
| 353 | sources += rebase_path(gles_gypi.libangle_gl_cgl_sources, ".", "src") |
| 354 | libs += [ |
| 355 | "Cocoa.framework", |
| 356 | "IOSurface.framework", |
| 357 | "OpenGL.framework", |
| 358 | "QuartzCore.framework", |
| 359 | ] |
| 360 | } |
Yuly Novikov | a6426d6 | 2016-06-03 00:18:38 -0400 | [diff] [blame] | 361 | if (is_android) { |
| 362 | sources += rebase_path(gles_gypi.libangle_gl_egl_sources, ".", "src") |
| 363 | sources += rebase_path(gles_gypi.libangle_gl_egl_dl_sources, ".", "src") |
| 364 | sources += |
| 365 | rebase_path(gles_gypi.libangle_gl_egl_android_sources, ".", "src") |
| 366 | libs += [ |
| 367 | "android", |
| 368 | "log", |
| 369 | ] |
| 370 | } |
Frank Henigman | e8d5c5c | 2016-07-07 13:17:47 -0400 | [diff] [blame] | 371 | if (ozone_platform_gbm) { |
Frank Henigman | 77df676 | 2016-06-13 16:39:01 -0400 | [diff] [blame] | 372 | configs += [ ":libdrm" ] |
| 373 | defines += [ "ANGLE_USE_OZONE" ] |
| 374 | deps += [ "//third_party/minigbm" ] |
| 375 | sources += rebase_path(gles_gypi.libangle_gl_egl_sources, ".", "src") |
| 376 | sources += rebase_path(gles_gypi.libangle_gl_egl_dl_sources, ".", "src") |
| 377 | sources += rebase_path(gles_gypi.libangle_gl_ozone_sources, ".", "src") |
| 378 | } |
Geoff Lang | c588ac7 | 2015-02-13 15:41:41 -0500 | [diff] [blame] | 379 | } |
| 380 | |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 381 | if (angle_enable_vulkan) { |
| 382 | sources += rebase_path(gles_gypi.libangle_vulkan_sources, ".", "src") |
Jamie Madill | 327ba85 | 2016-11-30 12:38:28 -0500 | [diff] [blame] | 383 | deps += [ "//third_party/angle/src/vulkan_support:angle_vulkan" ] |
Jamie Madill | 9e54b5a | 2016-05-25 12:57:39 -0400 | [diff] [blame] | 384 | } |
| 385 | |
Geoff Lang | d08f3b3 | 2016-09-23 15:56:30 -0400 | [diff] [blame] | 386 | if (angle_enable_null) { |
| 387 | sources += rebase_path(gles_gypi.libangle_null_sources, ".", "src") |
| 388 | } |
| 389 | |
Jamie Madill | 562e81b | 2015-01-14 14:31:02 -0500 | [diff] [blame] | 390 | if (is_debug) { |
Jamie Madill | edbc244 | 2016-01-04 11:25:00 -0500 | [diff] [blame] | 391 | defines += [ "ANGLE_GENERATE_SHADER_DEBUG_INFO" ] |
Jamie Madill | 72f5b5e | 2014-06-23 15:13:02 -0400 | [diff] [blame] | 392 | } |
| 393 | |
Jamie Madill | e2e406c | 2016-06-02 13:04:10 -0400 | [diff] [blame] | 394 | configs -= angle_undefine_configs |
Jamie Madill | a8503ce | 2016-07-18 13:47:12 -0400 | [diff] [blame] | 395 | |
Jamie Madill | 562e81b | 2015-01-14 14:31:02 -0500 | [diff] [blame] | 396 | configs += [ |
| 397 | ":commit_id_config", |
Cooper Partin | 75da197 | 2015-06-16 15:03:14 -0700 | [diff] [blame] | 398 | ":debug_annotations_config", |
Jamie Madill | 509a1d4 | 2016-07-18 10:10:29 -0400 | [diff] [blame] | 399 | ":extra_warnings", |
Jamie Madill | 562e81b | 2015-01-14 14:31:02 -0500 | [diff] [blame] | 400 | ":internal_config", |
Jamie Madill | 562e81b | 2015-01-14 14:31:02 -0500 | [diff] [blame] | 401 | ] |
Jamie Madill | 72f5b5e | 2014-06-23 15:13:02 -0400 | [diff] [blame] | 402 | |
Jamie Madill | 80ab03c | 2017-01-03 11:03:23 -0500 | [diff] [blame] | 403 | public_configs = [ ":libANGLE_config" ] |
| 404 | |
Jamie Madill | 562e81b | 2015-01-14 14:31:02 -0500 | [diff] [blame] | 405 | if (is_win) { |
Jamie Madill | e2e406c | 2016-06-02 13:04:10 -0400 | [diff] [blame] | 406 | data_deps = [ |
| 407 | ":copy_compiler_dll", |
| 408 | ] |
Jamie Madill | 562e81b | 2015-01-14 14:31:02 -0500 | [diff] [blame] | 409 | } |
| 410 | } |
| 411 | |
Robert Sesek | db8ae83 | 2016-06-21 11:47:03 -0400 | [diff] [blame] | 412 | config("shared_library_public_config") { |
| 413 | if (is_mac && !is_component_build) { |
| 414 | # Executable targets that depend on the shared libraries below need to have |
| 415 | # the rpath setup in non-component build configurations. |
Jamie Madill | a8503ce | 2016-07-18 13:47:12 -0400 | [diff] [blame] | 416 | ldflags = [ |
| 417 | "-rpath", |
| 418 | "@executable_path/", |
| 419 | ] |
Robert Sesek | db8ae83 | 2016-06-21 11:47:03 -0400 | [diff] [blame] | 420 | } |
| 421 | } |
| 422 | |
Jamie Madill | 80ab03c | 2017-01-03 11:03:23 -0500 | [diff] [blame] | 423 | # This config controls export definitions on ANGLE API calls. |
| 424 | config("angle_static") { |
| 425 | defines = [ |
| 426 | "ANGLE_EXPORT=", |
| 427 | "EGLAPI=", |
| 428 | "GL_APICALL=", |
| 429 | ] |
| 430 | } |
| 431 | |
Jamie Madill | 562e81b | 2015-01-14 14:31:02 -0500 | [diff] [blame] | 432 | shared_library("libGLESv2") { |
| 433 | sources = rebase_path(gles_gypi.libglesv2_sources, ".", "src") |
| 434 | |
| 435 | if (is_win) { |
Jamie Madill | edbc244 | 2016-01-04 11:25:00 -0500 | [diff] [blame] | 436 | ldflags = |
| 437 | [ "/DEF:" + rebase_path("src/libGLESv2/libGLESv2.def", root_build_dir) ] |
Geoff Lang | 2b5420c | 2014-11-19 14:20:15 -0500 | [diff] [blame] | 438 | } |
John Abd-El-Malek | 657cd68 | 2014-11-05 14:04:19 -0800 | [diff] [blame] | 439 | |
Robert Sesek | db8ae83 | 2016-06-21 11:47:03 -0400 | [diff] [blame] | 440 | if (is_mac && !is_component_build) { |
Jamie Madill | a8503ce | 2016-07-18 13:47:12 -0400 | [diff] [blame] | 441 | ldflags = [ |
| 442 | "-install_name", |
| 443 | "@rpath/${target_name}.dylib", |
| 444 | ] |
Robert Sesek | db8ae83 | 2016-06-21 11:47:03 -0400 | [diff] [blame] | 445 | public_configs = [ ":shared_library_public_config" ] |
| 446 | } |
| 447 | |
Jamie Madill | e2e406c | 2016-06-02 13:04:10 -0400 | [diff] [blame] | 448 | configs -= angle_undefine_configs |
Jamie Madill | 562e81b | 2015-01-14 14:31:02 -0500 | [diff] [blame] | 449 | configs += [ |
Jamie Madill | 562e81b | 2015-01-14 14:31:02 -0500 | [diff] [blame] | 450 | ":commit_id_config", |
Cooper Partin | 75da197 | 2015-06-16 15:03:14 -0700 | [diff] [blame] | 451 | ":debug_annotations_config", |
Jamie Madill | 80ab03c | 2017-01-03 11:03:23 -0500 | [diff] [blame] | 452 | ":internal_config", |
Jamie Madill | 562e81b | 2015-01-14 14:31:02 -0500 | [diff] [blame] | 453 | ] |
Jamie Madill | 72f5b5e | 2014-06-23 15:13:02 -0400 | [diff] [blame] | 454 | |
Jamie Madill | edbc244 | 2016-01-04 11:25:00 -0500 | [diff] [blame] | 455 | defines = [ "LIBGLESV2_IMPLEMENTATION" ] |
Jamie Madill | 80ab03c | 2017-01-03 11:03:23 -0500 | [diff] [blame] | 456 | if (is_win) { |
| 457 | defines += [ "GL_APICALL=" ] |
| 458 | } else { |
| 459 | defines += [ "GL_APICALL=__attribute__((visibility(\"default\")))" ] |
| 460 | } |
| 461 | |
| 462 | deps = [ |
| 463 | ":includes", |
| 464 | ":libANGLE", |
| 465 | ] |
| 466 | } |
| 467 | |
| 468 | static_library("libGLESv2_static") { |
| 469 | sources = rebase_path(gles_gypi.libglesv2_sources, ".", "src") |
| 470 | |
| 471 | configs -= angle_undefine_configs |
| 472 | configs += [ |
| 473 | ":commit_id_config", |
| 474 | ":debug_annotations_config", |
| 475 | ":internal_config", |
| 476 | ] |
| 477 | |
| 478 | public_configs = [ ":angle_static" ] |
Jamie Madill | 562e81b | 2015-01-14 14:31:02 -0500 | [diff] [blame] | 479 | |
| 480 | deps = [ |
| 481 | ":includes", |
| 482 | ":libANGLE", |
| 483 | ] |
| 484 | } |
| 485 | |
| 486 | shared_library("libEGL") { |
| 487 | sources = rebase_path(gles_gypi.libegl_sources, ".", "src") |
| 488 | |
Jamie Madill | e2e406c | 2016-06-02 13:04:10 -0400 | [diff] [blame] | 489 | configs -= angle_undefine_configs |
Jamie Madill | 562e81b | 2015-01-14 14:31:02 -0500 | [diff] [blame] | 490 | configs += [ |
Jamie Madill | 562e81b | 2015-01-14 14:31:02 -0500 | [diff] [blame] | 491 | ":commit_id_config", |
Corentin Wallez | beb8158 | 2015-09-02 10:30:55 -0400 | [diff] [blame] | 492 | ":debug_annotations_config", |
Jamie Madill | 509a1d4 | 2016-07-18 10:10:29 -0400 | [diff] [blame] | 493 | ":extra_warnings", |
| 494 | ":internal_config", |
Jamie Madill | 562e81b | 2015-01-14 14:31:02 -0500 | [diff] [blame] | 495 | ] |
| 496 | |
Jamie Madill | edbc244 | 2016-01-04 11:25:00 -0500 | [diff] [blame] | 497 | defines = [ "LIBEGL_IMPLEMENTATION" ] |
Yuly Novikov | a4ab580 | 2016-12-19 17:44:22 -0500 | [diff] [blame] | 498 | if (is_win) { |
| 499 | defines += [ "EGLAPI=" ] |
| 500 | } else { |
| 501 | defines += [ "EGLAPI=__attribute__((visibility(\"default\")))" ] |
| 502 | } |
Jamie Madill | 562e81b | 2015-01-14 14:31:02 -0500 | [diff] [blame] | 503 | |
Jamie Madill | 80ab03c | 2017-01-03 11:03:23 -0500 | [diff] [blame] | 504 | if (is_win) { |
| 505 | ldflags = [ "/DEF:" + rebase_path("src/libEGL/libEGL.def", root_build_dir) ] |
| 506 | } |
| 507 | |
| 508 | if (is_mac && !is_component_build) { |
| 509 | ldflags = [ |
| 510 | "-install_name", |
| 511 | "@rpath/${target_name}.dylib", |
| 512 | ] |
| 513 | public_configs = [ ":shared_library_public_config" ] |
| 514 | } |
| 515 | |
Jamie Madill | 562e81b | 2015-01-14 14:31:02 -0500 | [diff] [blame] | 516 | deps = [ |
| 517 | ":includes", |
| 518 | ":libGLESv2", |
| 519 | ] |
| 520 | } |
Corentin Wallez | beb8158 | 2015-09-02 10:30:55 -0400 | [diff] [blame] | 521 | |
Jamie Madill | 80ab03c | 2017-01-03 11:03:23 -0500 | [diff] [blame] | 522 | static_library("libEGL_static") { |
| 523 | sources = rebase_path(gles_gypi.libegl_sources, ".", "src") |
| 524 | |
| 525 | configs -= angle_undefine_configs |
| 526 | configs += [ |
| 527 | ":commit_id_config", |
| 528 | ":debug_annotations_config", |
| 529 | ":extra_warnings", |
| 530 | ":internal_config", |
| 531 | ] |
| 532 | |
| 533 | public_configs = [ ":angle_static" ] |
| 534 | |
| 535 | deps = [ |
| 536 | ":includes", |
| 537 | ":libGLESv2_static", |
| 538 | ] |
| 539 | } |
| 540 | |
Jamie Madill | edbc244 | 2016-01-04 11:25:00 -0500 | [diff] [blame] | 541 | util_gypi = exec_script("//build/gypi_to_gn.py", |
| 542 | [ rebase_path("util/util.gyp") ], |
| 543 | "scope", |
| 544 | [ "util/util.gyp" ]) |
| 545 | |
| 546 | config("angle_util_config") { |
| 547 | include_dirs = [ "util" ] |
Frank Henigman | 77df676 | 2016-06-13 16:39:01 -0400 | [diff] [blame] | 548 | if (is_linux && use_x11) { |
Jamie Madill | 1fae355 | 2016-01-07 14:33:48 -0500 | [diff] [blame] | 549 | libs = [ "X11" ] |
| 550 | } |
Jamie Madill | edbc244 | 2016-01-04 11:25:00 -0500 | [diff] [blame] | 551 | } |
Corentin Wallez | beb8158 | 2015-09-02 10:30:55 -0400 | [diff] [blame] | 552 | |
Jamie Madill | 80ab03c | 2017-01-03 11:03:23 -0500 | [diff] [blame] | 553 | foreach(is_shared_library, |
| 554 | [ |
| 555 | true, |
| 556 | false, |
| 557 | ]) { |
| 558 | if (is_shared_library) { |
| 559 | library_type = "shared_library" |
| 560 | library_name = "angle_util" |
| 561 | dep_suffix = "" |
| 562 | } else { |
| 563 | library_type = "static_library" |
| 564 | library_name = "angle_util_static" |
| 565 | dep_suffix = "_static" |
Corentin Wallez | beb8158 | 2015-09-02 10:30:55 -0400 | [diff] [blame] | 566 | } |
| 567 | |
Jamie Madill | 80ab03c | 2017-01-03 11:03:23 -0500 | [diff] [blame] | 568 | target(library_type, library_name) { |
| 569 | sources = rebase_path(util_gypi.util_sources, ".", "util") |
| 570 | |
| 571 | if (is_win) { |
| 572 | sources += rebase_path(util_gypi.util_win32_sources, ".", "util") |
| 573 | } |
| 574 | |
| 575 | if (is_linux) { |
| 576 | sources += rebase_path(util_gypi.util_linux_sources, ".", "util") |
| 577 | libs = [ |
| 578 | "rt", |
| 579 | "dl", |
| 580 | ] |
| 581 | } |
| 582 | |
| 583 | if (is_mac) { |
| 584 | sources += rebase_path(util_gypi.util_osx_sources, ".", "util") |
| 585 | libs = [ |
| 586 | "AppKit.framework", |
| 587 | "QuartzCore.framework", |
| 588 | ] |
| 589 | } |
| 590 | |
| 591 | if (use_x11) { |
| 592 | sources += rebase_path(util_gypi.util_x11_sources, ".", "util") |
| 593 | } |
| 594 | |
| 595 | if (is_android) { |
| 596 | # To prevent linux sources filtering on android |
| 597 | set_sources_assignment_filter([]) |
| 598 | sources += rebase_path(util_gypi.util_linux_sources, ".", "util") |
| 599 | sources += rebase_path(util_gypi.util_android_sources, ".", "util") |
| 600 | libs = [ |
| 601 | "android", |
| 602 | "log", |
| 603 | ] |
| 604 | } |
| 605 | |
| 606 | if (use_ozone) { |
| 607 | sources += rebase_path(util_gypi.util_ozone_sources, ".", "util") |
| 608 | } |
| 609 | |
| 610 | configs += [ |
| 611 | ":debug_annotations_config", |
| 612 | ":extra_warnings", |
Yuly Novikov | 87ae8cd | 2016-05-19 17:59:55 -0400 | [diff] [blame] | 613 | ] |
Corentin Wallez | beb8158 | 2015-09-02 10:30:55 -0400 | [diff] [blame] | 614 | |
Jamie Madill | 80ab03c | 2017-01-03 11:03:23 -0500 | [diff] [blame] | 615 | public_configs = [ |
| 616 | ":angle_util_config", |
| 617 | ":internal_config", |
Yuly Novikov | e3352f9 | 2016-08-12 20:40:14 -0400 | [diff] [blame] | 618 | ] |
Corentin Wallez | beb8158 | 2015-09-02 10:30:55 -0400 | [diff] [blame] | 619 | |
Jamie Madill | 80ab03c | 2017-01-03 11:03:23 -0500 | [diff] [blame] | 620 | deps = [ |
| 621 | ":angle_common", |
| 622 | ":libEGL${dep_suffix}", |
| 623 | ":libGLESv2${dep_suffix}", |
Yuly Novikov | a6426d6 | 2016-06-03 00:18:38 -0400 | [diff] [blame] | 624 | ] |
Jamie Madill | 80ab03c | 2017-01-03 11:03:23 -0500 | [diff] [blame] | 625 | |
| 626 | if (is_shared_library) { |
| 627 | defines = [ "LIBANGLE_UTIL_IMPLEMENTATION" ] |
| 628 | |
| 629 | if (is_mac && !is_component_build) { |
| 630 | ldflags = [ |
| 631 | "-install_name", |
| 632 | "@rpath/lib${target_name}.dylib", |
| 633 | ] |
| 634 | public_configs += [ ":shared_library_public_config" ] |
| 635 | } |
| 636 | } |
Yuly Novikov | a6426d6 | 2016-06-03 00:18:38 -0400 | [diff] [blame] | 637 | } |
Corentin Wallez | beb8158 | 2015-09-02 10:30:55 -0400 | [diff] [blame] | 638 | } |