BUILD.gn 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. # Copyright 2016 Google Inc.
  2. #
  3. # Use of this source code is governed by a BSD-style license that can be
  4. # found in the LICENSE file.
  5. declare_args() {
  6. }
  7. angle_root = "../externals/angle2"
  8. import("../third_party.gni")
  9. import("$angle_root/src/compiler.gni")
  10. import("$angle_root/src/libGLESv2.gni")
  11. third_party("angle2") {
  12. public_include_dirs = [ "$angle_root/include" ]
  13. deps = [
  14. ":libEGL",
  15. ":libGLESv2",
  16. ]
  17. }
  18. config("common") {
  19. defines = [
  20. "ANGLE_ENABLE_ESSL",
  21. "ANGLE_ENABLE_GLSL",
  22. "ANGLE_ENABLE_HLSL",
  23. "ANGLE_ENABLE_OPENGL",
  24. "EGL_EGLEXT_PROTOTYPES",
  25. "GL_GLEXT_PROTOTYPES",
  26. ]
  27. include_dirs = [
  28. "$root_gen_dir/angle2",
  29. "$angle_root/include",
  30. "$angle_root/src",
  31. "$angle_root/src/common/third_party/base",
  32. "$angle_root/src/third_party/khronos",
  33. ]
  34. cflags_cc = []
  35. assert(is_linux || is_win) # TODO: is_mac?
  36. if (is_linux) {
  37. defines += [
  38. "ANGLE_USE_X11",
  39. "GL_APICALL=__attribute__((visibility(\"default\")))",
  40. "GL_API=__attribute__((visibility(\"default\")))",
  41. "EGLAPI=__attribute__((visibility(\"default\")))",
  42. ]
  43. cflags_cc += [ "-std=c++14" ]
  44. } else if (is_win) {
  45. defines += [
  46. "ANGLE_ENABLE_D3D11",
  47. "ANGLE_ENABLE_D3D9",
  48. "GL_APICALL=",
  49. "GL_API=",
  50. "EGLAPI=",
  51. ]
  52. # Allow noexcept, even though we build without exceptions
  53. cflags_cc += [ "/wd4577" ]
  54. if (is_clang) {
  55. cflags_cc += [
  56. # utilities.cpp includes an 'unsigned long' <= UINT_MAX check
  57. "-Wno-tautological-constant-compare",
  58. # With distributed Windows builds, files may lose their case during copy, causing
  59. # case-sensitivity mismatch on remote machines.
  60. "-Wno-nonportable-include-path",
  61. ]
  62. }
  63. }
  64. }
  65. copy("commit_id") {
  66. sources = [
  67. "$angle_root/src/commit.h",
  68. ]
  69. outputs = [
  70. "$root_gen_dir/angle2/id/commit.h",
  71. ]
  72. }
  73. shared_library("libGLESv2") {
  74. configs += [ ":common" ]
  75. configs -= [ "//gn:warnings" ]
  76. defines = [
  77. "LIBANGLE_IMPLEMENTATION",
  78. "LIBGLESV2_IMPLEMENTATION",
  79. ]
  80. deps = [
  81. ":commit_id",
  82. ]
  83. libs = []
  84. sources = rebase_path(
  85. angle_preprocessor_sources + angle_translator_sources +
  86. angle_translator_essl_sources + angle_translator_glsl_sources +
  87. angle_translator_hlsl_sources + libangle_sources +
  88. libangle_common_sources + libangle_image_util_sources +
  89. libglesv2_sources + libangle_gl_sources +
  90. angle_system_utils_sources + xxhash_sources,
  91. ".",
  92. angle_root)
  93. if (is_win) {
  94. sources += [ "$angle_root/src/libGLESv2/libGLESv2_autogen.def" ]
  95. }
  96. if (is_linux) {
  97. libs += [
  98. "X11",
  99. "Xi",
  100. "Xext",
  101. ]
  102. sources += rebase_path(libangle_gl_glx_sources, ".", angle_root) +
  103. [ "$angle_root/src/third_party/libXNVCtrl/NVCtrl.c" ]
  104. } else if (is_win) {
  105. defines += [
  106. # TODO: ANGLE_PRELOADED_D3DCOMPILER_MODULE_NAMES
  107. ]
  108. sources +=
  109. rebase_path(libangle_gl_wgl_sources + libangle_d3d_shared_sources +
  110. libangle_d3d9_sources + libangle_d3d11_sources +
  111. libangle_d3d11_win32_sources,
  112. ".",
  113. angle_root)
  114. libs += [
  115. "d3d9.lib",
  116. "dxguid.lib",
  117. "gdi32.lib",
  118. "user32.lib",
  119. ]
  120. deps += [
  121. # TODO: copy_compiler_dll?
  122. ]
  123. }
  124. }
  125. shared_library("libEGL") {
  126. configs += [ ":common" ]
  127. configs -= [ "//gn:warnings" ]
  128. defines = [ "LIBEGL_IMPLEMENTATION" ]
  129. deps = [
  130. ":libGLESv2",
  131. ]
  132. sources = rebase_path(libegl_sources, ".", angle_root)
  133. if (is_win) {
  134. sources += [ "$angle_root/src/libEGL/libEGL.def" ]
  135. }
  136. }