Skip to content

Commit b35fe2d

Browse files
authored
Add option to enable CAPI http for Android (#972)
1 parent 56b34f2 commit b35fe2d

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

lib/android_build/maesdk/src/main/cpp/CMakeLists.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ set(CMAKE_CXX_STANDARD 11)
1010
option(BUILD_AZMON "Build for Azure Monitor" YES)
1111
option(BUILD_PRIVACYGUARD "Build Privacy Guard" YES)
1212

13+
if(ENABLE_CAPI_HTTP_CLIENT)
14+
add_definitions(-DENABLE_CAPI_HTTP_CLIENT)
15+
endif()
16+
1317
string(REPLACE "/lib/android_build/maesdk/src/main/cpp" "" SDK_ROOT ${CMAKE_CURRENT_SOURCE_DIR})
1418

1519
if (USE_CURL)
@@ -116,6 +120,10 @@ else()
116120
list(APPEND SRCS ${SDK_ROOT}/lib/http/HttpClient_Android.cpp)
117121
endif()
118122

123+
if (ENABLE_CAPI_HTTP_CLIENT)
124+
list(APPEND SRCS ${SDK_ROOT}/lib/http/HttpClient_CAPI.cpp)
125+
endif()
126+
119127
add_library(${TARGETNAME} ${SRCS})
120128

121129
target_include_directories(${TARGETNAME} PUBLIC

lib/api/capi.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
#define MATSDK_DECLSPEC __declspec(dllexport)
66
#endif
77

8-
#ifndef ANDROID
8+
#if !defined (ANDROID) || defined(ENABLE_CAPI_HTTP_CLIENT)
99
#include "http/HttpClient_CAPI.hpp"
1010
#endif
1111
#include "LogManagerProvider.hpp"
@@ -131,7 +131,7 @@ evt_status_t mat_open_core(
131131
// Remember the original config string. Needed to avoid hash code collisions
132132
clients[code].ctx_data = config;
133133

134-
#ifndef ANDROID
134+
#if !defined (ANDROID) || defined(ENABLE_CAPI_HTTP_CLIENT)
135135
// Create custom HttpClient
136136
if (httpSendFn != nullptr && httpCancelFn != nullptr)
137137
{

0 commit comments

Comments
 (0)