aboutsummaryrefslogtreecommitdiffhomepage
path: root/examples/android/helloworld
diff options
context:
space:
mode:
Diffstat (limited to 'examples/android/helloworld')
-rw-r--r--examples/android/helloworld/app/CMakeLists.txt39
-rw-r--r--examples/android/helloworld/app/build.gradle15
2 files changed, 10 insertions, 44 deletions
diff --git a/examples/android/helloworld/app/CMakeLists.txt b/examples/android/helloworld/app/CMakeLists.txt
index 6ee18daaab..f449a5ce2e 100644
--- a/examples/android/helloworld/app/CMakeLists.txt
+++ b/examples/android/helloworld/app/CMakeLists.txt
@@ -12,36 +12,6 @@ file(MAKE_DIRECTORY ${GRPC_BUILD_DIR})
add_subdirectory(${GRPC_SRC_DIR} ${GRPC_BUILD_DIR})
-include_directories(${GRPC_SRC_DIR}/include)
-
-add_library(libgrpc STATIC IMPORTED)
-set_target_properties(libgrpc PROPERTIES IMPORTED_LOCATION
- ${GRPC_BUILD_DIR}/libgrpc.a)
-
-add_library(libgrpc++ STATIC IMPORTED)
-set_target_properties(libgrpc++ PROPERTIES IMPORTED_LOCATION
- ${GRPC_BUILD_DIR}/libgrpc++.a)
-
-add_library(libgpr STATIC IMPORTED)
-set_target_properties(libgpr PROPERTIES IMPORTED_LOCATION
- ${GRPC_BUILD_DIR}/libgpr.a)
-
-add_library(libcares STATIC IMPORTED)
-set_target_properties(libcares PROPERTIES IMPORTED_LOCATION
- ${GRPC_BUILD_DIR}/third_party/cares/cares/lib/libcares.a)
-
-add_library(libzlib STATIC IMPORTED)
-set_target_properties(libzlib PROPERTIES IMPORTED_LOCATION
- ${GRPC_BUILD_DIR}/third_party/zlib/libz.a)
-
-add_library(libcrypto STATIC IMPORTED)
-set_target_properties(libcrypto PROPERTIES IMPORTED_LOCATION
- ${GRPC_BUILD_DIR}/third_party/boringssl/crypto/libcrypto.a)
-
-add_library(libssl STATIC IMPORTED)
-set_target_properties(libssl PROPERTIES IMPORTED_LOCATION
- ${GRPC_BUILD_DIR}/third_party/boringssl/ssl/libssl.a)
-
set(GRPC_PROTO_GENS_DIR ${CMAKE_BINARY_DIR}/gens)
file(MAKE_DIRECTORY ${GRPC_PROTO_GENS_DIR})
include_directories(${GRPC_PROTO_GENS_DIR})
@@ -96,8 +66,8 @@ add_library(helloworld_proto_lib
SHARED ${HELLOWORLD_PROTO_HDRS} ${HELLOWORLD_PROTO_SRCS})
target_link_libraries(helloworld_proto_lib
+ grpc++
libprotobuf
- libgrpc++
android
log)
@@ -111,13 +81,6 @@ target_include_directories(grpc-helloworld
PRIVATE ${HELLOWORLD_PROTO_HEADERS})
target_link_libraries(grpc-helloworld
- libgrpc++
- libgrpc
- libzlib
- libcares
- libssl
- libcrypto
helloworld_proto_lib
- libgpr
android
${log-lib})
diff --git a/examples/android/helloworld/app/build.gradle b/examples/android/helloworld/app/build.gradle
index c6ab7308ae..1d09fdc180 100644
--- a/examples/android/helloworld/app/build.gradle
+++ b/examples/android/helloworld/app/build.gradle
@@ -11,6 +11,13 @@ android {
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
externalNativeBuild {
cmake {
+ // The paths to the protoc and grpc_cpp_plugin binaries on the host system (codegen
+ // is not cross-compiled to Android)
+ def protoc = project.hasProperty('protoc') ?
+ project.property('protoc') : '/usr/local/bin/protoc'
+ def grpc_cpp_plugin = project.hasProperty('grpc_cpp_plugin') ?
+ project.property('grpc_cpp_plugin') : '/usr/local/bin/grpc_cpp_plugin'
+
cppFlags "-std=c++14 -frtti -fexceptions"
arguments '-DANDROID_STL=c++_static'
arguments '-DRUN_HAVE_POSIX_REGEX=0'
@@ -18,12 +25,8 @@ android {
arguments '-DRUN_HAVE_STEADY_CLOCK=0'
arguments '-Dprotobuf_BUILD_PROTOC_BINARIES=off'
arguments '-DgRPC_BUILD_CODEGEN=off'
- // Set this to the path to the protoc binary on the host system (codegen is not
- // cross-compiled to Android)
- arguments '-Dhelloworld_PROTOBUF_PROTOC_EXECUTABLE=/usr/local/bin/protoc'
- // Set this to the path to the gRPC C++ protoc plugin binary on the host system
- // (codegen is not cross-compiled to Android)
- arguments '-Dhelloworld_GRPC_CPP_PLUGIN_EXECUTABLE=/usr/local/bin/grpc_cpp_plugin'
+ arguments '-Dhelloworld_PROTOBUF_PROTOC_EXECUTABLE=' + protoc
+ arguments '-Dhelloworld_GRPC_CPP_PLUGIN_EXECUTABLE=' + grpc_cpp_plugin
}
}
ndk.abiFilters 'x86'