Commit a11d03e4 by Alexis Hetu Committed by Nicolas Capens

Update to Linux build files for Chromium

Although SwiftShader was building properly on the build bots, it wasn't exporting its symbols properly. I compared the flags used in the BUILD.gn files and in the CMakeLists.txt file and attempted to get both build systems to use the same flags and options. Change-Id: Idc73d4ad5b45311881e88720bf611e25110dcc70 Reviewed-on: https://swiftshader-review.googlesource.com/8576Tested-by: 's avatarAlexis Hétu <sugoi@google.com> Reviewed-by: 's avatarNicolas Capens <capn@google.com>
parent f8360baf
...@@ -31,10 +31,21 @@ config("swiftshader_config") { ...@@ -31,10 +31,21 @@ config("swiftshader_config") {
cflags += [ "/DANGLE_DISABLE_TRACE" ] cflags += [ "/DANGLE_DISABLE_TRACE" ]
} }
} else { } else {
cflags = [ "-std=c++11" ] cflags = [
"-std=c++11",
"-Wall",
"-fexceptions",
"-fvisibility=protected",
"-fno-operator-names",
"-D__STDC_CONSTANT_MACROS",
"-D__STDC_LIMIT_MACROS",
]
if (is_debug) { if (is_debug) {
cflags += [ "-g" ] cflags += [
"-g",
"-g3",
]
} 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 += [
...@@ -42,24 +53,30 @@ config("swiftshader_config") { ...@@ -42,24 +53,30 @@ config("swiftshader_config") {
"-fdata-sections", "-fdata-sections",
"-fomit-frame-pointer", "-fomit-frame-pointer",
"-DANGLE_DISABLE_TRACE", "-DANGLE_DISABLE_TRACE",
"-DNDEBUG",
"-O2",
"-Os",
] ]
# Choose the right Release architecture
if (target_cpu == "x64") {
cflags += [ "-march=core2" ]
} else { # 32
cflags += [ "-march=i686" ]
}
} }
if (target_cpu == "x64") { # 64 bit version if (target_cpu == "x64") { # 64 bit version
cflags += [ cflags += [
"-m64", "-m64",
"-fPIC", "-fPIC",
"-march=core2",
] ]
} else { # 32 bit version } else { # 32 bit version
cflags += [ "-m32" ] cflags += [
"-m32",
"-msse2",
"-march=i686",
]
} }
ldflags = [
"-Wl,--hash-style=both",
"-Wl,--gc-sections",
]
} }
} }
......
...@@ -25,7 +25,7 @@ config("swiftshader_libEGL_private_config") { ...@@ -25,7 +25,7 @@ config("swiftshader_libEGL_private_config") {
} else { } else {
cflags = [ cflags = [
"-DLOG_TAG=\"swiftshader_libEGL\"", "-DLOG_TAG=\"swiftshader_libEGL\"",
"-DEGLAPI=", "-DEGLAPI=__attribute__((visibility(\"protected\")))",
"-DEGL_EGLEXT_PROTOTYPES", "-DEGL_EGLEXT_PROTOTYPES",
"-Wno-sign-compare", "-Wno-sign-compare",
] ]
...@@ -70,6 +70,8 @@ shared_library("swiftshader_libEGL") { ...@@ -70,6 +70,8 @@ shared_library("swiftshader_libEGL") {
ldflags = [ "/DEF:" + rebase_path("libGLESv2.def", root_build_dir) ] ldflags = [ "/DEF:" + rebase_path("libGLESv2.def", root_build_dir) ]
} else if (is_linux) { } else if (is_linux) {
sources += [ "../../Main/libX11.cpp" ] sources += [ "../../Main/libX11.cpp" ]
ldflags =
[ "-Wl,--version-script=" + rebase_path("exports.map", root_build_dir) ]
} }
configs -= [ "//build/config/compiler:chromium_code" ] configs -= [ "//build/config/compiler:chromium_code" ]
......
...@@ -36,7 +36,7 @@ config("swiftshader_libGLESv2_private_config") { ...@@ -36,7 +36,7 @@ config("swiftshader_libGLESv2_private_config") {
"-D__STDC_CONSTANT_MACROS", "-D__STDC_CONSTANT_MACROS",
"-D__STDC_LIMIT_MACROS", "-D__STDC_LIMIT_MACROS",
"-DGL_API=", "-DGL_API=",
"-DGL_APICALL=", "-DGL_APICALL=__attribute__((visibility(\"protected\")))",
"-DGL_GLEXT_PROTOTYPES", "-DGL_GLEXT_PROTOTYPES",
"-Wno-sign-compare", "-Wno-sign-compare",
] ]
...@@ -83,6 +83,9 @@ shared_library("swiftshader_libGLESv2") { ...@@ -83,6 +83,9 @@ shared_library("swiftshader_libGLESv2") {
if (is_win) { if (is_win) {
configs -= [ "//build/config/win:unicode" ] configs -= [ "//build/config/win:unicode" ]
ldflags = [ "/DEF:" + rebase_path("libGLESv2.def", root_build_dir) ] ldflags = [ "/DEF:" + rebase_path("libGLESv2.def", root_build_dir) ]
} else if (is_linux) {
ldflags =
[ "-Wl,--version-script=" + rebase_path("exports.map", root_build_dir) ]
} }
configs -= [ "//build/config/compiler:chromium_code" ] configs -= [ "//build/config/compiler:chromium_code" ]
......
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