diff --git a/CMakeLists.txt b/CMakeLists.txt index 8d6c76dda..23663f85c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -78,9 +78,11 @@ endif() add_subdirectory(lib_acl acl) add_subdirectory(lib_protocol protocol) -add_dependencies(protocol acl) add_subdirectory(lib_acl_cpp acl_cpp) -add_dependencies(acl_cpp protocol acl) +if (ACL_BUILD_SHARED MATCHES "YES") + add_dependencies(protocol acl) + add_dependencies(acl_cpp protocol acl) +endif() #if (CMAKE_SYSTEM_NAME MATCHES "Linux" OR CMAKE_SYSTEM_NAME MATCHES "Android") if (CMAKE_SYSTEM_NAME MATCHES "Linux") diff --git a/build4android.sh b/build4android.sh index 2a8b43740..3de8df930 100755 --- a/build4android.sh +++ b/build4android.sh @@ -15,11 +15,12 @@ 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 \ + -DANDROID_PLATFORM=android-28 \ -DCMAKE_SYSTEM_NAME=Android \ -DACL_CLIENT_ONLY=YES \ -DDISABLE_DB=YES \ -DHAS_POLARSSL_DLL=NO \ -DCMAKE_BUILD_TYPE=RELEASE \ -DCMAKE_VERBOSE_MAKEFILE=ON \ + -DACL_BUILD_SHARED=NO \ .. diff --git a/lib_acl/CMakeLists.txt b/lib_acl/CMakeLists.txt index 942a851a5..a2120a6c7 100644 --- a/lib_acl/CMakeLists.txt +++ b/lib_acl/CMakeLists.txt @@ -171,6 +171,8 @@ if (${UNIX_OS}) target_compile_options(acl_static PRIVATE -fvisibility=hidden) endif() -add_library(acl SHARED ${lib_src}) +if (ACL_BUILD_SHARED MATCHES "YES") + add_library(acl SHARED ${lib_src}) +endif() ############################################################################## diff --git a/lib_acl_cpp/CMakeLists.txt b/lib_acl_cpp/CMakeLists.txt index cc71871c5..8f4e7f93f 100644 --- a/lib_acl_cpp/CMakeLists.txt +++ b/lib_acl_cpp/CMakeLists.txt @@ -227,8 +227,10 @@ elseif (${UNIX_OS}) 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) + if (ACL_BUILD_SHARED MATCHES "YES") + add_library(acl_cpp SHARED ${lib_src}) + target_link_libraries(acl_cpp protocol acl) + endif() endif() ############################################################################## diff --git a/lib_protocol/CMakeLists.txt b/lib_protocol/CMakeLists.txt index 2f208ec93..47aea155e 100644 --- a/lib_protocol/CMakeLists.txt +++ b/lib_protocol/CMakeLists.txt @@ -132,8 +132,10 @@ elseif (${UNIX_OS}) endif() if (NOT CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR) - add_library(protocol SHARED ${lib_src}) - target_link_libraries(protocol acl) + if (ACL_BUILD_SHARED MATCHES "YES") + add_library(protocol SHARED ${lib_src}) + target_link_libraries(protocol acl) + endif() endif() ############################################################################## diff --git a/xmake.lua b/xmake.lua index fd36b7729..ddcf8f459 100644 --- a/xmake.lua +++ b/xmake.lua @@ -117,8 +117,8 @@ if not is_plat("windows") then 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("-MD", "-MT", "-MF") + --add_cxxflags("-MD", "-MT", "-MF") add_cflags("-no-canonical-prefixes") add_cxxflags("-no-canonical-prefixes") add_cflags("-fno-addrsig")