Commit 8be41107 by Alexis Hetu Committed by Alexis Hétu

Made SwiftShader compile on Mac in Chromium

Fixed a few things in the BUILD.gn files: 1) Style guide mentions single entries should be on single lines 2) Changed "host_os == ..." for the is_... equivalent values 3) Added missing Mac libs and include dirs Change-Id: I28d35fd86a8cf9c9157a397370a385fe3e5e958b Reviewed-on: https://swiftshader-review.googlesource.com/7152Tested-by: 's avatarAlexis Hétu <sugoi@google.com> Reviewed-by: 's avatarNicolas Capens <capn@google.com>
parent cf3cd8d6
......@@ -26,23 +26,15 @@ config("swiftshader_config") {
]
if (is_debug) {
cflags += [
"/RTC1", # Run-Time Error Checks
]
cflags += [ "/RTC1" ] # Run-Time Error Checks
} else {
cflags += [
"/DANGLE_DISABLE_TRACE",
]
cflags += [ "/DANGLE_DISABLE_TRACE" ]
}
} else {
cflags = [
"-std=c++11",
]
cflags = [ "-std=c++11" ]
if (is_debug) {
cflags += [
"-g",
]
cflags += [ "-g" ]
} else { # Release
# All Release builds use function/data sections to make the shared libraries smaller
cflags += [
......@@ -54,13 +46,9 @@ config("swiftshader_config") {
# Choose the right Release architecture
if (target_cpu == "x64") {
cflags += [
"-march=core2",
]
cflags += [ "-march=core2" ]
} else { # 32
cflags += [
"-march=i686",
]
cflags += [ "-march=i686" ]
}
}
......@@ -70,9 +58,7 @@ config("swiftshader_config") {
"-fPIC",
]
} else { # 32 bit version
cflags += [
"-m32",
]
cflags += [ "-m32" ]
}
}
}
......
......@@ -15,9 +15,7 @@
# Need a separate config to ensure the warnings are added to the end.
config("swiftshader_common_private_config") {
if (is_win) {
cflags = [
"/wd4201", # nameless struct/union
]
cflags = [ "/wd4201" ] # nameless struct/union
} else {
cflags = [
"-DLOG_TAG=\"swiftshader_common\"",
......@@ -40,7 +38,5 @@ source_set("swiftshader_common") {
"Timer.cpp",
]
configs += [
":swiftshader_common_private_config",
]
configs += [ ":swiftshader_common_private_config" ]
}
\ No newline at end of file
......@@ -15,9 +15,7 @@
# Need a separate config to ensure the warnings are added to the end.
config("swiftshader_main_private_config") {
if (is_win) {
cflags = [
"/wd4201", # nameless struct/union
]
cflags = [ "/wd4201" ] # nameless struct/union
if (is_clang) {
cflags += [
......@@ -35,9 +33,7 @@ config("swiftshader_main_private_config") {
}
source_set("swiftshader_main") {
deps = [
"../Common:swiftshader_common",
]
deps = [ "../Common:swiftshader_common" ]
sources = [
"Config.cpp",
......@@ -45,16 +41,14 @@ source_set("swiftshader_main") {
"SwiftConfig.cpp",
]
if (host_os == "linux") {
if (is_linux) {
sources += [
"libX11.cpp",
"FrameBufferX11.cpp",
]
} else if (host_os == "mac") {
sources += [
"FrameBufferOSX.mm",
]
} else if (host_os == "win") {
} else if (is_mac) {
sources += [ "FrameBufferOSX.mm" ]
} else if (is_win) {
sources += [
"FrameBufferDD.cpp",
"FrameBufferGDI.cpp",
......@@ -62,20 +56,22 @@ source_set("swiftshader_main") {
]
}
if (host_os == "win") {
configs -= [
"//build/config/win:unicode"
]
libs = [
"dxguid.lib" # For FrameBufferDD
]
if (is_win) {
configs -= [ "//build/config/win:unicode" ]
libs = [ "dxguid.lib" ] # For FrameBufferDD
}
configs += [
":swiftshader_main_private_config",
]
configs += [ ":swiftshader_main_private_config" ]
include_dirs = [
"..",
"../Common",
]
if (is_mac) {
include_dirs += [ "../../include" ]
libs = [
"Quartz.framework",
"Cocoa.framework"
]
}
}
\ No newline at end of file
......@@ -21,14 +21,10 @@ config("swiftshader_opengl_common_private_config") {
]
if (is_clang) {
cflags += [
"-Wno-delete-incomplete",
]
cflags += [ "-Wno-delete-incomplete" ]
}
} else {
cflags = [
"-DLOG_TAG=\"swiftshader_opengl_common\"",
]
cflags = [ "-DLOG_TAG=\"swiftshader_opengl_common\"" ]
}
}
......@@ -40,9 +36,7 @@ source_set("swiftshader_opengl_common") {
"MatrixStack.cpp",
]
configs += [
":swiftshader_opengl_common_private_config",
]
configs += [ ":swiftshader_opengl_common_private_config" ]
include_dirs = [
"..",
......
......@@ -23,9 +23,7 @@ config("swiftshader_opengl_compiler_private_config") {
]
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)
}
if (is_clang) {
......@@ -41,17 +39,13 @@ config("swiftshader_opengl_compiler_private_config") {
]
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") {
deps = [
"preprocessor:swiftshader_opengl_preprocessor",
]
deps = [ "preprocessor:swiftshader_opengl_preprocessor" ]
sources = [
"AnalyzeCallDepth.cpp",
......@@ -79,19 +73,13 @@ source_set("swiftshader_opengl_compiler") {
"ValidateSwitch.cpp",
]
if ((host_os == "linux") || (host_os == "mac")) {
sources += [
"ossource_posix.cpp",
]
} else if (host_os == "win") {
sources += [
"ossource_win.cpp",
]
if (is_linux || is_mac) {
sources += [ "ossource_posix.cpp" ]
} else if (is_win) {
sources += [ "ossource_win.cpp" ]
}
configs += [
":swiftshader_opengl_compiler_private_config",
]
configs += [ ":swiftshader_opengl_compiler_private_config" ]
include_dirs = [
"..",
......
......@@ -24,9 +24,7 @@ config("swiftshader_libEGL_private_config") {
]
if (is_clang) {
cflags += [
"-Wno-unused-function",
]
cflags += [ "-Wno-unused-function" ]
}
} else {
cflags = [
......@@ -54,29 +52,21 @@ shared_library("swiftshader_libEGL") {
"resource.h",
]
if(is_debug)
{
sources += [
"../common/debug.cpp",
]
if(is_debug) {
sources += [ "../common/debug.cpp" ]
}
if (host_os == "mac") {
sources += [
"OSXUtils.mm",
]
} else if (host_os == "win") {
configs -= [
"//build/config/win:unicode"
]
ldflags = [
"/DEF:" + rebase_path("libGLESv2.def", root_build_dir),
]
} else if (host_os == "linux") {
sources += [
"../../Main/libX11.cpp",
if (is_mac) {
sources += [ "OSXUtils.mm" ]
libs = [
"Quartz.framework",
"Cocoa.framework",
]
} else if (is_win) {
configs -= [ "//build/config/win:unicode" ]
ldflags = [ "/DEF:" + rebase_path("libGLESv2.def", root_build_dir) ]
} else if (is_linux) {
sources += [ "../../Main/libX11.cpp" ]
}
configs -= [ "//build/config/compiler:chromium_code" ]
......
......@@ -80,14 +80,9 @@ shared_library("swiftshader_libGLESv2") {
"resource.h",
]
if (host_os == "win") {
configs -= [
"//build/config/win:unicode"
]
ldflags = [
"/DEF:" + rebase_path("libGLESv2.def", root_build_dir),
]
if (is_win) {
configs -= [ "//build/config/win:unicode" ]
ldflags = [ "/DEF:" + rebase_path("libGLESv2.def", root_build_dir) ]
}
configs -= [ "//build/config/compiler:chromium_code" ]
......
......@@ -21,9 +21,7 @@ config("swiftshader_reactor_private_config") {
]
if (is_clang) {
cflags += [
"-Wno-delete-incomplete",
]
cflags += [ "-Wno-delete-incomplete" ]
}
} else {
cflags = [
......@@ -48,18 +46,12 @@ source_set("swiftshader_reactor") {
"RoutineManager.cpp",
]
if (host_os == "win") {
sources += [
"DLL.cpp",
]
configs -= [
"//build/config/win:unicode"
]
if (is_win) {
sources += [ "DLL.cpp" ]
configs -= [ "//build/config/win:unicode" ]
}
configs += [
":swiftshader_reactor_private_config",
]
configs += [ ":swiftshader_reactor_private_config" ]
include_dirs = [
"..",
......
......@@ -36,9 +36,7 @@ config("swiftshader_renderer_private_config") {
}
source_set("swiftshader_renderer") {
deps = [
"../Shader:swiftshader_shader",
]
deps = [ "../Shader:swiftshader_shader" ]
sources = [
"Blitter.cpp",
......@@ -60,15 +58,11 @@ source_set("swiftshader_renderer") {
"VertexProcessor.cpp",
]
if (host_os == "win") {
configs -= [
"//build/config/win:unicode"
]
if (is_win) {
configs -= [ "//build/config/win:unicode" ]
}
configs += [
":swiftshader_renderer_private_config",
]
configs += [ ":swiftshader_renderer_private_config" ]
include_dirs = [
".",
......
......@@ -27,16 +27,12 @@ config("swiftshader_shader_private_config") {
]
}
} else {
cflags = [
"-DLOG_TAG=\"swiftshader_shader\"",
]
cflags = [ "-DLOG_TAG=\"swiftshader_shader\"" ]
}
}
source_set("swiftshader_shader") {
deps = [
"../Main:swiftshader_main",
]
deps = [ "../Main:swiftshader_main" ]
sources = [
"Constants.cpp",
......@@ -54,9 +50,7 @@ source_set("swiftshader_shader") {
"VertexShader.cpp",
]
configs += [
":swiftshader_shader_private_config",
]
configs += [ ":swiftshader_shader_private_config" ]
include_dirs = [
".",
......
......@@ -36,9 +36,7 @@ config("swiftshader_llvm_private_config") {
]
if (!is_debug) {
cflags += [
"/wd4324",
]
cflags += [ "/wd4324" ]
}
if (is_clang) {
......@@ -442,34 +440,22 @@ source_set("swiftshader_llvm") {
"lib/VMCore/Verifier.cpp",
]
if (host_os == "win") {
configs -= [
"//build/config/win:unicode"
]
if (is_win) {
configs -= [ "//build/config/win:unicode" ]
}
configs += [
":swiftshader_llvm_private_config",
]
configs += [ ":swiftshader_llvm_private_config" ]
include_dirs = [
"lib/Target/X86",
]
include_dirs = [ "lib/Target/X86" ]
# The "include" directory includes common files and the Windows specific config file.
# 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",
]
if (is_linux) {
include_dirs += [ "include-linux" ]
} else if (is_mac) {
include_dirs += [ "include-osx" ]
}
include_dirs += [
"include",
]
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