OSDN Git Service

Update to gn files for Windows
authorAlexis Hetu <sugoi@google.com>
Thu, 23 Jun 2016 15:06:46 +0000 (11:06 -0400)
committerAlexis Hétu <sugoi@google.com>
Thu, 23 Jun 2016 15:26:38 +0000 (15:26 +0000)
This cl allows SwiftShader to be built on Windows within Chromium

Change-Id: I0fc9ec1dfc5012cc310695e13edc64c639b23fda
Reviewed-on: https://swiftshader-review.googlesource.com/5680
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
12 files changed:
BUILD.gn
src/Common/BUILD.gn
src/Main/BUILD.gn
src/OpenGL/common/BUILD.gn
src/OpenGL/compiler/BUILD.gn
src/OpenGL/compiler/preprocessor/BUILD.gn
src/OpenGL/libEGL/BUILD.gn
src/OpenGL/libGLESv2/BUILD.gn
src/Reactor/BUILD.gn
src/Renderer/BUILD.gn
src/Shader/BUILD.gn
third_party/LLVM/BUILD.gn

index 318d422..37e34b0 100644 (file)
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -13,7 +13,7 @@
 # limitations under the License.
 
 config("swiftshader_config") {
-if (is_clang) {
+  if (is_clang) {
     cflags = [
       "-std=c++11",
     ]
index 71ccbb9..5d1fc65 100644 (file)
@@ -22,10 +22,15 @@ config("swiftshader_common_private_config") {
 
     if (!is_debug) {
       cflags += [
-        "-DNDEBUG",
         "-DANGLE_DISABLE_TRACE",
       ]
     }
+  } else {
+    if (host_os == "win") {
+      cflags = [
+        "/wd4201", # nameless struct/union
+      ]
+    }
   }
 }
 
index 254256f..ac84b5b 100644 (file)
@@ -19,14 +19,19 @@ config("swiftshader_main_private_config") {
       "-DLOG_TAG=\"swiftshader_main\"",
       "-msse2",
     ]
-
-    if (!is_debug) {
-      cflags += [
-        "-DNDEBUG",
-        "-DANGLE_DISABLE_TRACE",
+  } else {
+    if (host_os == "win") {
+      cflags = [
+        "/wd4201", # nameless struct/union
       ]
     }
   }
+
+  if (!is_debug) {
+    cflags += [
+      "-DANGLE_DISABLE_TRACE",
+    ]
+  }
 }
 
 source_set("swiftshader_main") {
@@ -57,6 +62,14 @@ source_set("swiftshader_main") {
     ]
   }
 
+  if (host_os == "win") {
+    configs -= [
+      "//build/config/win:unicode"
+    ]
+    libs = [
+      "dxguid.lib" # For FrameBufferDD
+    ]
+  }
   configs += [
     ":swiftshader_main_private_config",
   ]
index 0a23385..653db78 100644 (file)
@@ -18,14 +18,20 @@ config("swiftshader_opengl_common_private_config") {
     cflags = [
       "-DLOG_TAG=\"swiftshader_opengl_common\"",
     ]
-
-    if (!is_debug) {
-      cflags += [
-        "-DNDEBUG",
-        "-DANGLE_DISABLE_TRACE",
+  } else {
+    if (host_os == "win") {
+      cflags = [
+        "/wd4201", # nameless struct/union
+        "/wd4324", # structure was padded due to alignment specifier
       ]
     }
   }
+
+  if (!is_debug) {
+    cflags += [
+      "-DANGLE_DISABLE_TRACE",
+    ]
+  }
 }
 
 source_set("swiftshader_opengl_common") {
index a7b4c2b..e0c7171 100644 (file)
@@ -19,14 +19,22 @@ config("swiftshader_opengl_compiler_private_config") {
       "-DLOG_TAG=\"swiftshader_opengl_compiler\"",
       "-Wno-sign-compare",
     ]
-
-    if (!is_debug) {
-      cflags += [
-        "-DNDEBUG",
-        "-DANGLE_DISABLE_TRACE",
+  } else {
+    if (host_os == "win") {
+      cflags = [
+        "/wd4005", # macro redefinition (in autogenerated code)
+        "/wd4201", # nameless struct/union
+        "/wd4267", # conversion from size_t to int/unsigned int
+        "/wd4702", # unreachable code (in autogenerated code)
       ]
     }
   }
+
+  if (!is_debug) {
+    cflags += [
+      "-DANGLE_DISABLE_TRACE",
+    ]
+  }
 }
 
 source_set("swiftshader_opengl_compiler") {
index 6c6ff25..f5feb01 100644 (file)
@@ -18,14 +18,21 @@ config("swiftshader_opengl_preprocessor_private_config") {
     cflags = [
       "-DLOG_TAG=\"swiftshader_opengl_compiler\"",
     ]
-
-    if (!is_debug) {
-      cflags += [
-        "-DNDEBUG",
-        "-DANGLE_DISABLE_TRACE",
+  } else {
+    if (host_os == "win") {
+      cflags = [
+        "/wd4005", # macro redefinition (in autogenerated code)
+        "/wd4267", # conversion from size_t to int/unsigned int (in autogenerated code)
+        "/wd4702", # unreachable code (in autogenerated code)
       ]
     }
   }
+
+  if (!is_debug) {
+    cflags += [
+      "-DANGLE_DISABLE_TRACE",
+    ]
+  }
 }
 
 source_set("swiftshader_opengl_preprocessor") {
index ddd4b94..bed0df0 100644 (file)
@@ -21,14 +21,22 @@ config("swiftshader_libEGL_private_config") {
       "-DEGL_EGLEXT_PROTOTYPES",
       "-Wno-sign-compare",
     ]
-
-    if (!is_debug) {
-      cflags += [
-        "-DNDEBUG",
-        "-DANGLE_DISABLE_TRACE",
+  } else {
+    if (host_os == "win") {
+      cflags = [
+        "/DEGLAPI=",
+        "/DEGL_EGLEXT_PROTOTYPES",
+        "/wd4201", # nameless struct/union
+        "/wd4065", # switch statement contains 'default' but no 'case' labels
       ]
     }
   }
+
+  if (!is_debug) {
+    cflags += [
+      "-DANGLE_DISABLE_TRACE",
+    ]
+  }
 }
 
 shared_library("swiftshader_libEGL") {
@@ -55,6 +63,10 @@ shared_library("swiftshader_libEGL") {
     sources += [
       "OSXUtils.mm",
     ]
+  } else if (host_os == "win") {
+    configs -= [
+      "//build/config/win:unicode"
+    ]
   }
 
   configs += [
index 90a811f..2f8f935 100644 (file)
@@ -25,14 +25,24 @@ config("swiftshader_libGLESv2_private_config") {
       "-DGL_GLEXT_PROTOTYPES",
       "-Wno-sign-compare",
     ]
-
-    if (!is_debug) {
-      cflags += [
-        "-DNDEBUG",
-        "-DANGLE_DISABLE_TRACE",
+  } else {
+    if (host_os == "win") {
+      cflags = [
+        "/DGL_API=",
+        "/DGL_APICALL=",
+        "/DGL_GLEXT_PROTOTYPES",
+        "/DLIBGLESV2_EXPORTS",
+        "/wd4201", # nameless struct/union
+        "/wd4324", # structure was padded due to alignment specifier
       ]
     }
   }
+
+  if (!is_debug) {
+    cflags += [
+      "-DANGLE_DISABLE_TRACE",
+    ]
+  }
 }
 
 shared_library("swiftshader_libGLESv2") {
@@ -69,6 +79,12 @@ shared_library("swiftshader_libGLESv2") {
     "VertexDataManager.cpp",
   ]
 
+  if (host_os == "win") {
+    configs -= [
+      "//build/config/win:unicode"
+    ]
+  }
+
   configs += [
     ":swiftshader_libGLESv2_private_config",
   ]
index aa65be2..98b33fc 100644 (file)
@@ -22,14 +22,20 @@ config("swiftshader_reactor_private_config") {
       "-D__STDC_CONSTANT_MACROS",
       "-D__STDC_LIMIT_MACROS",
     ]
-
-    if (!is_debug) {
-      cflags += [
-        "-DNDEBUG",
-        "-DANGLE_DISABLE_TRACE",
+  } else {
+    if (host_os == "win") {
+      cflags = [
+        "/wd4201", # nameless struct/union
+        "/wd4245", # conversion from int to unsigned int (llvm)
       ]
     }
   }
+
+  if (!is_debug) {
+    cflags += [
+      "-DANGLE_DISABLE_TRACE",
+    ]
+  }
 }
 
 source_set("swiftshader_reactor") {
@@ -48,6 +54,9 @@ source_set("swiftshader_reactor") {
     sources += [
       "DLL.cpp",
     ]
+    configs -= [
+      "//build/config/win:unicode"
+    ]
   }
 
   configs += [
index ee5213d..2cdcf78 100644 (file)
@@ -21,14 +21,20 @@ config("swiftshader_renderer_private_config") {
       "-msse2",
       "-Wno-sign-compare",
     ]
-
-    if (!is_debug) {
-      cflags += [
-        "-DNDEBUG",
-        "-DANGLE_DISABLE_TRACE",
+  } else {
+    if (host_os == "win") {
+      cflags = [
+        "/wd4201", # nameless struct/union
+        "/wd4324", # structure was padded due to alignment specifier
       ]
     }
   }
+
+  if (!is_debug) {
+    cflags += [
+      "-DANGLE_DISABLE_TRACE",
+    ]
+  }
 }
 
 source_set("swiftshader_renderer") {
@@ -58,6 +64,12 @@ source_set("swiftshader_renderer") {
     "VertexProcessor.cpp",
   ]
 
+  if (host_os == "win") {
+    configs -= [
+      "//build/config/win:unicode"
+    ]
+  }
+
   configs += [
     ":swiftshader_renderer_private_config",
   ]
index 3e9a96c..a5e9262 100644 (file)
@@ -19,14 +19,20 @@ config("swiftshader_shader_private_config") {
       "-DLOG_TAG=\"swiftshader_shader\"",
       "-fno-operator-names",
     ]
-
-    if (!is_debug) {
-      cflags += [
-        "-DNDEBUG",
-        "-DANGLE_DISABLE_TRACE",
+  } else {
+    if (host_os == "win") {
+      cflags = [
+        "/wd4201", # nameless struct/union
+        "/wd4324", # structure was padded due to alignment specifier
       ]
     }
   }
+
+  if (!is_debug) {
+    cflags += [
+      "-DANGLE_DISABLE_TRACE",
+    ]
+  }
 }
 
 source_set("swiftshader_shader") {
index ba7ab69..d886ad5 100644 (file)
@@ -28,6 +28,26 @@ config("swiftshader_llvm_private_config") {
       "-Wno-deprecated-declarations",
       "-Wno-unused-variable",
     ]
+  } else {
+    if (host_os == "win") {
+      cflags = [
+        "/wd4005",
+        "/wd4065",
+        "/wd4146",
+        "/wd4245",
+        "/wd4267",
+        "/wd4310",
+        "/wd4319",
+        "/wd4334",
+        "/wd4389",
+        "/wd4624",
+        "/wd4701",
+        "/wd4702",
+        "/wd4703",
+        "/wd4706",
+        "/wd4800",
+      ]
+    }
   }
 }
 
@@ -407,13 +427,23 @@ source_set("swiftshader_llvm") {
     "lib/VMCore/Verifier.cpp",
   ]
 
+  if (host_os == "win") {
+    configs -= [
+      "//build/config/win:unicode"
+    ]
+  }
   configs += [
     ":swiftshader_llvm_private_config",
   ]
 
   include_dirs = [
-    "include-linux",
     "include",
     "lib/Target/X86",
   ]
+
+  if (host_os == "linux") {
+    include_dirs += [
+      "include-linux",
+    ]
+  }
 }
\ No newline at end of file