mirror of
https://fuchsia.googlesource.com/third_party/pigweed.googlesource.com/pigweed/pigweed
synced 2024-08-02 06:46:04 +00:00
android: Add top-level build targets
As with Arduino, these are only defined when the appropriate build arg is set, pointing at the Android NDK path. Targets are defined for each CPU target at each optimization level, e.g. including: arm_android_debug arm64_android_size_optimized x64_android_speed_optimized x86_android_debug Top-level targets are defined for each CPU target for the default optimization level: arm_android arm64_android x64_android x86_android And a top-level "android" target is defined that builds for each CPU target at the default optimization level. The default Android backends are set in the Android toolchain, and default configs were updated. Tested: Followed instructions in docs with NDK R25C Change-Id: I4e9636b91a5e4f5c77e2f5a8d389dcd970cf8184 Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/55344 Presubmit-Verified: CQ Bot Account <pigweed-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Carlos Chinchilla <cachinchilla@google.com> Commit-Queue: Carlos Chinchilla <cachinchilla@google.com> Reviewed-by: Keir Mierle <keir@google.com>
This commit is contained in:
parent
9a0e5d011b
commit
1471bcb2f7
19
BUILD.gn
19
BUILD.gn
|
@ -15,6 +15,7 @@
|
|||
import("//build_overrides/pi_pico.gni")
|
||||
import("//build_overrides/pigweed.gni")
|
||||
|
||||
import("$dir_pw_android_toolchain/android.gni")
|
||||
import("$dir_pw_arduino_build/arduino.gni")
|
||||
import("$dir_pw_build/coverage_report.gni")
|
||||
import("$dir_pw_build/host_tool.gni")
|
||||
|
@ -261,6 +262,24 @@ group("static_analysis") {
|
|||
}
|
||||
}
|
||||
|
||||
if (pw_android_toolchain_NDK_PATH != "") {
|
||||
group("android") {
|
||||
deps = []
|
||||
foreach(_cpu, pw_android_toolchain_cpu_targets) {
|
||||
_toolchain_prefix = "$dir_pigweed/targets/android:${_cpu}_android_"
|
||||
deps += [
|
||||
":pigweed_default($_toolchain_prefix$pw_DEFAULT_C_OPTIMIZATION_LEVEL)",
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
foreach(_cpu, pw_android_toolchain_cpu_targets) {
|
||||
_build_pigweed_default_at_all_optimization_levels("${_cpu}_android") {
|
||||
toolchain_prefix = "$dir_pigweed/targets/android:${_cpu}_android_"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
group("docs") {
|
||||
deps = [ "$dir_pigweed/docs($dir_pigweed/targets/docs)" ]
|
||||
}
|
||||
|
|
|
@ -23,21 +23,18 @@ pw_toolchain_android = {
|
|||
name = "android_debug"
|
||||
defaults = {
|
||||
default_configs = _android + [ "$dir_pw_build:optimize_debugging" ]
|
||||
remove_default_configs = [ "$dir_pw_build:relative_paths" ]
|
||||
}
|
||||
}
|
||||
speed_optimized = {
|
||||
name = "android_speed_optimized"
|
||||
defaults = {
|
||||
default_configs = _android + [ "$dir_pw_build:optimize_speed" ]
|
||||
remove_default_configs = [ "$dir_pw_build:relative_paths" ]
|
||||
}
|
||||
}
|
||||
size_optimized = {
|
||||
name = "android_size_optimized"
|
||||
defaults = {
|
||||
default_configs = _android + [ "$dir_pw_build:optimize_size" ]
|
||||
remove_default_configs = [ "$dir_pw_build:relative_paths" ]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,6 +17,7 @@ import("//build_overrides/pigweed.gni")
|
|||
import("$dir_pw_bloat/bloat.gni")
|
||||
import("$dir_pw_build/target_types.gni")
|
||||
import("$dir_pw_docgen/docs.gni")
|
||||
import("$dir_pw_toolchain/traits.gni")
|
||||
import("$dir_pw_unit_test/test.gni")
|
||||
|
||||
config("public_include_path") {
|
||||
|
|
|
@ -9,3 +9,58 @@ Native Development Kit (NDK).
|
|||
.. warning::
|
||||
This target is under construction, not ready for use, and the documentation
|
||||
is incomplete.
|
||||
|
||||
Setup
|
||||
=====
|
||||
You must first download and unpack a copy of the `Android NDK`_ and let Pigweed
|
||||
know where that is located using the ``pw_android_toolchain_NDK_PATH`` build
|
||||
arg.
|
||||
|
||||
.. _Android NDK: https://developer.android.com/ndk
|
||||
|
||||
You can set Pigweed build options using ``gn args out``.
|
||||
|
||||
Building
|
||||
========
|
||||
To build for this Pigweed target, simply build the top-level "android" Ninja
|
||||
target. You can set Pigweed build options using ``gn args out`` or by running:
|
||||
|
||||
.. code:: sh
|
||||
|
||||
gn gen out --args='
|
||||
pw_android_toolchain_NDK_PATH="/path/to/android/ndk"'
|
||||
|
||||
On a Windows machine it's easier to run:
|
||||
|
||||
.. code:: sh
|
||||
|
||||
gn args out
|
||||
|
||||
That will open a text file where you can paste the args in:
|
||||
|
||||
.. code:: text
|
||||
|
||||
pw_android_toolchain_NDK_PATH = "/path/to/android/ndk"
|
||||
|
||||
Save the file and close the text editor.
|
||||
|
||||
Then build with:
|
||||
|
||||
.. code:: sh
|
||||
|
||||
ninja -C out android
|
||||
|
||||
This will build Pigweed for all supported Android CPU targets at the default
|
||||
optimization level, currently arm, arm64, x64, and x86.
|
||||
|
||||
To build for a specific CPU target only, at the default optimization level:
|
||||
|
||||
.. code:: sh
|
||||
|
||||
ninja -C out arm64_android
|
||||
|
||||
Or to build for a specific CPU target and optimization level:
|
||||
|
||||
.. code:: sh
|
||||
|
||||
ninja -C out arm64_android_size_optimized
|
||||
|
|
|
@ -28,8 +28,27 @@ if (pw_android_toolchain_NDK_PATH != "") {
|
|||
|
||||
# Facade backends
|
||||
pw_assert_BACKEND = dir_pw_assert_basic
|
||||
pw_chrono_SYSTEM_CLOCK_BACKEND = "$dir_pw_chrono_stl:system_clock"
|
||||
pw_chrono_SYSTEM_TIMER_BACKEND = "$dir_pw_chrono_stl:system_timer"
|
||||
pw_log_BACKEND = dir_pw_log_basic
|
||||
pw_sync_BINARY_SEMAPHORE_BACKEND =
|
||||
"$dir_pw_sync_stl:binary_semaphore_backend"
|
||||
pw_sync_CONDITION_VARIABLE_BACKEND =
|
||||
"$dir_pw_sync_stl:condition_variable_backend"
|
||||
pw_sync_COUNTING_SEMAPHORE_BACKEND =
|
||||
"$dir_pw_sync_stl:counting_semaphore_backend"
|
||||
pw_sync_MUTEX_BACKEND = "$dir_pw_sync_stl:mutex_backend"
|
||||
pw_sync_TIMED_MUTEX_BACKEND = "$dir_pw_sync_stl:timed_mutex_backend"
|
||||
pw_sync_INTERRUPT_SPIN_LOCK_BACKEND = "$dir_pw_sync_stl:interrupt_spin_lock"
|
||||
pw_sync_THREAD_NOTIFICATION_BACKEND =
|
||||
"$dir_pw_sync:binary_semaphore_thread_notification_backend"
|
||||
pw_sync_TIMED_THREAD_NOTIFICATION_BACKEND =
|
||||
"$dir_pw_sync:binary_semaphore_timed_thread_notification_backend"
|
||||
pw_sys_io_BACKEND = dir_pw_sys_io_stdio
|
||||
pw_thread_ID_BACKEND = "$dir_pw_thread_stl:id"
|
||||
pw_thread_SLEEP_BACKEND = "$dir_pw_thread_stl:sleep"
|
||||
pw_thread_THREAD_BACKEND = "$dir_pw_thread_stl:thread"
|
||||
pw_thread_YIELD_BACKEND = "$dir_pw_thread_stl:yield"
|
||||
|
||||
pw_build_LINK_DEPS = []
|
||||
pw_build_LINK_DEPS += [
|
||||
|
|
Loading…
Reference in New Issue
Block a user