Commit 03b67af4 by Alexis Hetu Committed by Alexis Hétu

Fixed build files for Windows clang

Made Windows files work for Windows clang. Verified on Linux and Windows Visual Studio compiler to make sure nothing was broken. Change-Id: I82815491579cdfca602660279f6831c8820249f6 Reviewed-on: https://swiftshader-review.googlesource.com/7052Tested-by: 's avatarAlexis Hétu <sugoi@google.com> Reviewed-by: 's avatarCorentin Wallez <cwallez@google.com> Reviewed-by: 's avatarAlexis Hétu <sugoi@google.com>
parent 65dcbbd1
...@@ -13,7 +13,28 @@ ...@@ -13,7 +13,28 @@
# limitations under the License. # limitations under the License.
config("swiftshader_config") { config("swiftshader_config") {
if (is_clang) { if (is_win) {
cflags = [
"/GS", # Detects some buffer overruns
"/Zc:wchar_t",
"/D_CRT_SECURE_NO_DEPRECATE",
"/DNOMINMAX",
"/D_WINDLL",
"/EHsc",
"/nologo",
"/Gd", # Default calling convention
]
if (is_debug) {
cflags += [
"/RTC1", # Run-Time Error Checks
]
} else {
cflags += [
"/DANGLE_DISABLE_TRACE",
]
}
} else {
cflags = [ cflags = [
"-std=c++11", "-std=c++11",
] ]
...@@ -53,29 +74,6 @@ config("swiftshader_config") { ...@@ -53,29 +74,6 @@ config("swiftshader_config") {
"-m32", "-m32",
] ]
} }
} else {
if (host_os == "win") {
cflags = [
"/GS", # Detects some buffer overruns
"/Zc:wchar_t",
"/D_CRT_SECURE_NO_DEPRECATE",
"/DNOMINMAX",
"/D_WINDLL",
"/EHsc",
"/nologo",
"/Gd", # Default calling convention
]
if (is_debug) {
cflags += [
"/RTC1", # Run-Time Error Checks
]
} else {
cflags += [
"/DANGLE_DISABLE_TRACE",
]
}
}
} }
} }
......
...@@ -14,17 +14,15 @@ ...@@ -14,17 +14,15 @@
# Need a separate config to ensure the warnings are added to the end. # Need a separate config to ensure the warnings are added to the end.
config("swiftshader_common_private_config") { config("swiftshader_common_private_config") {
if (is_clang) { if (is_win) {
cflags = [
"/wd4201", # nameless struct/union
]
} else {
cflags = [ cflags = [
"-DLOG_TAG=\"swiftshader_common\"", "-DLOG_TAG=\"swiftshader_common\"",
"-msse2", "-msse2",
] ]
} else {
if (host_os == "win") {
cflags = [
"/wd4201", # nameless struct/union
]
}
} }
} }
......
...@@ -14,17 +14,23 @@ ...@@ -14,17 +14,23 @@
# Need a separate config to ensure the warnings are added to the end. # Need a separate config to ensure the warnings are added to the end.
config("swiftshader_main_private_config") { config("swiftshader_main_private_config") {
if (is_clang) { if (is_win) {
cflags = [ cflags = [
"-DLOG_TAG=\"swiftshader_main\"", "/wd4201", # nameless struct/union
"-msse2",
] ]
} else {
if (host_os == "win") { if (is_clang) {
cflags = [ cflags += [
"/wd4201", # nameless struct/union "-Wno-overloaded-virtual",
"-Wno-string-conversion",
"-Wno-sign-compare",
] ]
} }
} else {
cflags = [
"-DLOG_TAG=\"swiftshader_main\"",
"-msse2",
]
} }
} }
......
...@@ -14,17 +14,21 @@ ...@@ -14,17 +14,21 @@
# Need a separate config to ensure the warnings are added to the end. # Need a separate config to ensure the warnings are added to the end.
config("swiftshader_opengl_common_private_config") { config("swiftshader_opengl_common_private_config") {
if (is_clang) { if (is_win) {
cflags = [ cflags = [
"-DLOG_TAG=\"swiftshader_opengl_common\"", "/wd4201", # nameless struct/union
"/wd4324", # structure was padded due to alignment specifier
] ]
} else {
if (host_os == "win") { if (is_clang) {
cflags = [ cflags += [
"/wd4201", # nameless struct/union "-Wno-delete-incomplete",
"/wd4324", # structure was padded due to alignment specifier
] ]
} }
} else {
cflags = [
"-DLOG_TAG=\"swiftshader_opengl_common\"",
]
} }
} }
......
...@@ -14,31 +14,36 @@ ...@@ -14,31 +14,36 @@
# Need a separate config to ensure the warnings are added to the end. # Need a separate config to ensure the warnings are added to the end.
config("swiftshader_opengl_compiler_private_config") { config("swiftshader_opengl_compiler_private_config") {
if (is_clang) { if (is_win) {
cflags = [ cflags = [
"-DLOG_TAG=\"swiftshader_opengl_compiler\"", "/wd4005", # macro redefinition (in autogenerated code)
"-Wno-sign-compare", "/wd4201", # nameless struct/union
"/wd4267", # conversion from size_t to int/unsigned int
"/wd4702", # unreachable code (in autogenerated code)
] ]
if (!is_debug) { if (!is_debug) {
cflags += [ cflags += [
"-Wno-unused-variable", # local variable is initialized but not referenced (variables only used in ASSERTS) "/wd4189", # local variable is initialized but not referenced (variables only used in ASSERTS)
] ]
} }
} else {
if (host_os == "win") { if (is_clang) {
cflags = [ cflags += [
"/wd4005", # macro redefinition (in autogenerated code) "-Wno-unused-function",
"/wd4201", # nameless struct/union "-Wno-unused-variable",
"/wd4267", # conversion from size_t to int/unsigned int
"/wd4702", # unreachable code (in autogenerated code)
] ]
}
} else {
cflags = [
"-DLOG_TAG=\"swiftshader_opengl_compiler\"",
"-Wno-sign-compare",
]
if (!is_debug) { if (!is_debug) {
cflags += [ cflags += [
"/wd4189", # local variable is initialized but not referenced (variables only used in ASSERTS) "-Wno-unused-variable", # local variable is initialized but not referenced (variables only used in ASSERTS)
] ]
}
} }
} }
} }
......
...@@ -14,18 +14,16 @@ ...@@ -14,18 +14,16 @@
# Need a separate config to ensure the warnings are added to the end. # Need a separate config to ensure the warnings are added to the end.
config("swiftshader_opengl_preprocessor_private_config") { config("swiftshader_opengl_preprocessor_private_config") {
if (is_clang) { if (is_win) {
cflags = [ cflags = [
"-DLOG_TAG=\"swiftshader_opengl_compiler\"", "/wd4005", # macro redefinition (in autogenerated code)
"/wd4267", # conversion from size_t to int/unsigned int (in autogenerated code)
"/wd4702", # unreachable code (in autogenerated code)
] ]
} else { } else {
if (host_os == "win") { cflags = [
cflags = [ "-DLOG_TAG=\"swiftshader_opengl_compiler\"",
"/wd4005", # macro redefinition (in autogenerated code) ]
"/wd4267", # conversion from size_t to int/unsigned int (in autogenerated code)
"/wd4702", # unreachable code (in autogenerated code)
]
}
} }
} }
......
...@@ -14,23 +14,27 @@ ...@@ -14,23 +14,27 @@
# Need a separate config to ensure the warnings are added to the end. # Need a separate config to ensure the warnings are added to the end.
config("swiftshader_libEGL_private_config") { config("swiftshader_libEGL_private_config") {
if (is_clang) { if (is_win) {
cflags = [
"/DEGLAPI=",
"/DEGL_EGLEXT_PROTOTYPES",
"/DLIBEGL_EXPORTS",
"/wd4201", # nameless struct/union
"/wd4065", # switch statement contains 'default' but no 'case' labels
]
if (is_clang) {
cflags += [
"-Wno-unused-function",
]
}
} else {
cflags = [ cflags = [
"-DLOG_TAG=\"swiftshader_libEGL\"", "-DLOG_TAG=\"swiftshader_libEGL\"",
"-DEGLAPI=", "-DEGLAPI=",
"-DEGL_EGLEXT_PROTOTYPES", "-DEGL_EGLEXT_PROTOTYPES",
"-Wno-sign-compare", "-Wno-sign-compare",
] ]
} else {
if (host_os == "win") {
cflags = [
"/DEGLAPI=",
"/DEGL_EGLEXT_PROTOTYPES",
"/DLIBEGL_EXPORTS",
"/wd4201", # nameless struct/union
"/wd4065", # switch statement contains 'default' but no 'case' labels
]
}
} }
} }
......
...@@ -14,10 +14,27 @@ ...@@ -14,10 +14,27 @@
# Need a separate config to ensure the warnings are added to the end. # Need a separate config to ensure the warnings are added to the end.
config("swiftshader_libGLESv2_private_config") { config("swiftshader_libGLESv2_private_config") {
if (is_clang) { if (is_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_clang)
{
cflags += [
"-Wno-delete-incomplete",
"-D__STDC_CONSTANT_MACROS",
"-D__STDC_LIMIT_MACROS",
]
}
} else {
cflags = [ cflags = [
"-DLOG_TAG=\"swiftshader_libGLESv2\"", "-DLOG_TAG=\"swiftshader_libGLESv2\"",
"-fno-operator-names",
"-D__STDC_CONSTANT_MACROS", "-D__STDC_CONSTANT_MACROS",
"-D__STDC_LIMIT_MACROS", "-D__STDC_LIMIT_MACROS",
"-DGL_API=", "-DGL_API=",
...@@ -25,17 +42,6 @@ config("swiftshader_libGLESv2_private_config") { ...@@ -25,17 +42,6 @@ config("swiftshader_libGLESv2_private_config") {
"-DGL_GLEXT_PROTOTYPES", "-DGL_GLEXT_PROTOTYPES",
"-Wno-sign-compare", "-Wno-sign-compare",
] ]
} 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
]
}
} }
} }
......
...@@ -14,7 +14,18 @@ ...@@ -14,7 +14,18 @@
# Need a separate config to ensure the warnings are added to the end. # Need a separate config to ensure the warnings are added to the end.
config("swiftshader_reactor_private_config") { config("swiftshader_reactor_private_config") {
if (is_clang) { if (is_win) {
cflags = [
"/wd4201", # nameless struct/union
"/wd4245", # conversion from int to unsigned int (llvm)
]
if (is_clang) {
cflags += [
"-Wno-delete-incomplete",
]
}
} else {
cflags = [ cflags = [
"-DLOG_TAG=\"swiftshader_reactor\"", "-DLOG_TAG=\"swiftshader_reactor\"",
"-Wno-unused-local-typedef", "-Wno-unused-local-typedef",
...@@ -22,13 +33,6 @@ config("swiftshader_reactor_private_config") { ...@@ -22,13 +33,6 @@ config("swiftshader_reactor_private_config") {
"-D__STDC_CONSTANT_MACROS", "-D__STDC_CONSTANT_MACROS",
"-D__STDC_LIMIT_MACROS", "-D__STDC_LIMIT_MACROS",
] ]
} else {
if (host_os == "win") {
cflags = [
"/wd4201", # nameless struct/union
"/wd4245", # conversion from int to unsigned int (llvm)
]
}
} }
} }
......
...@@ -14,20 +14,24 @@ ...@@ -14,20 +14,24 @@
# Need a separate config to ensure the warnings are added to the end. # Need a separate config to ensure the warnings are added to the end.
config("swiftshader_renderer_private_config") { config("swiftshader_renderer_private_config") {
if (is_clang) { if (is_win) {
cflags = [
"/wd4201", # nameless struct/union
"/wd4324", # structure was padded due to alignment specifier
]
if (is_clang) {
cflags += [
"-Wno-delete-incomplete",
"-Wno-microsoft-template",
]
}
} else {
cflags = [ cflags = [
"-DLOG_TAG=\"swiftshader_renderer\"", "-DLOG_TAG=\"swiftshader_renderer\"",
"-fno-operator-names",
"-msse2", "-msse2",
"-Wno-sign-compare", "-Wno-sign-compare",
] ]
} else {
if (host_os == "win") {
cflags = [
"/wd4201", # nameless struct/union
"/wd4324", # structure was padded due to alignment specifier
]
}
} }
} }
......
...@@ -14,18 +14,22 @@ ...@@ -14,18 +14,22 @@
# Need a separate config to ensure the warnings are added to the end. # Need a separate config to ensure the warnings are added to the end.
config("swiftshader_shader_private_config") { config("swiftshader_shader_private_config") {
if (is_clang) { if (is_win) {
cflags = [ cflags = [
"-DLOG_TAG=\"swiftshader_shader\"", "/wd4201", # nameless struct/union
"-fno-operator-names", "/wd4324", # structure was padded due to alignment specifier
] ]
} else {
if (host_os == "win") { if (is_clang) {
cflags = [ cflags += [
"/wd4201", # nameless struct/union "-Wno-sign-compare",
"/wd4324", # structure was padded due to alignment specifier "-Wno-delete-incomplete",
] ]
} }
} else {
cflags = [
"-DLOG_TAG=\"swiftshader_shader\"",
]
} }
} }
......
...@@ -14,9 +14,44 @@ ...@@ -14,9 +14,44 @@
# Need a separate config to ensure the warnings are added to the end. # Need a separate config to ensure the warnings are added to the end.
config("swiftshader_llvm_private_config") { config("swiftshader_llvm_private_config") {
cflags = []
if (is_win) {
cflags += [
"/wd4005",
"/wd4065",
"/wd4146",
"/wd4245",
"/wd4267",
"/wd4310",
"/wd4319",
"/wd4334",
"/wd4389",
"/wd4624",
"/wd4701",
"/wd4702",
"/wd4703",
"/wd4706",
"/wd4800",
]
if (!is_debug) {
cflags += [
"/wd4324",
]
}
if (is_clang) {
cflags += [
"-Wno-format",
"-Wno-sign-compare",
"-Wno-macro-redefined",
]
}
}
if (is_clang) { if (is_clang) {
cflags = [ cflags += [
"-fno-operator-names",
"-msse2", "-msse2",
"-D__STDC_CONSTANT_MACROS", "-D__STDC_CONSTANT_MACROS",
"-D__STDC_LIMIT_MACROS", "-D__STDC_LIMIT_MACROS",
...@@ -28,32 +63,6 @@ config("swiftshader_llvm_private_config") { ...@@ -28,32 +63,6 @@ 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",
]
if (!is_debug) {
cflags += [
"/wd4324",
]
}
}
} }
} }
......
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