cpp_client_telemetry icon indicating copy to clipboard operation
cpp_client_telemetry copied to clipboard

Fix CMakeLists.txt for Android builds

Open ankitkapur opened this issue 3 years ago • 5 comments
trafficstars

Add

if(ANDROID)
  list(APPEND SRCS
    offline/OfflineStorage_Room.cpp
  )
else()
list(APPEND SRCS
    offline/OfflineStorage_SQLite.cpp
  )
endif()

For lib/CMakeLists.txt for Droid compilation.

ankitkapur avatar Jul 11 '22 21:07 ankitkapur

list(APPEND SRCS
    pal/posix/NetworkInformationImpl.mm
    # TODO: this unit below needs to be deprecated and removed
    ../third_party/Reachability/ODWReachability.m
)

//Add this elseif block elseif(ANDROID) list(APPEND SRCS http/HttpClient_Android.cpp http/HttpClient_Android.hpp pal/posix/NetworkInformationImpl.cpp ) else() list(APPEND SRCS http/HttpClient_Curl.cpp http/HttpClient_Curl.hpp pal/posix/NetworkInformationImpl.cpp )

ankitkapur avatar Jul 11 '22 21:07 ankitkapur

Add this OR if(PAL_IMPLEMENTATION STREQUAL "WIN32" OR ${CMAKE_SYSTEM_NAME} STREQUAL "Android")

ankitkapur avatar Jul 11 '22 21:07 ankitkapur

Regarding including the correct offline storage files, isn't it is already handled here -

https://github.com/microsoft/cpp_client_telemetry/blob/b35fe2d8f5709c9d50dc5a39ffac87768e215ce3/lib/android_build/maesdk/src/main/cpp/CMakeLists.txt#L107-L115

So Room DB files should be included only if build with USE_ROOM. This way, it would be possible to use SQLiteDB in android too if USE_ROOM is not set.

lalitb avatar Jul 12 '22 17:07 lalitb

Similar reasoning for HTTP library -

https://github.com/microsoft/cpp_client_telemetry/blob/b35fe2d8f5709c9d50dc5a39ffac87768e215ce3/lib/android_build/maesdk/src/main/cpp/CMakeLists.txt#L117-L121

lalitb avatar Jul 12 '22 17:07 lalitb

@ankitkapur - Do you have plan to work on this, or can we close it based on reasoning given in above comments ?

lalitb avatar Jan 20 '23 05:01 lalitb