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") {
]
if (is_debug) {
cflags += [
cflags += [
"-g",
]
} else { # Release
......@@ -27,10 +27,8 @@ config("swiftshader_config") {
cflags += [
"-ffunction-sections",
"-fdata-sections",
"-Wl",
"--gc-sections",
"-s",
"-fomit-frame-pointer",
"-DANGLE_DISABLE_TRACE",
]
# Choose the right Release architecture
......@@ -55,18 +53,35 @@ config("swiftshader_config") {
"-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") {
configs -= [ "//build/config/compiler:chromium_code" ]
configs += [
"//build/config/compiler:no_chromium_code",
":swiftshader_config",
]
group("swiftshader") {
deps = [
"src/OpenGL/libEGL:swiftshader_libEGL",
"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") {
"-DLOG_TAG=\"swiftshader_common\"",
"-msse2",
]
if (!is_debug) {
cflags += [
"-DANGLE_DISABLE_TRACE",
]
}
} else {
if (host_os == "win") {
cflags = [
......
......@@ -26,12 +26,6 @@ config("swiftshader_main_private_config") {
]
}
}
if (!is_debug) {
cflags += [
"-DANGLE_DISABLE_TRACE",
]
}
}
source_set("swiftshader_main") {
......
......@@ -26,12 +26,6 @@ config("swiftshader_opengl_common_private_config") {
]
}
}
if (!is_debug) {
cflags += [
"-DANGLE_DISABLE_TRACE",
]
}
}
source_set("swiftshader_opengl_common") {
......
......@@ -19,6 +19,12 @@ config("swiftshader_opengl_compiler_private_config") {
"-DLOG_TAG=\"swiftshader_opengl_compiler\"",
"-Wno-sign-compare",
]
if (!is_debug) {
cflags += [
"-Wno-unused-variable", # local variable is initialized but not referenced (variables only used in ASSERTS)
]
}
} else {
if (host_os == "win") {
cflags = [
......@@ -27,13 +33,13 @@ config("swiftshader_opengl_compiler_private_config") {
"/wd4267", # conversion from size_t to int/unsigned int
"/wd4702", # unreachable code (in autogenerated code)
]
}
}
if (!is_debug) {
cflags += [
"-DANGLE_DISABLE_TRACE",
]
if (!is_debug) {
cflags += [
"/wd4189", # local variable is initialized but not referenced (variables only used in ASSERTS)
]
}
}
}
}
......
......@@ -27,12 +27,6 @@ config("swiftshader_opengl_preprocessor_private_config") {
]
}
}
if (!is_debug) {
cflags += [
"-DANGLE_DISABLE_TRACE",
]
}
}
source_set("swiftshader_opengl_preprocessor") {
......
......@@ -26,39 +26,31 @@ config("swiftshader_libEGL_private_config") {
cflags = [
"/DEGLAPI=",
"/DEGL_EGLEXT_PROTOTYPES",
"/DLIBEGL_EXPORTS",
"/wd4201", # nameless struct/union
"/wd4065", # switch statement contains 'default' but no 'case' labels
]
}
}
if (!is_debug) {
cflags += [
"-DANGLE_DISABLE_TRACE",
]
}
}
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 = [
"Config.cpp",
"Display.cpp",
"Surface.cpp",
"libEGL.cpp",
"main.cpp",
"../common/Object.cpp",
]
if(is_debug)
{
sources += [
"../common/debug.cpp",
]
}
if (host_os == "mac") {
sources += [
"OSXUtils.mm",
......@@ -67,9 +59,16 @@ shared_library("swiftshader_libEGL") {
configs -= [
"//build/config/win:unicode"
]
} else if (host_os == "linux") {
sources += [
"../../Main/libX11.cpp",
]
}
configs -= [ "//build/config/compiler:chromium_code" ]
configs += [
"//build/config/compiler:no_chromium_code",
"//third_party/swiftshader:swiftshader_config",
":swiftshader_libEGL_private_config",
]
......
......@@ -37,24 +37,13 @@ config("swiftshader_libGLESv2_private_config") {
]
}
}
if (!is_debug) {
cflags += [
"-DANGLE_DISABLE_TRACE",
]
}
}
shared_library("swiftshader_libGLESv2") {
deps = [
"../../Common:swiftshader_common",
"../../OpenGL/compiler:swiftshader_opengl_compiler",
"../../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 = [
......@@ -85,7 +74,10 @@ shared_library("swiftshader_libGLESv2") {
]
}
configs -= [ "//build/config/compiler:chromium_code" ]
configs += [
"//build/config/compiler:no_chromium_code",
"//third_party/swiftshader:swiftshader_config",
":swiftshader_libGLESv2_private_config",
]
......
......@@ -30,17 +30,11 @@ config("swiftshader_reactor_private_config") {
]
}
}
if (!is_debug) {
cflags += [
"-DANGLE_DISABLE_TRACE",
]
}
}
source_set("swiftshader_reactor") {
deps = [
"../Common:swiftshader_common",
"../OpenGL/common:swiftshader_opengl_common",
"../../third_party/LLVM:swiftshader_llvm",
]
......
......@@ -29,19 +29,11 @@ config("swiftshader_renderer_private_config") {
]
}
}
if (!is_debug) {
cflags += [
"-DANGLE_DISABLE_TRACE",
]
}
}
source_set("swiftshader_renderer") {
deps = [
"../Common:swiftshader_common",
"../Shader:swiftshader_shader",
"../Main:swiftshader_main",
]
sources = [
......
......@@ -27,17 +27,10 @@ config("swiftshader_shader_private_config") {
]
}
}
if (!is_debug) {
cflags += [
"-DANGLE_DISABLE_TRACE",
]
}
}
source_set("swiftshader_shader") {
deps = [
"../Common:swiftshader_common",
"../Main:swiftshader_main",
]
......
......@@ -47,6 +47,12 @@ config("swiftshader_llvm_private_config") {
"/wd4706",
"/wd4800",
]
if (!is_debug) {
cflags += [
"/wd4324",
]
}
}
}
}
......@@ -437,13 +443,24 @@ source_set("swiftshader_llvm") {
]
include_dirs = [
"include",
"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") {
include_dirs += [
"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