Skip to content

Commit

Permalink
Replace sb_is_modular
Browse files Browse the repository at this point in the history
b/294267479

"sb_is_modular" instances are replaced with "is_modular_toolchain &&
current_toolchain == cobalt_toolchain"

Change-Id: Id6bbc3cd89390143eadfd96a6fe1ece4aec0a761
  • Loading branch information
niranjanyardi committed Aug 7, 2023
1 parent b618328 commit ecaa709
Show file tree
Hide file tree
Showing 14 changed files with 25 additions and 28 deletions.
2 changes: 1 addition & 1 deletion base/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -1582,7 +1582,7 @@ component("base") {
# TODO(b/206642994): see if we can remove this condition. It's added for now
# because linking atomic leads to linker errors for evergreen on arm-hardfp,
# and it's apparently not really needed (i.e., we can build without it).
if (!is_starboard || !sb_is_modular) {
if (!is_starboard || !(is_modular_toolchain && current_toolchain == cobalt_toolchain)) {
libs += [ "atomic" ]
}
}
Expand Down
2 changes: 1 addition & 1 deletion build/toolchain/gcc_toolchain.gni
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,7 @@ template("gcc_toolchain") {
# TODO(b/206642994): see if we can remove this condition. It's needed for
# now to add cflags for evergreen platforms but we haven't yet decided
# whether cflags should be added here for all platforms.
if (!is_starboard_toolchain && is_starboard && sb_is_modular) {
if (!is_starboard_toolchain && is_starboard && is_modular_toolchain) {
command = "$asm -MMD -MF $depfile ${rebuild_string}{{defines}} {{include_dirs}} {{cflags}} {{asmflags}}${extra_asmflags} -c {{source}} -o {{output}}"
} else {
command = "$asm -MMD -MF $depfile ${rebuild_string}{{defines}} {{include_dirs}} {{asmflags}}${extra_asmflags} -c {{source}} -o {{output}}"
Expand Down
2 changes: 1 addition & 1 deletion cobalt/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ group("default") {
"//third_party/brotli:dec_no_dictionary_data",
]

if (sb_is_modular) {
if (is_modular_toolchain && current_toolchain == cobalt_toolchain) {
deps += [ "//base/util/values:values_util" ]
if (sb_is_evergreen) {
deps += [
Expand Down
2 changes: 1 addition & 1 deletion cobalt/media/sandbox/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ target(final_executable_type, "web_media_player_sandbox") {
"//url",
]

if (!sb_is_modular) {
if (!(is_modular_toolchain && current_toolchain == cobalt_toolchain)) {
deps += cobalt_platform_dependencies
}
}
2 changes: 1 addition & 1 deletion cobalt/network/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ static_library("network") {
defines = [ "ENABLE_NETWORK_LOGGING" ]
}

if (!sb_is_modular) {
if (!(is_modular_toolchain && current_toolchain == cobalt_toolchain)) {
deps += cobalt_platform_dependencies
}
}
Expand Down
6 changes: 2 additions & 4 deletions starboard/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,6 @@ group("gn_all") {
}

if (is_modular_toolchain && is_cobalt_toolchain) {
assert(sb_is_modular,
"sb_is_modular should be set when building with cobalt_toolchain")
}

if (!sb_is_evergreen) {
Expand Down Expand Up @@ -89,7 +87,7 @@ group("starboard") {
"//starboard/client_porting/eztime",
]

if (sb_is_modular) {
if (is_modular_toolchain && current_toolchain == cobalt_toolchain) {
public_deps += [
"//third_party/llvm-project/compiler-rt:compiler_rt",
"//third_party/llvm-project/libcxx:cxx",
Expand Down Expand Up @@ -192,7 +190,7 @@ if (current_toolchain == starboard_toolchain) {
} else {
public_deps += [ "//third_party/crashpad/wrapper:wrapper_stub" ]
}
if (!sb_is_modular) {
if (!(is_modular_toolchain && current_toolchain == cobalt_toolchain)) {
public_deps += [ "//$starboard_path:starboard_platform" ]
}
}
Expand Down
8 changes: 5 additions & 3 deletions starboard/build/config/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ config("target") {
# This appears to cause errors when linking the code statically,
# however.
# For windows based platforms this flag causes a linker error while building with cobalt toolchain
if (!(host_os == "win" && sb_is_modular &&
if (!(host_os == "win" && is_modular_toolchain &&
current_toolchain == cobalt_toolchain)) {
cflags = [ "-fPIC" ]
}
Expand Down Expand Up @@ -153,7 +153,7 @@ config("starboard") {
defines += [ "SB_IS_LIBRARY=1" ]
}

if (sb_is_modular) {
if (is_modular_toolchain) {
defines += [ "SB_IS_MODULAR=1" ]
}

Expand Down Expand Up @@ -229,7 +229,9 @@ config("warnings_as_errors") {
# override flags specified in a platform's "platform_configuration" config,
# which is where these particular flags would otherwise naturally fit.
config("default_compiler_flags") {
if (is_starboardized_toolchain && sb_is_modular && target_cpu == "arm") {
if (is_starboardized_toolchain &&
(is_modular_toolchain && current_toolchain == cobalt_toolchain) &&
target_cpu == "arm") {
cflags = [ "-mfpu=vfpv3" ]
asmflags = cflags
}
Expand Down
3 changes: 0 additions & 3 deletions starboard/build/config/base_configuration.gni
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,6 @@ declare_args() {
# Directory path to static contents' data.
sb_static_contents_output_data_dir = "$root_out_dir/content/data"

# Whether this is a modular build.
sb_is_modular = false

# Whether this is an Evergreen build.
sb_is_evergreen = false

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

import("//starboard/build/config/base_configuration.gni")

sb_is_modular = true
is_modular_toolchain = true

sb_is_evergreen = true

Expand Down
2 changes: 1 addition & 1 deletion starboard/extension/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ target(gtest_target_type, "extension_test") {
"//testing/gmock",
"//testing/gtest",
]
if (sb_is_modular) {
if (is_modular_toolchain && current_toolchain == cobalt_toolchain) {
deps += cobalt_platform_dependencies
}
}
2 changes: 1 addition & 1 deletion starboard/linux/shared/platform_configuration/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ config("platform_configuration") {
"rt",
]

if (!sb_is_modular) {
if (!(is_modular_toolchain && current_toolchain == cobalt_toolchain)) {
ldflags += [ "-static-libstdc++" ]
}

Expand Down
2 changes: 1 addition & 1 deletion third_party/boringssl/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ static_library("crypto") {
configs -= [ "//starboard/build/config:size" ]
configs += [ "//starboard/build/config:speed" ]

if (sb_is_modular) {
if (is_modular_toolchain && current_toolchain == cobalt_toolchain) {
calling_convention = sabi_variables.calling_convention
if ((calling_convention != "aarch64" && calling_convention != "eabi" &&
calling_convention != "sysv" && calling_convention != "windows") ||
Expand Down
8 changes: 4 additions & 4 deletions third_party/libjpeg-turbo/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -145,9 +145,9 @@ if (nasm_exists && (current_cpu == "x86" || current_cpu == "x64")) {
}

# TODO(b/206642994): look into whether we should condition on the
# floating_point_fpu SABI variable, rather than sb_is_modular, here as we did
# floating_point_fpu SABI variable, rather than (is_modular_toolchain && current_toolchain == cobalt_toolchain), here as we did
# in third_party/libjpeg-turbo/libjpeg.gyp.
if (is_starboard && sb_is_modular && current_cpu == "arm" && arm_use_neon) {
if (is_starboard && (is_modular_toolchain && current_toolchain == cobalt_toolchain) && current_cpu == "arm" && arm_use_neon) {
config("simd_arm_config") {
cflags = [ "-mfpu=neon" ]
}
Expand Down Expand Up @@ -205,7 +205,7 @@ static_library("simd") {
}
configs += [ "//build/config/compiler:optimize_speed" ]

if (is_starboard && sb_is_modular && current_cpu == "arm") {
if (is_starboard && (is_modular_toolchain && current_toolchain == cobalt_toolchain) && current_cpu == "arm") {
configs += [ ":simd_arm_config" ]
}
} else {
Expand Down Expand Up @@ -316,7 +316,7 @@ static_library("libjpeg") {
# TODO(b/236258535): Enable neon instructions once the code is updated
# to use SbCPUFeatures() at runtime.
if ((is_msan && (current_cpu == "x86" || current_cpu == "x64")) ||
(is_starboard && sb_is_modular)) {
(is_starboard && (is_modular_toolchain && current_toolchain == cobalt_toolchain))) {
sources += [ "jsimd_none.c" ]
} else {
public_deps += [ ":simd" ]
Expand Down
10 changes: 5 additions & 5 deletions third_party/zlib/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ if (current_cpu == "arm" || current_cpu == "arm64") {
}

# TODO(b/206642994): look into whether we should condition on the
# floating_point_fpu SABI variable, rather than sb_is_modular, here as we did
# floating_point_fpu SABI variable, rather than (is_modular_toolchain && current_toolchain == cobalt_toolchain), here as we did
# in third_party/zlib/zlib.gyp.
if (is_starboard && sb_is_modular && target_cpu == "arm" &&
if (is_starboard && (is_modular_toolchain && current_toolchain == cobalt_toolchain) && target_cpu == "arm" &&
use_arm_neon_optimizations) {
config("zlib_neon_fpu_config") {
cflags = [ "-mfpu=neon" ]
Expand Down Expand Up @@ -80,7 +80,7 @@ source_set("zlib_adler32_simd") {
configs += [ "//starboard/build/config:speed" ]
}

if (is_starboard && sb_is_modular && target_cpu == "arm" &&
if (is_starboard && (is_modular_toolchain && current_toolchain == cobalt_toolchain) && target_cpu == "arm" &&
use_arm_neon_optimizations) {
configs += [ ":zlib_neon_fpu_config" ]
}
Expand Down Expand Up @@ -161,7 +161,7 @@ if (use_arm_neon_optimizations) {
deps = [ "//starboard:starboard_headers_only" ]
}

if (is_starboard && sb_is_modular && target_cpu == "arm" &&
if (is_starboard && (is_modular_toolchain && current_toolchain == cobalt_toolchain) && target_cpu == "arm" &&
use_arm_neon_optimizations) {
configs += [ ":zlib_neon_fpu_config" ]
}
Expand Down Expand Up @@ -236,7 +236,7 @@ source_set("zlib_inflate_chunk_simd") {
configs += [ "//starboard/build/config:speed" ]
}

if (is_starboard && sb_is_modular && target_cpu == "arm" &&
if (is_starboard && (is_modular_toolchain && current_toolchain == cobalt_toolchain) && target_cpu == "arm" &&
use_arm_neon_optimizations) {
configs += [ ":zlib_neon_fpu_config" ]
}
Expand Down

0 comments on commit ecaa709

Please sign in to comment.