Skip to content

Commit 17d4a49

Browse files
angtstruct
authored andcommitted
common : use cpp-httplib as a cURL alternative for downloads (ggml-org#16185)
* vendor : update httplib Signed-off-by: Adrien Gallouët <[email protected]> * 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]> * ggml : Bump to Windows 10 Signed-off-by: Adrien Gallouët <[email protected]> --------- Signed-off-by: Adrien Gallouët <[email protected]>
1 parent 78b5579 commit 17d4a49

File tree

4 files changed

+3020
-1246
lines changed

4 files changed

+3020
-1246
lines changed

common/CMakeLists.txt

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,39 @@ 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+
include(CheckCSourceCompiles)
94+
set(CMAKE_REQUIRED_INCLUDES ${OPENSSL_INCLUDE_DIR})
95+
check_c_source_compiles("
96+
#include <openssl/opensslv.h>
97+
#if defined(OPENSSL_IS_BORINGSSL) || defined(LIBRESSL_VERSION_NUMBER)
98+
# if OPENSSL_VERSION_NUMBER < 0x1010107f
99+
# error bad version
100+
# endif
101+
#else
102+
# if OPENSSL_VERSION_NUMBER < 0x30000000L
103+
# error bad version
104+
# endif
105+
#endif
106+
int main() { return 0; }
107+
" OPENSSL_VERSION_SUPPORTED)
108+
if (OPENSSL_VERSION_SUPPORTED)
109+
message(STATUS "OpenSSL found: ${OPENSSL_VERSION}")
110+
target_compile_definitions(${TARGET} PUBLIC CPPHTTPLIB_OPENSSL_SUPPORT)
111+
target_link_libraries(${TARGET} PUBLIC OpenSSL::SSL OpenSSL::Crypto)
112+
if (APPLE AND CMAKE_SYSTEM_NAME STREQUAL "Darwin")
113+
target_compile_definitions(${TARGET} PUBLIC CPPHTTPLIB_USE_CERTS_FROM_MACOSX_KEYCHAIN)
114+
find_library(CORE_FOUNDATION_FRAMEWORK CoreFoundation REQUIRED)
115+
find_library(SECURITY_FRAMEWORK Security REQUIRED)
116+
target_link_libraries(${TARGET} PUBLIC ${CORE_FOUNDATION_FRAMEWORK} ${SECURITY_FRAMEWORK})
117+
endif()
118+
endif()
119+
else()
120+
message(STATUS "OpenSSL not found, SSL support disabled")
121+
endif()
122+
endif()
91123

92124
if (LLAMA_LLGUIDANCE)
93125
include(ExternalProject)

0 commit comments

Comments
 (0)