Commit 2ddef885 by Alexis Hetu Committed by Alexis Hétu

Fixed defines from BUILD.gn files

Rather than specifying defines using explicit commands in "cflags" sections, all defines were moved to generic "defines" sections. Change-Id: Ica6ee2a2447aae4f8fc6decc3a4f6b40af7ce9fd Reviewed-on: https://swiftshader-review.googlesource.com/8948Tested-by: 's avatarAlexis Hétu <sugoi@google.com> Reviewed-by: 's avatarAlexis Hétu <sugoi@google.com>
parent 0808b4f0
...@@ -13,23 +13,27 @@ ...@@ -13,23 +13,27 @@
# limitations under the License. # limitations under the License.
config("swiftshader_config") { config("swiftshader_config") {
defines = [ "STRICT_CONFORMANCE" ] # Disables OpenGL ES 3.0
if (is_win) { if (is_win) {
cflags = [ cflags = [
"/GS", # Detects some buffer overruns "/GS", # Detects some buffer overruns
"/Zc:wchar_t", "/Zc:wchar_t",
"/D_CRT_SECURE_NO_DEPRECATE",
"/DNOMINMAX",
"/D_WINDLL",
"/EHsc", "/EHsc",
"/nologo", "/nologo",
"/Gd", # Default calling convention "/Gd", # Default calling convention
"/DSTRICT_CONFORMANCE", # Disables OpenGL ES 3.0 ]
defines += [
"_CRT_SECURE_NO_DEPRECATE",
"NOMINMAX",
"_WINDLL",
] ]
if (is_debug) { if (is_debug) {
cflags += [ "/RTC1" ] # Run-Time Error Checks cflags += [ "/RTC1" ] # Run-Time Error Checks
} else { } else {
cflags += [ "/DANGLE_DISABLE_TRACE" ] defines += [ "ANGLE_DISABLE_TRACE" ]
} }
} else { } else {
cflags = [ cflags = [
...@@ -37,9 +41,11 @@ config("swiftshader_config") { ...@@ -37,9 +41,11 @@ config("swiftshader_config") {
"-Wall", "-Wall",
"-fexceptions", "-fexceptions",
"-fno-operator-names", "-fno-operator-names",
"-D__STDC_CONSTANT_MACROS", ]
"-D__STDC_LIMIT_MACROS",
"-DSTRICT_CONFORMANCE", # Disables OpenGL ES 3.0 defines += [
"__STDC_CONSTANT_MACROS",
"__STDC_LIMIT_MACROS",
] ]
if (is_debug) { if (is_debug) {
...@@ -53,11 +59,14 @@ config("swiftshader_config") { ...@@ -53,11 +59,14 @@ config("swiftshader_config") {
"-ffunction-sections", "-ffunction-sections",
"-fdata-sections", "-fdata-sections",
"-fomit-frame-pointer", "-fomit-frame-pointer",
"-DANGLE_DISABLE_TRACE",
"-DNDEBUG",
"-O2", "-O2",
"-Os", "-Os",
] ]
defines += [
"ANGLE_DISABLE_TRACE",
"NDEBUG",
]
} }
if (target_cpu == "x64") { # 64 bit version if (target_cpu == "x64") { # 64 bit version
......
...@@ -17,10 +17,8 @@ config("swiftshader_common_private_config") { ...@@ -17,10 +17,8 @@ config("swiftshader_common_private_config") {
if (is_win) { if (is_win) {
cflags = [ "/wd4201" ] # nameless struct/union cflags = [ "/wd4201" ] # nameless struct/union
} else { } else {
cflags = [ cflags = [ "-msse2" ]
"-DLOG_TAG=\"swiftshader_common\"", defines = [ "LOG_TAG=\"swiftshader_common\"" ]
"-msse2",
]
} }
} }
......
...@@ -24,10 +24,8 @@ config("swiftshader_main_private_config") { ...@@ -24,10 +24,8 @@ config("swiftshader_main_private_config") {
] ]
} }
} else { } else {
cflags = [ cflags = [ "-msse2" ]
"-DLOG_TAG=\"swiftshader_main\"", defines = [ "LOG_TAG=\"swiftshader_main\"" ]
"-msse2",
]
} }
} }
......
...@@ -20,7 +20,7 @@ config("swiftshader_opengl_common_private_config") { ...@@ -20,7 +20,7 @@ config("swiftshader_opengl_common_private_config") {
"/wd4324", # structure was padded due to alignment specifier "/wd4324", # structure was padded due to alignment specifier
] ]
} else { } else {
cflags = [ "-DLOG_TAG=\"swiftshader_opengl_common\"" ] defines = [ "LOG_TAG=\"swiftshader_opengl_common\"" ]
} }
} }
......
...@@ -26,10 +26,8 @@ config("swiftshader_opengl_compiler_private_config") { ...@@ -26,10 +26,8 @@ config("swiftshader_opengl_compiler_private_config") {
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)
} }
} else { } else {
cflags = [ cflags = [ "-Wno-sign-compare" ]
"-DLOG_TAG=\"swiftshader_opengl_compiler\"", defines = [ "LOG_TAG=\"swiftshader_opengl_compiler\"" ]
"-Wno-sign-compare",
]
if (!is_debug) { 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)
......
...@@ -21,7 +21,7 @@ config("swiftshader_opengl_preprocessor_private_config") { ...@@ -21,7 +21,7 @@ config("swiftshader_opengl_preprocessor_private_config") {
"/wd4702", # unreachable code (in autogenerated code) "/wd4702", # unreachable code (in autogenerated code)
] ]
} else { } else {
cflags = [ "-DLOG_TAG=\"swiftshader_opengl_compiler\"" ] defines = [ "LOG_TAG=\"swiftshader_opengl_compiler\"" ]
} }
} }
......
...@@ -14,25 +14,26 @@ ...@@ -14,25 +14,26 @@
# 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") {
defines = [ "EGL_EGLEXT_PROTOTYPES" ]
if (is_win) { if (is_win) {
cflags = [ cflags = [
"/DEGLAPI=",
"/DEGL_EGLEXT_PROTOTYPES",
"/DLIBEGL_EXPORTS",
"/wd4201", # nameless struct/union "/wd4201", # nameless struct/union
"/wd4065", # switch statement contains 'default' but no 'case' labels "/wd4065", # switch statement contains 'default' but no 'case' labels
] ]
} else {
cflags = [ defines += [
"-DLOG_TAG=\"swiftshader_libEGL\"", "EGLAPI=",
"-DEGL_EGLEXT_PROTOTYPES", "LIBEGL_EXPORTS",
"-Wno-sign-compare",
] ]
} else {
cflags = [ "-Wno-sign-compare" ]
defines += [ "LOG_TAG=\"swiftshader_libEGL\"" ]
if (is_linux) { if (is_linux) {
cflags += [ "-DGL_APICALL=__attribute__((visibility(\"protected\")))" ] defines += [ "GL_APICALL=__attribute__((visibility(\"protected\")))" ]
} else { } else {
cflags += [ "-DGL_APICALL=__attribute__((visibility(\"default\")))" ] defines += [ "GL_APICALL=__attribute__((visibility(\"default\")))" ]
} }
} }
} }
......
...@@ -14,36 +14,41 @@ ...@@ -14,36 +14,41 @@
# 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") {
defines = [
"GL_API=",
"GL_GLEXT_PROTOTYPES",
]
if (is_win) { if (is_win) {
cflags = [ cflags = [
"/DGL_API=",
"/DGL_APICALL=",
"/DGL_GLEXT_PROTOTYPES",
"/DLIBGLESV2_EXPORTS",
"/wd4201", # nameless struct/union "/wd4201", # nameless struct/union
"/wd4324", # structure was padded due to alignment specifier "/wd4324", # structure was padded due to alignment specifier
] ]
defines += [
"GL_APICALL=",
"LIBGLESV2_EXPORTS",
]
if (is_clang) { if (is_clang) {
cflags += [ defines += [
"-D__STDC_CONSTANT_MACROS", "__STDC_CONSTANT_MACROS",
"-D__STDC_LIMIT_MACROS", "__STDC_LIMIT_MACROS",
] ]
} }
} else { } else {
cflags = [ cflags = [ "-Wno-sign-compare" ]
"-DLOG_TAG=\"swiftshader_libGLESv2\"",
"-D__STDC_CONSTANT_MACROS", defines += [
"-D__STDC_LIMIT_MACROS", "LOG_TAG=\"swiftshader_libGLESv2\"",
"-DGL_API=", "__STDC_CONSTANT_MACROS",
"-DGL_GLEXT_PROTOTYPES", "__STDC_LIMIT_MACROS",
"-Wno-sign-compare",
] ]
if (is_linux) { if (is_linux) {
cflags += [ "-DGL_APICALL=" ] defines += [ "GL_APICALL=" ]
} else { } else {
cflags += [ "-DGL_APICALL=__attribute__((visibility(\"default\")))" ] defines += [ "GL_APICALL=__attribute__((visibility(\"default\")))" ]
} }
} }
} }
......
...@@ -141,11 +141,14 @@ config("swiftshader_reactor_private_config") { ...@@ -141,11 +141,14 @@ config("swiftshader_reactor_private_config") {
] ]
} else { } else {
cflags = [ cflags = [
"-DLOG_TAG=\"swiftshader_reactor\"",
"-Wno-unused-local-typedef", "-Wno-unused-local-typedef",
"-msse2", "-msse2",
"-D__STDC_CONSTANT_MACROS", ]
"-D__STDC_LIMIT_MACROS",
defines = [
"LOG_TAG=\"swiftshader_reactor\"",
"__STDC_CONSTANT_MACROS",
"__STDC_LIMIT_MACROS",
] ]
} }
} }
......
...@@ -21,10 +21,11 @@ config("swiftshader_renderer_private_config") { ...@@ -21,10 +21,11 @@ config("swiftshader_renderer_private_config") {
] ]
} else { } else {
cflags = [ cflags = [
"-DLOG_TAG=\"swiftshader_renderer\"",
"-msse2", "-msse2",
"-Wno-sign-compare", "-Wno-sign-compare",
] ]
defines = [ "LOG_TAG=\"swiftshader_renderer\"" ]
} }
} }
......
...@@ -24,7 +24,7 @@ config("swiftshader_shader_private_config") { ...@@ -24,7 +24,7 @@ config("swiftshader_shader_private_config") {
cflags += [ "-Wno-sign-compare" ] cflags += [ "-Wno-sign-compare" ]
} }
} else { } else {
cflags = [ "-DLOG_TAG=\"swiftshader_shader\"" ] defines = [ "LOG_TAG=\"swiftshader_shader\"" ]
} }
} }
......
...@@ -51,8 +51,6 @@ config("swiftshader_llvm_private_config") { ...@@ -51,8 +51,6 @@ config("swiftshader_llvm_private_config") {
if (is_clang) { if (is_clang) {
cflags += [ cflags += [
"-msse2", "-msse2",
"-D__STDC_CONSTANT_MACROS",
"-D__STDC_LIMIT_MACROS",
"-Wno-unused-local-typedef", "-Wno-unused-local-typedef",
"-Wno-unused-private-field", "-Wno-unused-private-field",
"-Wno-null-dereference", "-Wno-null-dereference",
...@@ -62,6 +60,11 @@ config("swiftshader_llvm_private_config") { ...@@ -62,6 +60,11 @@ config("swiftshader_llvm_private_config") {
"-Wno-unused-variable", "-Wno-unused-variable",
"-Wno-unused-result", "-Wno-unused-result",
] ]
defines = [
"__STDC_CONSTANT_MACROS",
"__STDC_LIMIT_MACROS",
]
} }
} }
......
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