Made SwiftShader compile on Mac in Chromium

Fixed a few things in the BUILD.gn files:
1) Style guide mentions single entries should be on single lines
2) Changed "host_os == ..." for the is_... equivalent values
3) Added missing Mac libs and include dirs

Change-Id: I28d35fd86a8cf9c9157a397370a385fe3e5e958b
Reviewed-on: https://swiftshader-review.googlesource.com/7152
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
diff --git a/src/OpenGL/common/BUILD.gn b/src/OpenGL/common/BUILD.gn
index bf80c44..9d47e6c 100644
--- a/src/OpenGL/common/BUILD.gn
+++ b/src/OpenGL/common/BUILD.gn
@@ -21,14 +21,10 @@
     ]
 
     if (is_clang) {
-      cflags += [
-        "-Wno-delete-incomplete",
-      ]
+      cflags += [ "-Wno-delete-incomplete" ]
     }
   } else {
-    cflags = [
-      "-DLOG_TAG=\"swiftshader_opengl_common\"",
-    ]
+    cflags = [ "-DLOG_TAG=\"swiftshader_opengl_common\"" ]
   }
 }
 
@@ -40,9 +36,7 @@
     "MatrixStack.cpp",
   ]
 
-  configs += [
-    ":swiftshader_opengl_common_private_config",
-  ]
+  configs += [ ":swiftshader_opengl_common_private_config" ]
 
   include_dirs = [
     "..",
diff --git a/src/OpenGL/compiler/BUILD.gn b/src/OpenGL/compiler/BUILD.gn
index 89e54e3..8cd74a5 100644
--- a/src/OpenGL/compiler/BUILD.gn
+++ b/src/OpenGL/compiler/BUILD.gn
@@ -23,9 +23,7 @@
     ]
 
     if (!is_debug) {
-      cflags += [
-        "/wd4189", # local variable is initialized but not referenced (variables only used in ASSERTS)
-      ]
+      cflags += [ "/wd4189" ] # local variable is initialized but not referenced (variables only used in ASSERTS)
     }
 
     if (is_clang) {
@@ -41,17 +39,13 @@
     ]
 
     if (!is_debug) {
-      cflags += [
-        "-Wno-unused-variable", # local variable is initialized but not referenced (variables only used in ASSERTS)
-      ]
+      cflags += [ "-Wno-unused-variable" ] # local variable is initialized but not referenced (variables only used in ASSERTS)
     }
   }
 }
 
 source_set("swiftshader_opengl_compiler") {
-  deps = [
-    "preprocessor:swiftshader_opengl_preprocessor",
-  ]
+  deps = [ "preprocessor:swiftshader_opengl_preprocessor" ]
 
   sources = [
     "AnalyzeCallDepth.cpp",
@@ -79,19 +73,13 @@
     "ValidateSwitch.cpp",
   ]
 
-  if ((host_os == "linux") || (host_os == "mac")) {
-    sources += [
-      "ossource_posix.cpp",
-    ]
-  } else if (host_os == "win") {
-    sources += [
-      "ossource_win.cpp",
-    ]
+  if (is_linux || is_mac) {
+    sources += [ "ossource_posix.cpp" ]
+  } else if (is_win) {
+    sources += [ "ossource_win.cpp" ]
   }
 
-  configs += [
-    ":swiftshader_opengl_compiler_private_config",
-  ]
+  configs += [ ":swiftshader_opengl_compiler_private_config" ]
 
   include_dirs = [
     "..",
diff --git a/src/OpenGL/libEGL/BUILD.gn b/src/OpenGL/libEGL/BUILD.gn
index 35692bb..cd76ab9 100644
--- a/src/OpenGL/libEGL/BUILD.gn
+++ b/src/OpenGL/libEGL/BUILD.gn
@@ -24,9 +24,7 @@
     ]
 
     if (is_clang) {
-      cflags += [
-        "-Wno-unused-function",
-      ]
+      cflags += [ "-Wno-unused-function" ]
     }
   } else {
     cflags = [
@@ -54,29 +52,21 @@
     "resource.h",
   ]
 
-  if(is_debug)
-  {
-    sources += [
-      "../common/debug.cpp",
-    ]
+  if(is_debug) {
+    sources += [ "../common/debug.cpp" ]
   }
 
-  if (host_os == "mac") {
-    sources += [
-      "OSXUtils.mm",
+  if (is_mac) {
+    sources += [ "OSXUtils.mm" ]
+    libs = [
+      "Quartz.framework",
+      "Cocoa.framework",
     ]
-  } else if (host_os == "win") {
-    configs -= [
-      "//build/config/win:unicode"
-    ]
-
-    ldflags = [
-      "/DEF:" + rebase_path("libGLESv2.def", root_build_dir),
-    ]
-  } else if (host_os == "linux") {
-    sources += [
-      "../../Main/libX11.cpp",
-    ]
+  } else if (is_win) {
+    configs -= [ "//build/config/win:unicode" ]
+    ldflags = [ "/DEF:" + rebase_path("libGLESv2.def", root_build_dir) ]
+  } else if (is_linux) {
+    sources += [ "../../Main/libX11.cpp" ]
   }
 
   configs -= [ "//build/config/compiler:chromium_code" ]
diff --git a/src/OpenGL/libGLESv2/BUILD.gn b/src/OpenGL/libGLESv2/BUILD.gn
index a7c9a3b..5902917 100644
--- a/src/OpenGL/libGLESv2/BUILD.gn
+++ b/src/OpenGL/libGLESv2/BUILD.gn
@@ -80,14 +80,9 @@
     "resource.h",
   ]
 
-  if (host_os == "win") {
-    configs -= [
-      "//build/config/win:unicode"
-    ]
-
-    ldflags = [
-      "/DEF:" + rebase_path("libGLESv2.def", root_build_dir),
-    ]
+  if (is_win) {
+    configs -= [ "//build/config/win:unicode" ]
+    ldflags = [ "/DEF:" + rebase_path("libGLESv2.def", root_build_dir) ]
   }
 
   configs -= [ "//build/config/compiler:chromium_code" ]