build_native_ext_for_android.sh 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. #!/bin/sh
  2. # Copyright 2018 gRPC authors.
  3. #
  4. # Licensed under the Apache License, Version 2.0 (the "License");
  5. # you may not use this file except in compliance with the License.
  6. # You may obtain a copy of the License at
  7. #
  8. # http://www.apache.org/licenses/LICENSE-2.0
  9. #
  10. # Unless required by applicable law or agreed to in writing, software
  11. # distributed under the License is distributed on an "AS IS" BASIS,
  12. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. # See the License for the specific language governing permissions and
  14. # limitations under the License.
  15. # Helper script to crosscompile grpc_csharp_ext native extension for Android.
  16. set -ex
  17. cd "$(dirname "$0")/../../../cmake"
  18. mkdir -p build
  19. cd build
  20. # set to the location where Android SDK is installed
  21. ANDROID_NDK_PATH="$HOME/android-ndk-r16b"
  22. cmake ../.. \
  23. -DCMAKE_SYSTEM_NAME=Android \
  24. -DCMAKE_SYSTEM_VERSION=15 \
  25. -DCMAKE_ANDROID_ARCH_ABI=armeabi-v7a \
  26. -DCMAKE_ANDROID_NDK="${ANDROID_NDK_PATH}" \
  27. -DCMAKE_ANDROID_STL_TYPE=c++_static \
  28. -DRUN_HAVE_POSIX_REGEX=0 \
  29. -DRUN_HAVE_STD_REGEX=0 \
  30. -DRUN_HAVE_STEADY_CLOCK=0 \
  31. -DCMAKE_BUILD_TYPE=Release
  32. make grpc_csharp_ext