Skip to content

Commit e1f545f

Browse files
committed
common : use cpp-httplib as a cURL alternative for downloads
The existing cURL implementation is intentionally left untouched to prevent any regressions and to allow for safe, side-by-side testing by toggling the `LLAMA_CURL` CMake option. Signed-off-by: Adrien Gallouët <[email protected]>
1 parent 60dbbce commit e1f545f

File tree

2 files changed

+370
-8
lines changed

2 files changed

+370
-8
lines changed

common/CMakeLists.txt

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,20 @@ if (LLAMA_CURL)
8787
target_compile_definitions(${TARGET} PUBLIC LLAMA_USE_CURL)
8888
include_directories(${CURL_INCLUDE_DIRS})
8989
set(LLAMA_COMMON_EXTRA_LIBS ${LLAMA_COMMON_EXTRA_LIBS} ${CURL_LIBRARIES})
90-
endif ()
90+
else()
91+
find_package(OpenSSL)
92+
if (OpenSSL_FOUND)
93+
message(STATUS "OpenSSL found: ${OPENSSL_VERSION}")
94+
target_compile_definitions(${TARGET} PUBLIC CPPHTTPLIB_OPENSSL_SUPPORT)
95+
target_link_libraries(${TARGET} PUBLIC OpenSSL::SSL OpenSSL::Crypto)
96+
if (APPLE)
97+
target_compile_definitions(${TARGET} PUBLIC CPPHTTPLIB_USE_CERTS_FROM_MACOSX_KEYCHAIN)
98+
target_link_libraries(${TARGET} PUBLIC "-framework Security")
99+
endif()
100+
else()
101+
message(STATUS "OpenSSL not found, SSL support disabled")
102+
endif()
103+
endif()
91104

92105
if (LLAMA_LLGUIDANCE)
93106
include(ExternalProject)

0 commit comments

Comments
 (0)