Commit 68f564d1 by Alexis Hetu Committed by Alexis Hétu

Update to BUILD.gn files

- Now compiles for all combinations of "component"/"not component", debug/release on Linux/Windows - Cleaned up dependencies - Added some Windows specific flags Change-Id: I09c2eaec096ac7f73fdd5b9ab0d407fa29369b4c Reviewed-on: https://swiftshader-review.googlesource.com/5785Tested-by: 's avatarAlexis Hétu <sugoi@google.com> Reviewed-by: 's avatarAlexis Hétu <sugoi@google.com>
parent cf83d168
...@@ -19,7 +19,7 @@ config("swiftshader_config") { ...@@ -19,7 +19,7 @@ config("swiftshader_config") {
] ]
if (is_debug) { if (is_debug) {
cflags += [ cflags += [
"-g", "-g",
] ]
} else { # Release } else { # Release
...@@ -27,10 +27,8 @@ config("swiftshader_config") { ...@@ -27,10 +27,8 @@ config("swiftshader_config") {
cflags += [ cflags += [
"-ffunction-sections", "-ffunction-sections",
"-fdata-sections", "-fdata-sections",
"-Wl",
"--gc-sections",
"-s",
"-fomit-frame-pointer", "-fomit-frame-pointer",
"-DANGLE_DISABLE_TRACE",
] ]
# Choose the right Release architecture # Choose the right Release architecture
...@@ -55,18 +53,35 @@ config("swiftshader_config") { ...@@ -55,18 +53,35 @@ 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",
]
}
}
} }
} }
component("swiftshader") { group("swiftshader") {
configs -= [ "//build/config/compiler:chromium_code" ]
configs += [
"//build/config/compiler:no_chromium_code",
":swiftshader_config",
]
deps = [ deps = [
"src/OpenGL/libEGL:swiftshader_libEGL",
"src/OpenGL/libGLESv2:swiftshader_libGLESv2", "src/OpenGL/libGLESv2:swiftshader_libGLESv2",
"src/OpenGL/libEGL:swiftshader_libEGL",
] ]
} }
\ No newline at end of file
...@@ -19,12 +19,6 @@ config("swiftshader_common_private_config") { ...@@ -19,12 +19,6 @@ config("swiftshader_common_private_config") {
"-DLOG_TAG=\"swiftshader_common\"", "-DLOG_TAG=\"swiftshader_common\"",
"-msse2", "-msse2",
] ]
if (!is_debug) {
cflags += [
"-DANGLE_DISABLE_TRACE",
]
}
} else { } else {
if (host_os == "win") { if (host_os == "win") {
cflags = [ cflags = [
......
...@@ -26,12 +26,6 @@ config("swiftshader_main_private_config") { ...@@ -26,12 +26,6 @@ config("swiftshader_main_private_config") {
] ]
} }
} }
if (!is_debug) {
cflags += [
"-DANGLE_DISABLE_TRACE",
]
}
} }
source_set("swiftshader_main") { source_set("swiftshader_main") {
......
...@@ -26,12 +26,6 @@ config("swiftshader_opengl_common_private_config") { ...@@ -26,12 +26,6 @@ config("swiftshader_opengl_common_private_config") {
] ]
} }
} }
if (!is_debug) {
cflags += [
"-DANGLE_DISABLE_TRACE",
]
}
} }
source_set("swiftshader_opengl_common") { source_set("swiftshader_opengl_common") {
......
...@@ -19,6 +19,12 @@ config("swiftshader_opengl_compiler_private_config") { ...@@ -19,6 +19,12 @@ config("swiftshader_opengl_compiler_private_config") {
"-DLOG_TAG=\"swiftshader_opengl_compiler\"", "-DLOG_TAG=\"swiftshader_opengl_compiler\"",
"-Wno-sign-compare", "-Wno-sign-compare",
] ]
if (!is_debug) {
cflags += [
"-Wno-unused-variable", # local variable is initialized but not referenced (variables only used in ASSERTS)
]
}
} else { } else {
if (host_os == "win") { if (host_os == "win") {
cflags = [ cflags = [
...@@ -27,13 +33,13 @@ config("swiftshader_opengl_compiler_private_config") { ...@@ -27,13 +33,13 @@ config("swiftshader_opengl_compiler_private_config") {
"/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 += [ cflags += [
"-DANGLE_DISABLE_TRACE", "/wd4189", # local variable is initialized but not referenced (variables only used in ASSERTS)
] ]
}
}
} }
} }
......
...@@ -27,12 +27,6 @@ config("swiftshader_opengl_preprocessor_private_config") { ...@@ -27,12 +27,6 @@ config("swiftshader_opengl_preprocessor_private_config") {
] ]
} }
} }
if (!is_debug) {
cflags += [
"-DANGLE_DISABLE_TRACE",
]
}
} }
source_set("swiftshader_opengl_preprocessor") { source_set("swiftshader_opengl_preprocessor") {
......
...@@ -26,39 +26,31 @@ config("swiftshader_libEGL_private_config") { ...@@ -26,39 +26,31 @@ config("swiftshader_libEGL_private_config") {
cflags = [ cflags = [
"/DEGLAPI=", "/DEGLAPI=",
"/DEGL_EGLEXT_PROTOTYPES", "/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
] ]
} }
} }
if (!is_debug) {
cflags += [
"-DANGLE_DISABLE_TRACE",
]
}
} }
shared_library("swiftshader_libEGL") { shared_library("swiftshader_libEGL") {
deps = [
"../../Common:swiftshader_common",
"../../Reactor:swiftshader_reactor",
"../../Renderer:swiftshader_renderer",
"../../OpenGL/common:swiftshader_opengl_common",
"../../OpenGL/compiler:swiftshader_opengl_compiler",
"../../Shader:swiftshader_shader",
"../../Main:swiftshader_main",
"../../../third_party/LLVM:swiftshader_llvm",
]
sources = [ sources = [
"Config.cpp", "Config.cpp",
"Display.cpp", "Display.cpp",
"Surface.cpp", "Surface.cpp",
"libEGL.cpp", "libEGL.cpp",
"main.cpp", "main.cpp",
"../common/Object.cpp",
] ]
if(is_debug)
{
sources += [
"../common/debug.cpp",
]
}
if (host_os == "mac") { if (host_os == "mac") {
sources += [ sources += [
"OSXUtils.mm", "OSXUtils.mm",
...@@ -67,9 +59,16 @@ shared_library("swiftshader_libEGL") { ...@@ -67,9 +59,16 @@ shared_library("swiftshader_libEGL") {
configs -= [ configs -= [
"//build/config/win:unicode" "//build/config/win:unicode"
] ]
} else if (host_os == "linux") {
sources += [
"../../Main/libX11.cpp",
]
} }
configs -= [ "//build/config/compiler:chromium_code" ]
configs += [ configs += [
"//build/config/compiler:no_chromium_code",
"//third_party/swiftshader:swiftshader_config",
":swiftshader_libEGL_private_config", ":swiftshader_libEGL_private_config",
] ]
......
...@@ -37,24 +37,13 @@ config("swiftshader_libGLESv2_private_config") { ...@@ -37,24 +37,13 @@ config("swiftshader_libGLESv2_private_config") {
] ]
} }
} }
if (!is_debug) {
cflags += [
"-DANGLE_DISABLE_TRACE",
]
}
} }
shared_library("swiftshader_libGLESv2") { shared_library("swiftshader_libGLESv2") {
deps = [ deps = [
"../../Common:swiftshader_common", "../../OpenGL/compiler:swiftshader_opengl_compiler",
"../../Reactor:swiftshader_reactor", "../../Reactor:swiftshader_reactor",
"../../Renderer:swiftshader_renderer", "../../Renderer:swiftshader_renderer",
"../../OpenGL/common:swiftshader_opengl_common",
"../../OpenGL/compiler:swiftshader_opengl_compiler",
"../../Shader:swiftshader_shader",
"../../Main:swiftshader_main",
"../../../third_party/LLVM:swiftshader_llvm",
] ]
sources = [ sources = [
...@@ -85,7 +74,10 @@ shared_library("swiftshader_libGLESv2") { ...@@ -85,7 +74,10 @@ shared_library("swiftshader_libGLESv2") {
] ]
} }
configs -= [ "//build/config/compiler:chromium_code" ]
configs += [ configs += [
"//build/config/compiler:no_chromium_code",
"//third_party/swiftshader:swiftshader_config",
":swiftshader_libGLESv2_private_config", ":swiftshader_libGLESv2_private_config",
] ]
......
...@@ -30,17 +30,11 @@ config("swiftshader_reactor_private_config") { ...@@ -30,17 +30,11 @@ config("swiftshader_reactor_private_config") {
] ]
} }
} }
if (!is_debug) {
cflags += [
"-DANGLE_DISABLE_TRACE",
]
}
} }
source_set("swiftshader_reactor") { source_set("swiftshader_reactor") {
deps = [ deps = [
"../Common:swiftshader_common", "../OpenGL/common:swiftshader_opengl_common",
"../../third_party/LLVM:swiftshader_llvm", "../../third_party/LLVM:swiftshader_llvm",
] ]
......
...@@ -29,19 +29,11 @@ config("swiftshader_renderer_private_config") { ...@@ -29,19 +29,11 @@ config("swiftshader_renderer_private_config") {
] ]
} }
} }
if (!is_debug) {
cflags += [
"-DANGLE_DISABLE_TRACE",
]
}
} }
source_set("swiftshader_renderer") { source_set("swiftshader_renderer") {
deps = [ deps = [
"../Common:swiftshader_common",
"../Shader:swiftshader_shader", "../Shader:swiftshader_shader",
"../Main:swiftshader_main",
] ]
sources = [ sources = [
......
...@@ -27,17 +27,10 @@ config("swiftshader_shader_private_config") { ...@@ -27,17 +27,10 @@ config("swiftshader_shader_private_config") {
] ]
} }
} }
if (!is_debug) {
cflags += [
"-DANGLE_DISABLE_TRACE",
]
}
} }
source_set("swiftshader_shader") { source_set("swiftshader_shader") {
deps = [ deps = [
"../Common:swiftshader_common",
"../Main:swiftshader_main", "../Main:swiftshader_main",
] ]
......
...@@ -47,6 +47,12 @@ config("swiftshader_llvm_private_config") { ...@@ -47,6 +47,12 @@ config("swiftshader_llvm_private_config") {
"/wd4706", "/wd4706",
"/wd4800", "/wd4800",
] ]
if (!is_debug) {
cflags += [
"/wd4324",
]
}
} }
} }
} }
...@@ -437,13 +443,24 @@ source_set("swiftshader_llvm") { ...@@ -437,13 +443,24 @@ source_set("swiftshader_llvm") {
] ]
include_dirs = [ include_dirs = [
"include",
"lib/Target/X86", "lib/Target/X86",
] ]
# The "include" directory includes common files and the Windows specific config file.
# The "include-<platform>" directory includes the <platform> specific config file.
# Non-Windows platforms must add their platform specific include directory before the "include" directory
# is added, otherwise, the Windows specific config file will be used and compilation will fail.
if (host_os == "linux") { if (host_os == "linux") {
include_dirs += [ include_dirs += [
"include-linux", "include-linux",
] ]
} else if (host_os == "mac") {
include_dirs += [
"include-mac",
]
} }
include_dirs += [
"include",
]
} }
\ 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