From d81acb68476d7fa05e443d63511d0da91ec39fb9 Mon Sep 17 00:00:00 2001 From: Pierrick HYMBERT Date: Sat, 16 Mar 2024 21:59:53 +0100 Subject: [PATCH] build: introduce cmake option LLAMA_CURL to trigger libcurl linking to be coherent with the make toolchain --- .github/workflows/server.yml | 3 ++- CMakeLists.txt | 1 + common/CMakeLists.txt | 7 +++---- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/workflows/server.yml b/.github/workflows/server.yml index 5530e9bd8..8abe6f496 100644 --- a/.github/workflows/server.yml +++ b/.github/workflows/server.yml @@ -68,6 +68,7 @@ jobs: cmake .. \ -DLLAMA_NATIVE=OFF \ -DLLAMA_BUILD_SERVER=ON \ + -DLLAMA_CURL=ON \ -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \ -DLLAMA_SANITIZE_${{ matrix.sanitizer }}=ON ; cmake --build . --config ${{ matrix.build_type }} -j $(nproc) --target server @@ -126,7 +127,7 @@ jobs: run: | mkdir build cd build - cmake .. -DCURL_LIBRARY="${env:RUNNER_TEMP}/libcurl/lib/Release/libcurl_imp.lib" -DCURL_INCLUDE_DIR="${env:RUNNER_TEMP}/libcurl/include" -DLLAMA_BUILD_SERVER=ON -DCMAKE_BUILD_TYPE=Release + cmake .. -DLLAMA_CURL=ON -DCURL_LIBRARY="${env:RUNNER_TEMP}/libcurl/lib/Release/libcurl_imp.lib" -DCURL_INCLUDE_DIR="${env:RUNNER_TEMP}/libcurl/include" -DLLAMA_BUILD_SERVER=ON -DCMAKE_BUILD_TYPE=Release cmake --build . --config Release -j ${env:NUMBER_OF_PROCESSORS} --target server - name: Python setup diff --git a/CMakeLists.txt b/CMakeLists.txt index 3ac2804a6..fc4cff28f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -99,6 +99,7 @@ option(LLAMA_CUDA_F16 "llama: use 16 bit floats for some set(LLAMA_CUDA_KQUANTS_ITER "2" CACHE STRING "llama: iters./thread per block for Q2_K/Q6_K") set(LLAMA_CUDA_PEER_MAX_BATCH_SIZE "128" CACHE STRING "llama: max. batch size for using peer access") +option(LLAMA_CURL "llama: use libcurl to download model from an URL" OFF) option(LLAMA_HIPBLAS "llama: use hipBLAS" OFF) option(LLAMA_HIP_UMA "llama: use HIP unified memory architecture" OFF) option(LLAMA_CLBLAST "llama: use CLBlast" OFF) diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt index 0331788fd..c8a21a9c2 100644 --- a/common/CMakeLists.txt +++ b/common/CMakeLists.txt @@ -47,14 +47,13 @@ if (BUILD_SHARED_LIBS) set_target_properties(${TARGET} PROPERTIES POSITION_INDEPENDENT_CODE ON) endif() + # Check for curl -find_package(CURL QUIET) -if (CURL_FOUND) +if (LLAMA_CURL) + find_package(CURL) add_definitions(-DLLAMA_USE_CURL) include_directories(${CURL_INCLUDE_DIRS}) link_libraries(${CURL_LIBRARIES}) -else() - message(INFO " libcurl not found. Building without model download support.") endif ()