diff options
author | Hao Chen <chenhaosjtuacm@google.com> | 2020-02-04 23:32:17 -0800 |
---|---|---|
committer | Hao Chen <chenhaosjtuacm@google.com> | 2020-02-05 15:47:51 -0800 |
commit | a0d2dfe49b9846fd27d457cd760402dcc9b16888 (patch) | |
tree | 24f9b75cd9551cea9b668b14be2688852cbd9ec7 | |
parent | 7a345e6d565f8718380f8ed554af67711ccbe02e (diff) | |
download | protobuf-a0d2dfe49b9846fd27d457cd760402dcc9b16888.tar.gz |
CMakeLists for Cross-compiling
Bug: b/148877100
Test: verified successful cross compilation
Change-Id: Ife96babf276f47aed46efdd330777552c444e5eb
-rw-r--r-- | cmake/CMakeLists.txt | 1 | ||||
-rw-r--r-- | src/google/protobuf/port_def.inc | 9 |
2 files changed, 10 insertions, 0 deletions
diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index 71a0f37aa..ebc7b0c98 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -198,6 +198,7 @@ get_filename_component(protobuf_source_dir ${protobuf_SOURCE_DIR} PATH) include_directories( ${ZLIB_INCLUDE_DIRECTORIES} ${protobuf_BINARY_DIR} + ${protobuf_source_dir}/android ${protobuf_source_dir}/src) if (MSVC) diff --git a/src/google/protobuf/port_def.inc b/src/google/protobuf/port_def.inc index 57a2209e0..df08f7957 100644 --- a/src/google/protobuf/port_def.inc +++ b/src/google/protobuf/port_def.inc @@ -297,9 +297,18 @@ // ANDROID: autotdetect RTTI. Managing RTTI through command line -D // parameters is hard across modules, just autodetect it. #undef GOOGLE_PROTOBUF_NO_RTTI + +#if defined(__clang__) #if !__has_feature(cxx_rtti) #define GOOGLE_PROTOBUF_NO_RTTI 1 #endif +#elif defined(__GNUC__) +#if !defined(__GXX_RTTI) +#define GOOGLE_PROTOBUF_NO_RTTI 1 +#endif +#else +#define GOOGLE_PROTOBUF_NO_RTTI 1 +#endif #if defined(GOOGLE_PROTOBUF_NO_RTTI) && GOOGLE_PROTOBUF_NO_RTTI #define PROTOBUF_RTTI 0 |