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 @@
# limitations under the License.
config("swiftshader_config") {
defines = [ "STRICT_CONFORMANCE" ] # Disables OpenGL ES 3.0
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
"/DSTRICT_CONFORMANCE", # Disables OpenGL ES 3.0
]
defines += [
"_CRT_SECURE_NO_DEPRECATE",
"NOMINMAX",
"_WINDLL",
]
if (is_debug) {
cflags += [ "/RTC1" ] # Run-Time Error Checks
} else {
cflags += [ "/DANGLE_DISABLE_TRACE" ]
defines += [ "ANGLE_DISABLE_TRACE" ]
}
} else {
cflags = [
......@@ -37,9 +41,11 @@ config("swiftshader_config") {
"-Wall",
"-fexceptions",
"-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) {
......@@ -53,11 +59,14 @@ config("swiftshader_config") {
"-ffunction-sections",
"-fdata-sections",
"-fomit-frame-pointer",
"-DANGLE_DISABLE_TRACE",
"-DNDEBUG",
"-O2",
"-Os",
]
defines += [
"ANGLE_DISABLE_TRACE",
"NDEBUG",
]
}
if (target_cpu == "x64") { # 64 bit version
......
......@@ -17,10 +17,8 @@ config("swiftshader_common_private_config") {
if (is_win) {
cflags = [ "/wd4201" ] # nameless struct/union
} else {
cflags = [
"-DLOG_TAG=\"swiftshader_common\"",
"-msse2",
]
cflags = [ "-msse2" ]
defines = [ "LOG_TAG=\"swiftshader_common\"" ]
}
}
......
......@@ -24,10 +24,8 @@ config("swiftshader_main_private_config") {
]
}
} else {
cflags = [
"-DLOG_TAG=\"swiftshader_main\"",
"-msse2",
]
cflags = [ "-msse2" ]
defines = [ "LOG_TAG=\"swiftshader_main\"" ]
}
}
......
......@@ -20,7 +20,7 @@ config("swiftshader_opengl_common_private_config") {
"/wd4324", # structure was padded due to alignment specifier
]
} else {
cflags = [ "-DLOG_TAG=\"swiftshader_opengl_common\"" ]
defines = [ "LOG_TAG=\"swiftshader_opengl_common\"" ]
}
}
......
......@@ -26,10 +26,8 @@ config("swiftshader_opengl_compiler_private_config") {
cflags += [ "/wd4189" ] # local variable is initialized but not referenced (variables only used in ASSERTS)
}
} else {
cflags = [
"-DLOG_TAG=\"swiftshader_opengl_compiler\"",
"-Wno-sign-compare",
]
cflags = [ "-Wno-sign-compare" ]
defines = [ "LOG_TAG=\"swiftshader_opengl_compiler\"" ]
if (!is_debug) {
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") {
"/wd4702", # unreachable code (in autogenerated code)
]
} else {
cflags = [ "-DLOG_TAG=\"swiftshader_opengl_compiler\"" ]
defines = [ "LOG_TAG=\"swiftshader_opengl_compiler\"" ]
}
}
......
......@@ -14,25 +14,26 @@
# Need a separate config to ensure the warnings are added to the end.
config("swiftshader_libEGL_private_config") {
defines = [ "EGL_EGLEXT_PROTOTYPES" ]
if (is_win) {
cflags = [
"/DEGLAPI=",
"/DEGL_EGLEXT_PROTOTYPES",
"/DLIBEGL_EXPORTS",
"/wd4201", # nameless struct/union
"/wd4065", # switch statement contains 'default' but no 'case' labels
]
} else {
cflags = [
"-DLOG_TAG=\"swiftshader_libEGL\"",
"-DEGL_EGLEXT_PROTOTYPES",
"-Wno-sign-compare",
defines += [
"EGLAPI=",
"LIBEGL_EXPORTS",
]
} else {
cflags = [ "-Wno-sign-compare" ]
defines += [ "LOG_TAG=\"swiftshader_libEGL\"" ]
if (is_linux) {
cflags += [ "-DGL_APICALL=__attribute__((visibility(\"protected\")))" ]
defines += [ "GL_APICALL=__attribute__((visibility(\"protected\")))" ]
} else {
cflags += [ "-DGL_APICALL=__attribute__((visibility(\"default\")))" ]
defines += [ "GL_APICALL=__attribute__((visibility(\"default\")))" ]
}
}
}
......
......@@ -14,36 +14,41 @@
# Need a separate config to ensure the warnings are added to the end.
config("swiftshader_libGLESv2_private_config") {
defines = [
"GL_API=",
"GL_GLEXT_PROTOTYPES",
]
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
]
defines += [
"GL_APICALL=",
"LIBGLESV2_EXPORTS",
]
if (is_clang) {
cflags += [
"-D__STDC_CONSTANT_MACROS",
"-D__STDC_LIMIT_MACROS",
defines += [
"__STDC_CONSTANT_MACROS",
"__STDC_LIMIT_MACROS",
]
}
} else {
cflags = [
"-DLOG_TAG=\"swiftshader_libGLESv2\"",
"-D__STDC_CONSTANT_MACROS",
"-D__STDC_LIMIT_MACROS",
"-DGL_API=",
"-DGL_GLEXT_PROTOTYPES",
"-Wno-sign-compare",
cflags = [ "-Wno-sign-compare" ]
defines += [
"LOG_TAG=\"swiftshader_libGLESv2\"",
"__STDC_CONSTANT_MACROS",
"__STDC_LIMIT_MACROS",
]
if (is_linux) {
cflags += [ "-DGL_APICALL=" ]
defines += [ "GL_APICALL=" ]
} else {
cflags += [ "-DGL_APICALL=__attribute__((visibility(\"default\")))" ]
defines += [ "GL_APICALL=__attribute__((visibility(\"default\")))" ]
}
}
}
......
......@@ -141,11 +141,14 @@ config("swiftshader_reactor_private_config") {
]
} else {
cflags = [
"-DLOG_TAG=\"swiftshader_reactor\"",
"-Wno-unused-local-typedef",
"-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") {
]
} else {
cflags = [
"-DLOG_TAG=\"swiftshader_renderer\"",
"-msse2",
"-Wno-sign-compare",
]
defines = [ "LOG_TAG=\"swiftshader_renderer\"" ]
}
}
......
......@@ -24,7 +24,7 @@ config("swiftshader_shader_private_config") {
cflags += [ "-Wno-sign-compare" ]
}
} else {
cflags = [ "-DLOG_TAG=\"swiftshader_shader\"" ]
defines = [ "LOG_TAG=\"swiftshader_shader\"" ]
}
}
......
......@@ -51,8 +51,6 @@ config("swiftshader_llvm_private_config") {
if (is_clang) {
cflags += [
"-msse2",
"-D__STDC_CONSTANT_MACROS",
"-D__STDC_LIMIT_MACROS",
"-Wno-unused-local-typedef",
"-Wno-unused-private-field",
"-Wno-null-dereference",
......@@ -62,6 +60,11 @@ config("swiftshader_llvm_private_config") {
"-Wno-unused-variable",
"-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