android_app_ide.sh 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. #!/usr/bin/env bash
  2. #
  3. # Copyright (c) 2020 Project CHIP Authors
  4. #
  5. # Licensed under the Apache License, Version 2.0 (the "License");
  6. # you may not use this file except in compliance with the License.
  7. # You may obtain a copy of the License at
  8. #
  9. # http://www.apache.org/licenses/LICENSE-2.0
  10. #
  11. # Unless required by applicable law or agreed to in writing, software
  12. # distributed under the License is distributed on an "AS IS" BASIS,
  13. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. # See the License for the specific language governing permissions and
  15. # limitations under the License.
  16. #
  17. set -e
  18. set -x
  19. env
  20. if [ -z "$ANDROID_HOME" ]; then
  21. echo "ANDROID_HOME not set!"
  22. exit 1
  23. fi
  24. if [ -z "$ANDROID_NDK_HOME" ]; then
  25. echo "ANDROID_NDK_HOME not set!"
  26. exit 1
  27. fi
  28. if [ -z "$TARGET_CPU" ]; then
  29. echo "TARGET_CPU not set! Candidates: arm, arm64, x86 and x64."
  30. exit 1
  31. fi
  32. source scripts/activate.sh
  33. # Set up JARs
  34. python3 third_party/android_deps/set_up_android_deps.py
  35. # Build CMake for Android Studio
  36. echo "build ide"
  37. gn gen --check --fail-on-unused-args out/"android_$TARGET_CPU" --args="target_os=\"android\" target_cpu=\"$TARGET_CPU\" android_ndk_root=\"$ANDROID_NDK_HOME\" android_sdk_root=\"$ANDROID_HOME\"" --ide=json --json-ide-script=//scripts/examples/gn_to_cmakelists.py