Commit 46c1b917 by Alexis Hetu Committed by Alexis Hétu

Update to gn files for Windows

This cl allows SwiftShader to be built on Windows within Chromium Change-Id: I0fc9ec1dfc5012cc310695e13edc64c639b23fda Reviewed-on: https://swiftshader-review.googlesource.com/5680Tested-by: 's avatarAlexis Hétu <sugoi@google.com> Reviewed-by: 's avatarNicolas Capens <capn@google.com>
parent 342b5c61
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
# limitations under the License. # limitations under the License.
config("swiftshader_config") { config("swiftshader_config") {
if (is_clang) { if (is_clang) {
cflags = [ cflags = [
"-std=c++11", "-std=c++11",
] ]
......
...@@ -22,10 +22,15 @@ config("swiftshader_common_private_config") { ...@@ -22,10 +22,15 @@ config("swiftshader_common_private_config") {
if (!is_debug) { if (!is_debug) {
cflags += [ cflags += [
"-DNDEBUG",
"-DANGLE_DISABLE_TRACE", "-DANGLE_DISABLE_TRACE",
] ]
} }
} else {
if (host_os == "win") {
cflags = [
"/wd4201", # nameless struct/union
]
}
} }
} }
......
...@@ -19,14 +19,19 @@ config("swiftshader_main_private_config") { ...@@ -19,14 +19,19 @@ config("swiftshader_main_private_config") {
"-DLOG_TAG=\"swiftshader_main\"", "-DLOG_TAG=\"swiftshader_main\"",
"-msse2", "-msse2",
] ]
} else {
if (!is_debug) { if (host_os == "win") {
cflags += [ cflags = [
"-DNDEBUG", "/wd4201", # nameless struct/union
"-DANGLE_DISABLE_TRACE",
] ]
} }
} }
if (!is_debug) {
cflags += [
"-DANGLE_DISABLE_TRACE",
]
}
} }
source_set("swiftshader_main") { source_set("swiftshader_main") {
...@@ -57,6 +62,14 @@ 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 += [ configs += [
":swiftshader_main_private_config", ":swiftshader_main_private_config",
] ]
......
...@@ -18,14 +18,20 @@ config("swiftshader_opengl_common_private_config") { ...@@ -18,14 +18,20 @@ config("swiftshader_opengl_common_private_config") {
cflags = [ cflags = [
"-DLOG_TAG=\"swiftshader_opengl_common\"", "-DLOG_TAG=\"swiftshader_opengl_common\"",
] ]
} else {
if (!is_debug) { if (host_os == "win") {
cflags += [ cflags = [
"-DNDEBUG", "/wd4201", # nameless struct/union
"-DANGLE_DISABLE_TRACE", "/wd4324", # structure was padded due to alignment specifier
] ]
} }
} }
if (!is_debug) {
cflags += [
"-DANGLE_DISABLE_TRACE",
]
}
} }
source_set("swiftshader_opengl_common") { source_set("swiftshader_opengl_common") {
......
...@@ -19,14 +19,22 @@ config("swiftshader_opengl_compiler_private_config") { ...@@ -19,14 +19,22 @@ config("swiftshader_opengl_compiler_private_config") {
"-DLOG_TAG=\"swiftshader_opengl_compiler\"", "-DLOG_TAG=\"swiftshader_opengl_compiler\"",
"-Wno-sign-compare", "-Wno-sign-compare",
] ]
} else {
if (!is_debug) { if (host_os == "win") {
cflags += [ cflags = [
"-DNDEBUG", "/wd4005", # macro redefinition (in autogenerated code)
"-DANGLE_DISABLE_TRACE", "/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") { source_set("swiftshader_opengl_compiler") {
......
...@@ -18,14 +18,21 @@ config("swiftshader_opengl_preprocessor_private_config") { ...@@ -18,14 +18,21 @@ config("swiftshader_opengl_preprocessor_private_config") {
cflags = [ cflags = [
"-DLOG_TAG=\"swiftshader_opengl_compiler\"", "-DLOG_TAG=\"swiftshader_opengl_compiler\"",
] ]
} else {
if (!is_debug) { if (host_os == "win") {
cflags += [ cflags = [
"-DNDEBUG", "/wd4005", # macro redefinition (in autogenerated code)
"-DANGLE_DISABLE_TRACE", "/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") { source_set("swiftshader_opengl_preprocessor") {
......
...@@ -21,14 +21,22 @@ config("swiftshader_libEGL_private_config") { ...@@ -21,14 +21,22 @@ config("swiftshader_libEGL_private_config") {
"-DEGL_EGLEXT_PROTOTYPES", "-DEGL_EGLEXT_PROTOTYPES",
"-Wno-sign-compare", "-Wno-sign-compare",
] ]
} else {
if (!is_debug) { if (host_os == "win") {
cflags += [ cflags = [
"-DNDEBUG", "/DEGLAPI=",
"-DANGLE_DISABLE_TRACE", "/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") { shared_library("swiftshader_libEGL") {
...@@ -55,6 +63,10 @@ shared_library("swiftshader_libEGL") { ...@@ -55,6 +63,10 @@ shared_library("swiftshader_libEGL") {
sources += [ sources += [
"OSXUtils.mm", "OSXUtils.mm",
] ]
} else if (host_os == "win") {
configs -= [
"//build/config/win:unicode"
]
} }
configs += [ configs += [
......
...@@ -25,14 +25,24 @@ config("swiftshader_libGLESv2_private_config") { ...@@ -25,14 +25,24 @@ config("swiftshader_libGLESv2_private_config") {
"-DGL_GLEXT_PROTOTYPES", "-DGL_GLEXT_PROTOTYPES",
"-Wno-sign-compare", "-Wno-sign-compare",
] ]
} else {
if (!is_debug) { if (host_os == "win") {
cflags += [ cflags = [
"-DNDEBUG", "/DGL_API=",
"-DANGLE_DISABLE_TRACE", "/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") { shared_library("swiftshader_libGLESv2") {
...@@ -69,6 +79,12 @@ shared_library("swiftshader_libGLESv2") { ...@@ -69,6 +79,12 @@ shared_library("swiftshader_libGLESv2") {
"VertexDataManager.cpp", "VertexDataManager.cpp",
] ]
if (host_os == "win") {
configs -= [
"//build/config/win:unicode"
]
}
configs += [ configs += [
":swiftshader_libGLESv2_private_config", ":swiftshader_libGLESv2_private_config",
] ]
......
...@@ -22,14 +22,20 @@ config("swiftshader_reactor_private_config") { ...@@ -22,14 +22,20 @@ config("swiftshader_reactor_private_config") {
"-D__STDC_CONSTANT_MACROS", "-D__STDC_CONSTANT_MACROS",
"-D__STDC_LIMIT_MACROS", "-D__STDC_LIMIT_MACROS",
] ]
} else {
if (!is_debug) { if (host_os == "win") {
cflags += [ cflags = [
"-DNDEBUG", "/wd4201", # nameless struct/union
"-DANGLE_DISABLE_TRACE", "/wd4245", # conversion from int to unsigned int (llvm)
] ]
} }
} }
if (!is_debug) {
cflags += [
"-DANGLE_DISABLE_TRACE",
]
}
} }
source_set("swiftshader_reactor") { source_set("swiftshader_reactor") {
...@@ -48,6 +54,9 @@ source_set("swiftshader_reactor") { ...@@ -48,6 +54,9 @@ source_set("swiftshader_reactor") {
sources += [ sources += [
"DLL.cpp", "DLL.cpp",
] ]
configs -= [
"//build/config/win:unicode"
]
} }
configs += [ configs += [
......
...@@ -21,14 +21,20 @@ config("swiftshader_renderer_private_config") { ...@@ -21,14 +21,20 @@ config("swiftshader_renderer_private_config") {
"-msse2", "-msse2",
"-Wno-sign-compare", "-Wno-sign-compare",
] ]
} else {
if (!is_debug) { if (host_os == "win") {
cflags += [ cflags = [
"-DNDEBUG", "/wd4201", # nameless struct/union
"-DANGLE_DISABLE_TRACE", "/wd4324", # structure was padded due to alignment specifier
] ]
} }
} }
if (!is_debug) {
cflags += [
"-DANGLE_DISABLE_TRACE",
]
}
} }
source_set("swiftshader_renderer") { source_set("swiftshader_renderer") {
...@@ -58,6 +64,12 @@ source_set("swiftshader_renderer") { ...@@ -58,6 +64,12 @@ source_set("swiftshader_renderer") {
"VertexProcessor.cpp", "VertexProcessor.cpp",
] ]
if (host_os == "win") {
configs -= [
"//build/config/win:unicode"
]
}
configs += [ configs += [
":swiftshader_renderer_private_config", ":swiftshader_renderer_private_config",
] ]
......
...@@ -19,14 +19,20 @@ config("swiftshader_shader_private_config") { ...@@ -19,14 +19,20 @@ config("swiftshader_shader_private_config") {
"-DLOG_TAG=\"swiftshader_shader\"", "-DLOG_TAG=\"swiftshader_shader\"",
"-fno-operator-names", "-fno-operator-names",
] ]
} else {
if (!is_debug) { if (host_os == "win") {
cflags += [ cflags = [
"-DNDEBUG", "/wd4201", # nameless struct/union
"-DANGLE_DISABLE_TRACE", "/wd4324", # structure was padded due to alignment specifier
] ]
} }
} }
if (!is_debug) {
cflags += [
"-DANGLE_DISABLE_TRACE",
]
}
} }
source_set("swiftshader_shader") { source_set("swiftshader_shader") {
......
...@@ -28,6 +28,26 @@ config("swiftshader_llvm_private_config") { ...@@ -28,6 +28,26 @@ config("swiftshader_llvm_private_config") {
"-Wno-deprecated-declarations", "-Wno-deprecated-declarations",
"-Wno-unused-variable", "-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") { ...@@ -407,13 +427,23 @@ source_set("swiftshader_llvm") {
"lib/VMCore/Verifier.cpp", "lib/VMCore/Verifier.cpp",
] ]
if (host_os == "win") {
configs -= [
"//build/config/win:unicode"
]
}
configs += [ configs += [
":swiftshader_llvm_private_config", ":swiftshader_llvm_private_config",
] ]
include_dirs = [ include_dirs = [
"include-linux",
"include", "include",
"lib/Target/X86", "lib/Target/X86",
] ]
if (host_os == "linux") {
include_dirs += [
"include-linux",
]
}
} }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment