Skip to content

Commit

Permalink
pw_chre: Split out shared_platform
Browse files Browse the repository at this point in the history
The files in CHRE's shared platform contains implementations
that some developers would want to write themselves.

Split this out from the main third_party/chre:chre definition
so it is easier to not include these files and instead include
your own.

Change-Id: Ib71170589583ea4c591c50663933fb867d792bfe
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/170791
Reviewed-by: Armando Montanez <[email protected]>
Commit-Queue: David Gilhooley <[email protected]>
  • Loading branch information
gilhooleyd authored and CQ Bot Account committed Sep 18, 2023
1 parent e765c4d commit d62bb0b
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 31 deletions.
46 changes: 32 additions & 14 deletions pw_chre/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -38,20 +38,7 @@ pw_source_set("chre_empty_host_link") {
deps = [ ":chre" ]
}

pw_source_set("chre_backend") {
sources = [
"chre_api_re.cc",
"context.cc",
"host_link.cc",
"memory.cc",
"memory_manager.cc",
"platform_debug_dump_manager.cc",
"platform_nanoapp.cc",
"platform_pal.cc",
"power_control_manager.cc",
"system_time.cc",
"system_timer.cc",
]
pw_source_set("chre_backend_headers") {
public = [
"include/chre/target_platform/atomic_base.h",
"include/chre/target_platform/atomic_base_impl.h",
Expand All @@ -70,11 +57,35 @@ pw_source_set("chre_backend") {
"include/chre/target_platform/static_nanoapp_init.h",
"include/chre/target_platform/system_timer_base.h",
]
public_configs = [ ":public_overrides" ]
public_deps = [
"$dir_pw_chrono:system_timer",
"$dir_pw_log",
"$dir_pw_sync:mutex",
"$dir_pw_sync:timed_thread_notification",
]
}

pw_source_set("pw_chre_backend") {
sources = [
"chre_api_re.cc",
"context.cc",
"host_link.cc",
"memory.cc",
"memory_manager.cc",
"platform_debug_dump_manager.cc",
"platform_nanoapp.cc",
"platform_pal.cc",
"power_control_manager.cc",
"system_time.cc",
"system_timer.cc",
]
deps = [
"$dir_pw_string:format",
"$dir_pw_third_party/chre:chre_headers",
]
public_deps = [
":chre_backend_headers",
"$dir_pw_chrono:system_timer",
"$dir_pw_log",
"$dir_pw_sync:mutex",
Expand All @@ -89,6 +100,13 @@ pw_source_set("chre_backend") {
remove_configs = [ "$dir_pw_build:internal_strict_warnings" ]
}

pw_source_set("chre_backend") {
public_deps = [
":pw_chre_backend",
"$dir_pw_third_party/chre:shared_platform",
]
}

config("public_include_path") {
include_dirs = [ "public" ]
visibility = [ ":*" ]
Expand Down
44 changes: 28 additions & 16 deletions third_party/chre/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,34 @@ if (dir_pw_third_party_chre == "") {
public_deps = [ ":config" ]
}

pw_source_set("shared_platform") {
public_configs = [ ":disable_warnings" ]
sources = [
"$dir_pw_third_party_chre/platform/shared/assert.cc",
"$dir_pw_third_party_chre/platform/shared/chre_api_core.cc",
"$dir_pw_third_party_chre/platform/shared/chre_api_re.cc",
"$dir_pw_third_party_chre/platform/shared/chre_api_user_settings.cc",
"$dir_pw_third_party_chre/platform/shared/chre_api_version.cc",
"$dir_pw_third_party_chre/platform/shared/memory_manager.cc",
"$dir_pw_third_party_chre/platform/shared/nanoapp/nanoapp_dso_util.cc",
"$dir_pw_third_party_chre/platform/shared/pal_system_api.cc",
"$dir_pw_third_party_chre/platform/shared/system_time.cc",
]

# TODO(b/300633363): Use CHRE's version when it compiles on MacOS.
if (current_os == "mac") {
sources += [ "version.cc" ]
} else {
sources += [ "$dir_pw_third_party_chre/platform/shared/version.cc" ]
}

public_deps = [
":chre_headers",
"$pw_chre_PLATFORM_BACKEND_HEADERS",
]
remove_configs = [ "$dir_pw_build:internal_strict_warnings" ]
}

pw_source_set("chre") {
public_configs = [ ":disable_warnings" ]
sources = [
Expand All @@ -95,15 +123,6 @@ if (dir_pw_third_party_chre == "") {
"$dir_pw_third_party_chre/core/settings.cc",
"$dir_pw_third_party_chre/core/static_nanoapps.cc",
"$dir_pw_third_party_chre/core/timer_pool.cc",
"$dir_pw_third_party_chre/platform/shared/assert.cc",
"$dir_pw_third_party_chre/platform/shared/chre_api_core.cc",
"$dir_pw_third_party_chre/platform/shared/chre_api_re.cc",
"$dir_pw_third_party_chre/platform/shared/chre_api_user_settings.cc",
"$dir_pw_third_party_chre/platform/shared/chre_api_version.cc",
"$dir_pw_third_party_chre/platform/shared/memory_manager.cc",
"$dir_pw_third_party_chre/platform/shared/nanoapp/nanoapp_dso_util.cc",
"$dir_pw_third_party_chre/platform/shared/pal_system_api.cc",
"$dir_pw_third_party_chre/platform/shared/system_time.cc",
"$dir_pw_third_party_chre/util/buffer_base.cc",
"$dir_pw_third_party_chre/util/dynamic_vector_base.cc",
"$dir_pw_third_party_chre/util/nanoapp/audio.cc",
Expand All @@ -113,13 +132,6 @@ if (dir_pw_third_party_chre == "") {
"$dir_pw_third_party_chre/util/system/debug_dump.cc",
]

# TODO(b/300633363): Use CHRE's version when it compiles on MacOS.
if (current_os == "mac") {
sources += [ "version.cc" ]
} else {
sources += [ "$dir_pw_third_party_chre/platform/shared/version.cc" ]
}

public_deps = [
":chre_headers",
"$pw_chre_PLATFORM_BACKEND",
Expand Down
5 changes: 4 additions & 1 deletion third_party/chre/chre.gni
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ declare_args() {
# The configuration for building CHRE.
pw_chre_CONFIG = "//third_party/chre:default_chre_config"

# CHRE's platform backend. The default is the pigweed backend.
# CHRE's platform backend headers. The default is the Pigweed backend.
pw_chre_PLATFORM_BACKEND_HEADERS = "//pw_chre:chre_backend_headers"

# CHRE's platform backend implementation. The default is the Pigweed backend.
pw_chre_PLATFORM_BACKEND = "//pw_chre:chre_backend"
}

0 comments on commit d62bb0b

Please sign in to comment.