diff --git a/android/acl/acl.iml b/android/acl/acl.iml
index 10af3d62a..417ffe266 100644
--- a/android/acl/acl.iml
+++ b/android/acl/acl.iml
@@ -10,7 +10,7 @@
-
+
@@ -25,7 +25,7 @@
-
+
diff --git a/android/acl/build.gradle b/android/acl/build.gradle
index 427dd2087..75faa1124 100644
--- a/android/acl/build.gradle
+++ b/android/acl/build.gradle
@@ -36,13 +36,8 @@ android {
//arguments "-DCMAKE_VERBOSE_MAKEFILE=ON"
arguments "-DACL_CLIENT_ONLY=YES"
//cppFlags "-fexceptions"
- //abiFilters 'armeabi', 'arm64-v8a', 'armeabi-v7a', 'x86'
- //abiFilters 'x86', 'arm64-v8a'
- //abiFilters 'arm64-v8a'
- abiFilters 'arm64-v8a', 'armeabi-v7a', 'x86', 'x86_64', 'armeabi'
- //abiFilters 'armeabi'
- //abiFilters 'arm64-v8a', 'armeabi-v7a'
- //abiFilters 'armeabi-v7a'
+ //abiFilters 'armeabi', 'arm64-v8a', 'armeabi-v7a', 'x86', 'x86_64'
+ abiFilters 'armeabi', 'arm64-v8a', 'armeabi-v7a'
}
cmake {
//arguments '-DANDROID_PLATFORM=android-14','-DANDROID_TOOLCHAIN=clang'
diff --git a/lib_acl/CMakeLists.txt b/lib_acl/CMakeLists.txt
index d81860c86..942a851a5 100644
--- a/lib_acl/CMakeLists.txt
+++ b/lib_acl/CMakeLists.txt
@@ -10,13 +10,18 @@ if (${CMAKE_BINARY_DIR} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR})
endif()
if (CMAKE_SYSTEM_NAME MATCHES "Android")
- add_definitions("-O3 -flto")
+ # xxx: -flto can't be used on NDK with gnustl_shared
+ if (ANDROID_STL MATCHES "gnustl_shared")
+ add_definitions("-Oz")
+ else()
+ add_definitions("-O3 -flto")
+ endif()
add_definitions("-DANDROID")
add_definitions("-DACL_CLIENT_ONLY")
add_definitions("-Wno-invalid-source-encoding")
add_definitions("-fdata-sections -ffunction-sections")
add_definitions("-Wno-unused-command-line-argument")
- string(APPEND CMAKE_C_FLAGS " -Qunused-arguments")
+ string(APPEND CMAKE_C_FLAGS "-Qunused-arguments")
set(UNIX_OS true)
elseif (CMAKE_SYSTEM_NAME MATCHES "Linux")
add_definitions("-O2")
@@ -160,9 +165,10 @@ SET_TARGET_PROPERTIES(acl_static PROPERTIES OUTPUT_NAME "acl")
link_directories(${lib_output_path})
if (${UNIX_OS})
- set(CMAKE_SHARED_LINKER_FLAGS "-shared -O3 -flto")
- target_compile_options(acl_static PRIVATE
- -fvisibility=hidden)
+ if (NOT ANDROID_STL MATCHES "gnustl_shared")
+ set(CMAKE_SHARED_LINKER_FLAGS "-shared -O3 -flto")
+ endif()
+ target_compile_options(acl_static PRIVATE -fvisibility=hidden)
endif()
add_library(acl SHARED ${lib_src})
diff --git a/lib_acl_cpp/CMakeLists.txt b/lib_acl_cpp/CMakeLists.txt
index d6de5590a..cc71871c5 100644
--- a/lib_acl_cpp/CMakeLists.txt
+++ b/lib_acl_cpp/CMakeLists.txt
@@ -8,12 +8,19 @@ endif()
#string(TOUPPER ${CMAKE_SYSTEM_NAME} CMAKE_SYSTEM_NAME)
if(CMAKE_SYSTEM_NAME MATCHES "Android")
- add_definitions("-O3 -flto")
+ # xxx: -flto can't be used on NDK with gnustl_shared
+ if (ANDROID_STL MATCHES "gnustl_shared")
+ add_definitions("-Oz")
+ else()
+ add_definitions("-O3 -flto")
+ endif()
+
add_definitions("-DANDROID")
add_definitions("-Wno-unused-command-line-argument")
add_definitions("-Wno-invalid-source-encoding")
- string(APPEND CMAKE_CXX_FLAGS " -Qunused-arguments")
-set(UNIX_OS true)
+ add_definitions("-fdata-sections -ffunction-sections")
+ string(APPEND CMAKE_CXX_FLAGS "-Qunused-arguments")
+ set(UNIX_OS true)
elseif(CMAKE_SYSTEM_NAME MATCHES "Linux")
add_definitions("-Wno-invalid-source-encoding")
add_definitions("-O2")
@@ -201,10 +208,11 @@ SET_TARGET_PROPERTIES(acl_cpp_static PROPERTIES OUTPUT_NAME "acl_cpp")
link_directories(${lib_output_path})
if (${UNIX_OS})
- set(CMAKE_SHARED_LINKER_FLAGS "-shared -lz -O3 -flto")
+ if (NOT ANDROID_STL MATCHES "gnustl_shared")
+ set(CMAKE_SHARED_LINKER_FLAGS "-shared -lz -O3 -flto")
+ endif()
target_compile_options(acl_cpp_static PRIVATE
- -fvisibility=hidden
- -fvisibility-inlines-hidden)
+ -fvisibility=hidden -fvisibility-inlines-hidden)
endif()
if (CMAKE_SYSTEM_NAME MATCHES "Darwin")
@@ -212,11 +220,12 @@ if (CMAKE_SYSTEM_NAME MATCHES "Darwin")
"${lib_output_path}/libprotocol.a ${lib_output_path}/libacl.a -liconv -lz -lpthread")
elseif (CMAKE_SYSTEM_NAME MATCHES "Android")
elseif (${UNIX_OS})
- set(CMAKE_SHARED_LINKER_FLAGS
- "${lib_output_path}/libprotocol.a ${lib_output_path}/libacl.a -lz -lpthread")
+ if (NOT ANDROID_STL MATCHES "gnustl_shared")
+ set(CMAKE_SHARED_LINKER_FLAGS
+ "${lib_output_path}/libprotocol.a ${lib_output_path}/libacl.a -lz -lpthread")
+ endif()
endif()
-
if(NOT CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
add_library(acl_cpp SHARED ${lib_src})
target_link_libraries(acl_cpp protocol acl)
diff --git a/lib_protocol/CMakeLists.txt b/lib_protocol/CMakeLists.txt
index 1e14453b0..2f208ec93 100644
--- a/lib_protocol/CMakeLists.txt
+++ b/lib_protocol/CMakeLists.txt
@@ -8,12 +8,17 @@ endif()
#string(TOUPPER ${CMAKE_SYSTEM_NAME} CMAKE_SYSTEM_NAME)
if (CMAKE_SYSTEM_NAME MATCHES "Android")
- add_definitions("-O3 -flto")
+ # xxx: -flto can't be used on NDK with gnustl_shared
+ if (ANDROID_STL MATCHES "gnustl_shared")
+ add_definitions("-Oz")
+ else()
+ add_definitions("-O3 -flto")
+ endif()
add_definitions("-DANDROID")
add_definitions("-Wno-invalid-source-encoding")
add_definitions("-Wno-unused-command-line-argument")
add_definitions("-fdata-sections -ffunction-sections")
- string(APPEND CMAKE_C_FLAGS " -Qunused-arguments")
+ string(APPEND CMAKE_C_FLAGS "-Qunused-arguments")
set(UNIX_OS true)
elseif (CMAKE_SYSTEM_NAME MATCHES "Linux")
add_definitions("-O2")
@@ -116,14 +121,14 @@ SET_TARGET_PROPERTIES(protocol_static PROPERTIES OUTPUT_NAME "protocol")
link_directories(${lib_output_path})
if (CMAKE_SYSTEM_NAME MATCHES "Android")
- set(CMAKE_SHARED_LINKER_FLAGS "-shared -O3 -flto")
- target_compile_options(protocol_static PRIVATE
- -fvisibility=hidden)
+ if (NOT ANDROID_STL MATCHES "gnustl_shared")
+ set(CMAKE_SHARED_LINKER_FLAGS "-shared -O3 -flto")
+ endif()
+ target_compile_options(protocol_static PRIVATE -fvisibility=hidden)
elseif (${UNIX_OS})
set(CMAKE_SHARED_LINKER_FLAGS "-shared -O3 -flto")
set(CMAKE_SHARED_LINKER_FLAGS "${lib_output_path}/libacl.a")
- target_compile_options(protocol_static PRIVATE
- -fvisibility=hidden)
+ target_compile_options(protocol_static PRIVATE -fvisibility=hidden)
endif()
if (NOT CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)