Commit d6d10f96 by Alexis Hetu Committed by Alexis Hétu

Fixed official chromium build on Linux

A warning treated as an error was causing the official build to fail. Added -Wno-unused-result to the LLVM build file to solve the issue. Also ran 'git cl format' on the BUILD.gn files to fix all formatting issues. Change-Id: I235c7d9d3e60f788e1dc694a40991c214e6c77e3 Reviewed-on: https://swiftshader-review.googlesource.com/8110Reviewed-by: 's avatarNicolas Capens <capn@google.com> Tested-by: 's avatarAlexis Hétu <sugoi@google.com>
parent b9dda64e
...@@ -15,18 +15,18 @@ ...@@ -15,18 +15,18 @@
config("swiftshader_config") { config("swiftshader_config") {
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", "/D_CRT_SECURE_NO_DEPRECATE",
"/DNOMINMAX", "/DNOMINMAX",
"/D_WINDLL", "/D_WINDLL",
"/EHsc", "/EHsc",
"/nologo", "/nologo",
"/Gd", # Default calling convention "/Gd", # Default calling convention
] ]
if (is_debug) { if (is_debug) {
cflags += [ "/RTC1" ] # Run-Time Error Checks cflags += [ "/RTC1" ] # Run-Time Error Checks
} else { } else {
cflags += [ "/DANGLE_DISABLE_TRACE" ] cflags += [ "/DANGLE_DISABLE_TRACE" ]
} }
...@@ -35,7 +35,7 @@ config("swiftshader_config") { ...@@ -35,7 +35,7 @@ config("swiftshader_config") {
if (is_debug) { if (is_debug) {
cflags += [ "-g" ] cflags += [ "-g" ]
} else { # Release } else { # Release
# All Release builds use function/data sections to make the shared libraries smaller # All Release builds use function/data sections to make the shared libraries smaller
cflags += [ cflags += [
"-ffunction-sections", "-ffunction-sections",
...@@ -47,17 +47,17 @@ config("swiftshader_config") { ...@@ -47,17 +47,17 @@ config("swiftshader_config") {
# Choose the right Release architecture # Choose the right Release architecture
if (target_cpu == "x64") { if (target_cpu == "x64") {
cflags += [ "-march=core2" ] cflags += [ "-march=core2" ]
} else { # 32 } else { # 32
cflags += [ "-march=i686" ] cflags += [ "-march=i686" ]
} }
} }
if (target_cpu == "x64") { # 64 bit version if (target_cpu == "x64") { # 64 bit version
cflags += [ cflags += [
"-m64", "-m64",
"-fPIC", "-fPIC",
] ]
} else { # 32 bit version } else { # 32 bit version
cflags += [ "-m32" ] cflags += [ "-m32" ]
} }
} }
...@@ -76,4 +76,4 @@ group("swiftshader_tests") { ...@@ -76,4 +76,4 @@ group("swiftshader_tests") {
data_deps = [ data_deps = [
"tests/unittests:swiftshader_unittests", "tests/unittests:swiftshader_unittests",
] ]
} }
\ No newline at end of file
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
# 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_win) { if (is_win) {
cflags = [ "/wd4201" ] # nameless struct/union cflags = [ "/wd4201" ] # nameless struct/union
} else { } else {
cflags = [ cflags = [
"-DLOG_TAG=\"swiftshader_common\"", "-DLOG_TAG=\"swiftshader_common\"",
...@@ -39,4 +39,4 @@ source_set("swiftshader_common") { ...@@ -39,4 +39,4 @@ source_set("swiftshader_common") {
] ]
configs += [ ":swiftshader_common_private_config" ] configs += [ ":swiftshader_common_private_config" ]
} }
\ No newline at end of file
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
# 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_win) { if (is_win) {
cflags = [ "/wd4201" ] # nameless struct/union cflags = [ "/wd4201" ] # nameless struct/union
if (is_clang) { if (is_clang) {
cflags += [ cflags += [
...@@ -32,7 +32,9 @@ config("swiftshader_main_private_config") { ...@@ -32,7 +32,9 @@ config("swiftshader_main_private_config") {
} }
source_set("swiftshader_main") { source_set("swiftshader_main") {
deps = [ "../Common:swiftshader_common" ] deps = [
"../Common:swiftshader_common",
]
sources = [ sources = [
"Config.cpp", "Config.cpp",
...@@ -42,8 +44,8 @@ source_set("swiftshader_main") { ...@@ -42,8 +44,8 @@ source_set("swiftshader_main") {
if (is_linux) { if (is_linux) {
sources += [ sources += [
"libX11.cpp",
"FrameBufferX11.cpp", "FrameBufferX11.cpp",
"libX11.cpp",
] ]
} else if (is_mac) { } else if (is_mac) {
sources += [ "FrameBufferOSX.mm" ] sources += [ "FrameBufferOSX.mm" ]
...@@ -57,8 +59,9 @@ source_set("swiftshader_main") { ...@@ -57,8 +59,9 @@ source_set("swiftshader_main") {
if (is_win) { if (is_win) {
configs -= [ "//build/config/win:unicode" ] configs -= [ "//build/config/win:unicode" ]
libs = [ "dxguid.lib" ] # For FrameBufferDD libs = [ "dxguid.lib" ] # For FrameBufferDD
} }
configs += [ ":swiftshader_main_private_config" ] configs += [ ":swiftshader_main_private_config" ]
include_dirs = [ include_dirs = [
...@@ -70,7 +73,7 @@ source_set("swiftshader_main") { ...@@ -70,7 +73,7 @@ source_set("swiftshader_main") {
include_dirs += [ "../../include" ] include_dirs += [ "../../include" ]
libs = [ libs = [
"Quartz.framework", "Quartz.framework",
"Cocoa.framework" "Cocoa.framework",
] ]
} }
} }
\ No newline at end of file
...@@ -16,8 +16,8 @@ ...@@ -16,8 +16,8 @@
config("swiftshader_opengl_common_private_config") { config("swiftshader_opengl_common_private_config") {
if (is_win) { if (is_win) {
cflags = [ cflags = [
"/wd4201", # nameless struct/union "/wd4201", # nameless struct/union
"/wd4324", # structure was padded due to alignment specifier "/wd4324", # structure was padded due to alignment specifier
] ]
} else { } else {
cflags = [ "-DLOG_TAG=\"swiftshader_opengl_common\"" ] cflags = [ "-DLOG_TAG=\"swiftshader_opengl_common\"" ]
...@@ -26,10 +26,10 @@ config("swiftshader_opengl_common_private_config") { ...@@ -26,10 +26,10 @@ config("swiftshader_opengl_common_private_config") {
source_set("swiftshader_opengl_common") { source_set("swiftshader_opengl_common") {
sources = [ sources = [
"debug.cpp",
"Image.cpp", "Image.cpp",
"Object.cpp",
"MatrixStack.cpp", "MatrixStack.cpp",
"Object.cpp",
"debug.cpp",
] ]
configs += [ ":swiftshader_opengl_common_private_config" ] configs += [ ":swiftshader_opengl_common_private_config" ]
...@@ -39,4 +39,4 @@ source_set("swiftshader_opengl_common") { ...@@ -39,4 +39,4 @@ source_set("swiftshader_opengl_common") {
"../..", "../..",
"../../../include", "../../../include",
] ]
} }
\ No newline at end of file
...@@ -16,14 +16,14 @@ ...@@ -16,14 +16,14 @@
config("swiftshader_opengl_compiler_private_config") { config("swiftshader_opengl_compiler_private_config") {
if (is_win) { if (is_win) {
cflags = [ cflags = [
"/wd4005", # macro redefinition (in autogenerated code) "/wd4005", # macro redefinition (in autogenerated code)
"/wd4201", # nameless struct/union "/wd4201", # nameless struct/union
"/wd4267", # conversion from size_t to int/unsigned int "/wd4267", # conversion from size_t to int/unsigned int
"/wd4702", # unreachable code (in autogenerated code) "/wd4702", # unreachable code (in autogenerated code)
] ]
if (!is_debug) { 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)
} }
} else { } else {
cflags = [ cflags = [
...@@ -32,38 +32,40 @@ config("swiftshader_opengl_compiler_private_config") { ...@@ -32,38 +32,40 @@ config("swiftshader_opengl_compiler_private_config") {
] ]
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)
} }
} }
} }
source_set("swiftshader_opengl_compiler") { source_set("swiftshader_opengl_compiler") {
deps = [ "preprocessor:swiftshader_opengl_preprocessor" ] deps = [
"preprocessor:swiftshader_opengl_preprocessor",
]
sources = [ sources = [
"AnalyzeCallDepth.cpp", "AnalyzeCallDepth.cpp",
"Compiler.cpp", "Compiler.cpp",
"debug.cpp",
"Diagnostics.cpp", "Diagnostics.cpp",
"DirectiveHandler.cpp", "DirectiveHandler.cpp",
"glslang_lex.cpp",
"glslang_tab.cpp",
"InfoSink.cpp", "InfoSink.cpp",
"Initialize.cpp", "Initialize.cpp",
"InitializeParseContext.cpp", "InitializeParseContext.cpp",
"IntermTraverse.cpp", "IntermTraverse.cpp",
"Intermediate.cpp", "Intermediate.cpp",
"intermOut.cpp",
"OutputASM.cpp", "OutputASM.cpp",
"parseConst.cpp",
"ParseHelper.cpp", "ParseHelper.cpp",
"PoolAlloc.cpp", "PoolAlloc.cpp",
"SymbolTable.cpp", "SymbolTable.cpp",
"TranslatorASM.cpp", "TranslatorASM.cpp",
"util.cpp",
"ValidateGlobalInitializer.cpp", "ValidateGlobalInitializer.cpp",
"ValidateLimitations.cpp", "ValidateLimitations.cpp",
"ValidateSwitch.cpp", "ValidateSwitch.cpp",
"debug.cpp",
"glslang_lex.cpp",
"glslang_tab.cpp",
"intermOut.cpp",
"parseConst.cpp",
"util.cpp",
] ]
if (is_linux || is_mac) { if (is_linux || is_mac) {
...@@ -79,4 +81,4 @@ source_set("swiftshader_opengl_compiler") { ...@@ -79,4 +81,4 @@ source_set("swiftshader_opengl_compiler") {
"../..", "../..",
"../../../include", "../../../include",
] ]
} }
\ No newline at end of file
...@@ -16,14 +16,12 @@ ...@@ -16,14 +16,12 @@
config("swiftshader_opengl_preprocessor_private_config") { config("swiftshader_opengl_preprocessor_private_config") {
if (is_win) { if (is_win) {
cflags = [ cflags = [
"/wd4005", # macro redefinition (in autogenerated code) "/wd4005", # macro redefinition (in autogenerated code)
"/wd4267", # conversion from size_t to int/unsigned int (in autogenerated code) "/wd4267", # conversion from size_t to int/unsigned int (in autogenerated code)
"/wd4702", # unreachable code (in autogenerated code) "/wd4702", # unreachable code (in autogenerated code)
] ]
} else { } else {
cflags = [ cflags = [ "-DLOG_TAG=\"swiftshader_opengl_compiler\"" ]
"-DLOG_TAG=\"swiftshader_opengl_compiler\"",
]
} }
} }
...@@ -42,7 +40,5 @@ source_set("swiftshader_opengl_preprocessor") { ...@@ -42,7 +40,5 @@ source_set("swiftshader_opengl_preprocessor") {
"Tokenizer.cpp", "Tokenizer.cpp",
] ]
configs += [ configs += [ ":swiftshader_opengl_preprocessor_private_config" ]
":swiftshader_opengl_preprocessor_private_config", }
]
}
\ No newline at end of file
...@@ -19,8 +19,8 @@ config("swiftshader_libEGL_private_config") { ...@@ -19,8 +19,8 @@ config("swiftshader_libEGL_private_config") {
"/DEGLAPI=", "/DEGLAPI=",
"/DEGL_EGLEXT_PROTOTYPES", "/DEGL_EGLEXT_PROTOTYPES",
"/DLIBEGL_EXPORTS", "/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 { } else {
cflags = [ cflags = [
...@@ -39,18 +39,18 @@ shared_library("swiftshader_libEGL") { ...@@ -39,18 +39,18 @@ shared_library("swiftshader_libEGL") {
} }
sources = [ sources = [
"../common/Object.cpp",
"Config.cpp", "Config.cpp",
"Display.cpp", "Display.cpp",
"Surface.cpp", "Surface.cpp",
"libEGL.cpp", "libEGL.cpp",
"main.cpp",
"../common/Object.cpp",
"libEGL.def", "libEGL.def",
"libEGL.rc", "libEGL.rc",
"main.cpp",
"resource.h", "resource.h",
] ]
if(is_debug) { if (is_debug) {
sources += [ "../common/debug.cpp" ] sources += [ "../common/debug.cpp" ]
} }
...@@ -79,4 +79,4 @@ shared_library("swiftshader_libEGL") { ...@@ -79,4 +79,4 @@ shared_library("swiftshader_libEGL") {
"../..", "../..",
"..", "..",
] ]
} }
\ No newline at end of file
...@@ -20,12 +20,11 @@ config("swiftshader_libGLESv2_private_config") { ...@@ -20,12 +20,11 @@ config("swiftshader_libGLESv2_private_config") {
"/DGL_APICALL=", "/DGL_APICALL=",
"/DGL_GLEXT_PROTOTYPES", "/DGL_GLEXT_PROTOTYPES",
"/DLIBGLESV2_EXPORTS", "/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
] ]
if (is_clang) if (is_clang) {
{
cflags += [ cflags += [
"-D__STDC_CONSTANT_MACROS", "-D__STDC_CONSTANT_MACROS",
"-D__STDC_LIMIT_MACROS", "-D__STDC_LIMIT_MACROS",
...@@ -63,9 +62,6 @@ shared_library("swiftshader_libGLESv2") { ...@@ -63,9 +62,6 @@ shared_library("swiftshader_libGLESv2") {
"Fence.cpp", "Fence.cpp",
"Framebuffer.cpp", "Framebuffer.cpp",
"IndexDataManager.cpp", "IndexDataManager.cpp",
"libGLESv2.cpp",
"libGLESv3.cpp",
"main.cpp",
"Program.cpp", "Program.cpp",
"Query.cpp", "Query.cpp",
"Renderbuffer.cpp", "Renderbuffer.cpp",
...@@ -73,12 +69,15 @@ shared_library("swiftshader_libGLESv2") { ...@@ -73,12 +69,15 @@ shared_library("swiftshader_libGLESv2") {
"Shader.cpp", "Shader.cpp",
"Texture.cpp", "Texture.cpp",
"TransformFeedback.cpp", "TransformFeedback.cpp",
"utilities.cpp",
"VertexArray.cpp", "VertexArray.cpp",
"VertexDataManager.cpp", "VertexDataManager.cpp",
"libGLESv2.cpp",
"libGLESv2.def", "libGLESv2.def",
"libGLESv2.rc", "libGLESv2.rc",
"libGLESv3.cpp",
"main.cpp",
"resource.h", "resource.h",
"utilities.cpp",
] ]
if (is_win) { if (is_win) {
...@@ -98,4 +97,4 @@ shared_library("swiftshader_libGLESv2") { ...@@ -98,4 +97,4 @@ shared_library("swiftshader_libGLESv2") {
"../..", "../..",
"..", "..",
] ]
} }
\ No newline at end of file
...@@ -16,8 +16,8 @@ ...@@ -16,8 +16,8 @@
config("swiftshader_reactor_private_config") { config("swiftshader_reactor_private_config") {
if (is_win) { if (is_win) {
cflags = [ cflags = [
"/wd4201", # nameless struct/union "/wd4201", # nameless struct/union
"/wd4245", # conversion from int to unsigned int (llvm) "/wd4245", # conversion from int to unsigned int (llvm)
] ]
} else { } else {
cflags = [ cflags = [
...@@ -32,15 +32,15 @@ config("swiftshader_reactor_private_config") { ...@@ -32,15 +32,15 @@ config("swiftshader_reactor_private_config") {
source_set("swiftshader_reactor") { source_set("swiftshader_reactor") {
deps = [ deps = [
"../OpenGL/common:swiftshader_opengl_common",
"../../third_party/LLVM:swiftshader_llvm", "../../third_party/LLVM:swiftshader_llvm",
"../OpenGL/common:swiftshader_opengl_common",
] ]
sources = [ sources = [
"LLVMReactor.cpp", "LLVMReactor.cpp",
"Routine.cpp",
"LLVMRoutine.cpp", "LLVMRoutine.cpp",
"LLVMRoutineManager.cpp", "LLVMRoutineManager.cpp",
"Routine.cpp",
] ]
if (is_win) { if (is_win) {
...@@ -54,4 +54,4 @@ source_set("swiftshader_reactor") { ...@@ -54,4 +54,4 @@ source_set("swiftshader_reactor") {
"../Common", "../Common",
"../../third_party/LLVM/include/", "../../third_party/LLVM/include/",
] ]
} }
\ No newline at end of file
...@@ -16,8 +16,8 @@ ...@@ -16,8 +16,8 @@
config("swiftshader_renderer_private_config") { config("swiftshader_renderer_private_config") {
if (is_win) { if (is_win) {
cflags = [ cflags = [
"/wd4201", # nameless struct/union "/wd4201", # nameless struct/union
"/wd4324", # structure was padded due to alignment specifier "/wd4324", # structure was padded due to alignment specifier
] ]
} else { } else {
cflags = [ cflags = [
...@@ -29,7 +29,9 @@ config("swiftshader_renderer_private_config") { ...@@ -29,7 +29,9 @@ config("swiftshader_renderer_private_config") {
} }
source_set("swiftshader_renderer") { source_set("swiftshader_renderer") {
deps = [ "../Shader:swiftshader_shader" ] deps = [
"../Shader:swiftshader_shader",
]
sources = [ sources = [
"Blitter.cpp", "Blitter.cpp",
...@@ -64,4 +66,4 @@ source_set("swiftshader_renderer") { ...@@ -64,4 +66,4 @@ source_set("swiftshader_renderer") {
"../Main", "../Main",
"../Shader", "../Shader",
] ]
} }
\ No newline at end of file
...@@ -16,14 +16,12 @@ ...@@ -16,14 +16,12 @@
config("swiftshader_shader_private_config") { config("swiftshader_shader_private_config") {
if (is_win) { if (is_win) {
cflags = [ cflags = [
"/wd4201", # nameless struct/union "/wd4201", # nameless struct/union
"/wd4324", # structure was padded due to alignment specifier "/wd4324", # structure was padded due to alignment specifier
] ]
if (is_clang) { if (is_clang) {
cflags += [ cflags += [ "-Wno-sign-compare" ]
"-Wno-sign-compare",
]
} }
} else { } else {
cflags = [ "-DLOG_TAG=\"swiftshader_shader\"" ] cflags = [ "-DLOG_TAG=\"swiftshader_shader\"" ]
...@@ -31,7 +29,9 @@ config("swiftshader_shader_private_config") { ...@@ -31,7 +29,9 @@ config("swiftshader_shader_private_config") {
} }
source_set("swiftshader_shader") { source_set("swiftshader_shader") {
deps = [ "../Main:swiftshader_main" ] deps = [
"../Main:swiftshader_main",
]
sources = [ sources = [
"Constants.cpp", "Constants.cpp",
...@@ -58,4 +58,4 @@ source_set("swiftshader_shader") { ...@@ -58,4 +58,4 @@ source_set("swiftshader_shader") {
"../Main", "../Main",
"../Renderer", "../Renderer",
] ]
} }
\ No newline at end of file
...@@ -15,10 +15,13 @@ ...@@ -15,10 +15,13 @@
import("//testing/test.gni") import("//testing/test.gni")
test("swiftshader_unittests") { test("swiftshader_unittests") {
deps = [ deps = [
"../../src/OpenGL/libGLESv2:swiftshader_libGLESv2",
"../../src/OpenGL/libEGL:swiftshader_libEGL", "../../src/OpenGL/libEGL:swiftshader_libEGL",
"../../src/OpenGL/libGLESv2:swiftshader_libGLESv2",
"//testing/gtest", "//testing/gtest",
] ]
sources = [ "main.cpp" ]
sources = [
"main.cpp",
]
} }
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