optimize projects for xmake and cmake

This commit is contained in:
shuxin   zheng 2019-10-15 16:52:02 +08:00
parent aad02c78d5
commit d3ab857d3b
7 changed files with 26 additions and 10 deletions

View File

@ -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'

View File

@ -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

View File

@ -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 \
..

View File

@ -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()

View File

@ -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)

View File

@ -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)

View File

@ -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