diff --git a/android/acl/build.gradle b/android/acl/build.gradle index 4eae1626b..f129e0ece 100644 --- a/android/acl/build.gradle +++ b/android/acl/build.gradle @@ -33,6 +33,7 @@ android { arguments "-DCMAKE_BUILD_TYPE=RELEASE" arguments "-DCMAKE_CXX_FLAGS_RELEASE=-O3" arguments "-DCMAKE_C_FLAGS_RELEASE=-O3" + //arguments "-DCMAKE_VERBOSE_MAKEFILE=ON" arguments "-DACL_CLIENT_ONLY=YES" //cppFlags "-fexceptions" //abiFilters 'armeabi', 'arm64-v8a', 'armeabi-v7a', 'x86' diff --git a/android/acl/local.properties b/android/acl/local.properties index 1f5d7d6f3..f0222fed8 100644 --- a/android/acl/local.properties +++ b/android/acl/local.properties @@ -4,6 +4,6 @@ # Location of the SDK. This is only used by Gradle. # For customization when using a Version Control System, please read the # header note. -#Wed Sep 18 17:20:23 CST 2019 -#ndk.dir=E\:\\tools\\android\\Sdk\\ndk-bundle -sdk.dir=/Users/shuxinzheng/Library/Android/sdk +#Tue Oct 15 16:48:29 CST 2019 +ndk.dir=/Users/shuxinzheng/Library/Android/sdk-3.5/ndk-bundle +sdk.dir=/Users/shuxinzheng/Library/Android/sdk-3.5 diff --git a/build4android.sh b/build4android.sh index 36235c188..2a8b43740 100755 --- a/build4android.sh +++ b/build4android.sh @@ -12,13 +12,14 @@ #HAS_POLARSSL #HAS_POLARSSL_DLL -cmake -DCMAKE_TOOLCHAIN_FILE=/data/zsx/android-ndk-r20/build/cmake/android.toolchain.cmake \ +cmake -DCMAKE_TOOLCHAIN_FILE=~/Library/Android/ndk-bundle-r20/build/cmake/android.toolchain.cmake \ -DANDROID_ABI="armeabi-v7a" \ -DANDROID_ARM_NEON=ON \ -DANDROID_PLATFORM=android-14 \ - -DCMAKE_BUILD_TYPE=RELEASE \ -DCMAKE_SYSTEM_NAME=Android \ -DACL_CLIENT_ONLY=YES \ -DDISABLE_DB=YES \ - -DHAS_POLARSSL_DLL=YES \ + -DHAS_POLARSSL_DLL=NO \ + -DCMAKE_BUILD_TYPE=RELEASE \ + -DCMAKE_VERBOSE_MAKEFILE=ON \ .. diff --git a/lib_acl/CMakeLists.txt b/lib_acl/CMakeLists.txt index fb8e3d07c..d81860c86 100644 --- a/lib_acl/CMakeLists.txt +++ b/lib_acl/CMakeLists.txt @@ -160,7 +160,7 @@ SET_TARGET_PROPERTIES(acl_static PROPERTIES OUTPUT_NAME "acl") link_directories(${lib_output_path}) if (${UNIX_OS}) - set(CMAKE_SHARED_LINKER_FLAGS "-shared -flto") + set(CMAKE_SHARED_LINKER_FLAGS "-shared -O3 -flto") target_compile_options(acl_static PRIVATE -fvisibility=hidden) endif() diff --git a/lib_acl_cpp/CMakeLists.txt b/lib_acl_cpp/CMakeLists.txt index 6e53fb2d5..d6de5590a 100644 --- a/lib_acl_cpp/CMakeLists.txt +++ b/lib_acl_cpp/CMakeLists.txt @@ -201,7 +201,7 @@ 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 -flto") + set(CMAKE_SHARED_LINKER_FLAGS "-shared -lz -O3 -flto") target_compile_options(acl_cpp_static PRIVATE -fvisibility=hidden -fvisibility-inlines-hidden) diff --git a/lib_protocol/CMakeLists.txt b/lib_protocol/CMakeLists.txt index 5cbb1efd0..1e14453b0 100644 --- a/lib_protocol/CMakeLists.txt +++ b/lib_protocol/CMakeLists.txt @@ -116,11 +116,11 @@ 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 -flto") + set(CMAKE_SHARED_LINKER_FLAGS "-shared -O3 -flto") target_compile_options(protocol_static PRIVATE -fvisibility=hidden) elseif (${UNIX_OS}) - set(CMAKE_SHARED_LINKER_FLAGS "-shared -flto") + 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) diff --git a/xmake.lua b/xmake.lua index 82ae8c423..f1e00b788 100644 --- a/xmake.lua +++ b/xmake.lua @@ -86,6 +86,8 @@ if not is_plat("windows") then if is_kind("static") then add_cxflags("-fvisibility-inlines-hidden") + add_cflags("-flto") + add_cxxflags("-flto") if not is_plat("android") then add_cflags("-flto") add_cxxflags("-flto") @@ -93,6 +95,18 @@ if not is_plat("windows") then end add_defines("_REENTRANT", "_USE_FAST_MACRO", "_POSIX_PTHREAD_SEMANTICS", "_GNU_SOURCE=1") --add_defines("ACL_CLIENT_ONLY") + add_defines("ACL_PREPARE_COMPILE") + add_defines("ANDROID") + add_defines("NDEBUG") + add_defines("acl_cpp_EXPORTS") + add_cflags("fno-addrsig") + add_cxxflags("fno-addrsig") + add_cflags("-MD", "-MT", "-MF") + add_cxxflags("-MD", "-MT", "-MF") + add_cflags("-no-canonical-prefixes") + add_cxxflags("-no-canonical-prefixes") + add_cflags("-fno-addrsig") + add_cxxflags("-fno-addrsig") end -- include project sources