Skip to content

Commit 484a0fa

Browse files
committed
Improve compile for android
1 parent c53c54b commit 484a0fa

File tree

3 files changed

+13
-1
lines changed

3 files changed

+13
-1
lines changed

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,7 @@ if (NOT MSVC)
213213
endif()
214214
endif()
215215
if (ANDROID)
216+
add_definitions(-DDISABLE_WRITE_LOGGING)
216217
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fPIE -pie")
217218
endif()
218219
if(COMPILER_HAS_STD_CXX20)

proxy/include/proxy/logging.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@
147147
# pragma warning(disable: 4244 4127)
148148
# endif // _MSC_VER
149149

150-
#if _LIBCPP_VERSION < 170000
150+
#if (_LIBCPP_VERSION < 170000) && !defined(__ANDROID__)
151151

152152
# include <fmt/ostream.h>
153153
# include <fmt/printf.h>

server/proxy_server/CMakeLists.txt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,17 @@ else()
2323
message(STATUS "proxy_server set cxx standard: C++20")
2424
endif()
2525

26+
if (ANDROID)
27+
# 查找 Android log 库.
28+
find_library(
29+
log-lib
30+
log
31+
)
32+
33+
# link_libraries 会在所有目标中链接 log 库.
34+
link_libraries("${log-lib}")
35+
endif()
36+
2637
if(ENABLE_BUILD_WERROR)
2738
if(MSVC)
2839
target_compile_options(proxy_server PRIVATE /W4 /WX)

0 commit comments

Comments
 (0)