Skip to content

Commit

Permalink
Add starboard build to android (#4259)
Browse files Browse the repository at this point in the history
b/368687596
  • Loading branch information
andrewsavage1 authored Oct 18, 2024
1 parent efb2656 commit 4386750
Show file tree
Hide file tree
Showing 23 changed files with 302 additions and 338 deletions.
15 changes: 12 additions & 3 deletions build/config/BUILDCONFIG.gn
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
# every other file in the build. So variables declared here (that don't start
# with an underscore) will be implicitly global.

import("//chrobalt/build/configs/chrobalt.gni")

# =============================================================================
# PLATFORM SELECTION
# =============================================================================
Expand Down Expand Up @@ -280,6 +282,14 @@ if (custom_toolchain != "") {
set_default_toolchain(_default_toolchain)
}

if (chrobalt) {
if (custom_toolchain != "") {
cobalt_toolchain = custom_toolchain
} else if (_default_toolchain != "") {
cobalt_toolchain = _default_toolchain
}
}

# =============================================================================
# OS DEFINITIONS
# =============================================================================
Expand Down Expand Up @@ -327,9 +337,8 @@ is_posix = !is_win && !is_fuchsia
# requirement and just need to add a config everywhere, reference it as a
# sub-config of an existing one, most commonly the main "compiler" one.

import("//chrobalt/build/configs/chrobalt.gni")
# TODO(b/371589344): Fix android build configs.
if (chrobalt && target_os != "android") {
# TODO: b/374301613 - Consolidate these imports and remove variables where possible.
if (chrobalt) {
import("//chrobalt/build/configs/initialize_variables.gni")
import("//chrobalt/build/configs/variables.gni")
}
Expand Down
6 changes: 3 additions & 3 deletions build/config/android/config.gni
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ if (is_android || is_chromeos) {

# The default to use for android:minSdkVersion for targets that do
# not explicitly set it.
default_min_sdk_version = 24
default_min_sdk_version = 26

# Static analysis can be either "on" or "off" or "build_server". This
# controls how android lint, error-prone, bytecode checks are run. This
Expand Down Expand Up @@ -87,8 +87,8 @@ if (is_android || is_chromeos) {

if (!defined(default_android_ndk_root)) {
default_android_ndk_root = "//third_party/android_ndk"
default_android_ndk_version = "r23"
default_android_ndk_major_version = 23
default_android_ndk_version = "r26"
default_android_ndk_major_version = 26
} else {
assert(defined(default_android_ndk_version))
assert(defined(default_android_ndk_major_version))
Expand Down
4 changes: 2 additions & 2 deletions build/config/clang/clang.gni
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ declare_args() {
# Chrome OS's.
clang_use_chrome_plugins =
is_clang && !is_nacl && current_os != "zos" &&
default_toolchain != "//build/toolchain/cros:target"
default_toolchain != "//build/toolchain/cros:target" && !chrobalt

enable_check_raw_ptr_fields =
build_with_chromium && !is_official_build &&
((is_linux && !is_castos) || (is_android && !is_cast_android))
((is_linux && !is_castos) || (is_android && !is_cast_android)) && !chrobalt

clang_base_path = default_clang_base_path
}
4 changes: 1 addition & 3 deletions chrobalt/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,5 @@

group("gn_all") {
# TODO(b/371589344): Fix android build configs.
if (target_os != "android") {
deps = [ "//starboard($starboard_toolchain)" ]
}
deps = [ "//starboard($starboard_toolchain)" ]
}
15 changes: 12 additions & 3 deletions chrobalt/build/configs/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,17 @@
# limitations under the License.

config("chrobalt_config") {
# TODO(b/371589344): Fix android build configs.
if (target_os != "android") {
configs = [ "//${starboard_path}/platform_configuration" ]
configs = [ ":default_includes" ]
if (current_toolchain == starboard_toolchain) {
configs += [ "//${starboard_path}/platform_configuration" ]
}
}

config("default_includes") {
if (is_android) {
include_dirs = [
# POSIX emulation headers - these need to come *before* system include_dirs.
"//starboard/android/shared/posix_emu/include",
]
}
}
4 changes: 1 addition & 3 deletions chrobalt/build/configs/initialize_variables.gni
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ declare_args() {

using_old_compiler = false

build_with_separate_cobalt_toolchain = true
build_with_separate_cobalt_toolchain = target_os != "android"
}

assert(!(is_starboard && is_native_target_build),
Expand Down Expand Up @@ -67,9 +67,7 @@ if (is_mac) {
# configuration.
import("//starboard/build/platform_path.gni")
if (build_with_separate_cobalt_toolchain) {
cobalt_toolchain = "//$starboard_path/toolchain:cobalt"
starboard_toolchain = "//$starboard_path/toolchain:starboard"
} else {
cobalt_toolchain = default_toolchain
starboard_toolchain = cobalt_toolchain
}
Loading

0 comments on commit 4386750

Please sign in to comment.