further updates to 67384dd18b1715
[platform/upstream/glslang.git] / BUILD.gn
index 09a0c71..29328d4 100644 (file)
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -59,13 +59,39 @@ action("glslang_build_info") {
     script,
     template_file,
   ]
-  outputs = [
-    out_file
-  ]
+  outputs = [ out_file ]
   args = [
     rebase_path(src_dir, root_build_dir),
-    "-i", rebase_path(template_file, root_build_dir),
-    "-o", rebase_path(out_file, root_build_dir),
+    "-i",
+    rebase_path(template_file, root_build_dir),
+    "-o",
+    rebase_path(out_file, root_build_dir),
+  ]
+}
+
+action("glslang_extension_headers") {
+  script = "gen_extension_headers.py"
+
+  out_file = "${target_gen_dir}/include/glslang/glsl_intrinsic_header.h"
+
+  # Fuchsia GN build rules require all GN actions to be hermetic and they
+  # should correctly and fully state their inputs and outpus (see
+  # https://fuchsia.dev/fuchsia-src/development/build/hermetic_actions
+  # for details). All input files of the script should be added to the
+  # |sources| list.
+  sources = [
+    "glslang/ExtensionHeaders/GL_EXT_shader_realtime_clock.glsl",
+  ]
+
+  inputs = [
+    script
+  ]
+  outputs = [ out_file ]
+  args = [
+    "-i",
+    rebase_path("glslang/ExtensionHeaders", root_build_dir),
+    "-o",
+    rebase_path(out_file, root_build_dir),
   ]
 }
 
@@ -76,6 +102,9 @@ if (!defined(glslang_angle)) {
 
 config("glslang_public") {
   include_dirs = [ "." ]
+  if (!is_win || is_clang) {
+    cflags = [ "-Wno-conversion" ]
+  }
 }
 
 config("glslang_hlsl") {
@@ -104,12 +133,12 @@ template("glslang_sources_common") {
       "SPIRV/Logger.cpp",
       "SPIRV/Logger.h",
       "SPIRV/NonSemanticDebugPrintf.h",
+      "SPIRV/NonSemanticShaderDebugInfo100.h",
       "SPIRV/SPVRemapper.cpp",
       "SPIRV/SPVRemapper.h",
       "SPIRV/SpvBuilder.cpp",
       "SPIRV/SpvBuilder.h",
       "SPIRV/SpvPostProcess.cpp",
-      "SPIRV/SpvTools.cpp",
       "SPIRV/SpvTools.h",
       "SPIRV/bitutils.h",
       "SPIRV/disassemble.cpp",
@@ -129,6 +158,7 @@ template("glslang_sources_common") {
       "glslang/Include/PoolAlloc.h",
       "glslang/Include/ResourceLimits.h",
       "glslang/Include/ShHandle.h",
+      "glslang/Include/SpirvIntrinsics.h",
       "glslang/Include/Types.h",
       "glslang/Include/arrays.h",
       "glslang/Include/intermediate.h",
@@ -149,6 +179,7 @@ template("glslang_sources_common") {
       "glslang/MachineIndependent/Scan.h",
       "glslang/MachineIndependent/ScanContext.h",
       "glslang/MachineIndependent/ShaderLang.cpp",
+      "glslang/MachineIndependent/SpirvIntrinsics.cpp",
       "glslang/MachineIndependent/SymbolTable.cpp",
       "glslang/MachineIndependent/SymbolTable.h",
       "glslang/MachineIndependent/Versions.cpp",
@@ -208,8 +239,12 @@ template("glslang_sources_common") {
 
     defines = []
     if (invoker.enable_opt) {
+      sources += [ "SPIRV/SpvTools.cpp" ]
       defines += [ "ENABLE_OPT=1" ]
     }
+    if (invoker.is_angle) {
+      defines += [ "GLSLANG_ANGLE" ]
+    }
 
     if (is_win) {
       sources += [ "glslang/OSDependent/Windows/ossource.cpp" ]
@@ -225,10 +260,12 @@ template("glslang_sources_common") {
         "-Wno-ignored-qualifiers",
         "-Wno-implicit-fallthrough",
         "-Wno-inconsistent-missing-override",
-        "-Wno-sign-compare",
-        "-Wno-unused-variable",
         "-Wno-missing-field-initializers",
         "-Wno-newline-eof",
+        "-Wno-sign-compare",
+        "-Wno-suggest-destructor-override",
+        "-Wno-suggest-override",
+        "-Wno-unused-variable",
       ]
     }
     if (is_win && !is_clang) {
@@ -238,18 +275,18 @@ template("glslang_sources_common") {
       ]
     }
 
+    include_dirs = [ "${target_gen_dir}/include" ]
+
     deps = [ ":glslang_build_info" ]
 
     if (invoker.enable_opt) {
       deps += [
-        ":glslang_build_info",
         "${spirv_tools_dir}:spvtools_opt",
         "${spirv_tools_dir}:spvtools_val",
       ]
+      include_dirs += [ "${spirv_tools_dir}/include" ]
     }
 
-    include_dirs = [ "${target_gen_dir}/include" ]
-
     configs -= _configs_to_remove
     configs += _configs_to_add
   }
@@ -258,11 +295,13 @@ template("glslang_sources_common") {
 glslang_sources_common("glslang_lib_sources") {
   enable_opt = !glslang_angle
   enable_hlsl = !glslang_angle
+  is_angle = glslang_angle
 }
 
 glslang_sources_common("glslang_sources") {
   enable_opt = true
   enable_hlsl = true
+  is_angle = false
 }
 
 source_set("glslang_default_resource_limits_sources") {
@@ -287,12 +326,17 @@ executable("glslang_validator") {
   }
   defines = [ "ENABLE_OPT=1" ]
   deps = [
+    ":glslang_build_info",
     ":glslang_default_resource_limits_sources",
     ":glslang_sources",
+    ":glslang_extension_headers",
   ]
   public_configs = [ ":glslang_hlsl" ]
 
-  include_dirs = [ "${target_gen_dir}/include" ]
+  include_dirs = [
+    "${target_gen_dir}/include",
+    "${spirv_tools_dir}/include",
+  ]
 
   configs -= _configs_to_remove
   configs += _configs_to_add
@@ -303,6 +347,8 @@ executable("spirv-remap") {
   defines = [ "ENABLE_OPT=1" ]
   deps = [ ":glslang_sources" ]
 
+  include_dirs = [ "${spirv_tools_dir}/include" ]
+
   configs -= _configs_to_remove
   configs += _configs_to_add
 }