Skip to content

Commit

Permalink
build: fold vendor.sh into cmake (#10)
Browse files Browse the repository at this point in the history
  • Loading branch information
ochafik authored Nov 22, 2024
1 parent 23fe651 commit f122cc5
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 11 deletions.
17 changes: 17 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,34 @@ set(LLAMA_OPENMP OFF)
set(LLAMA_CPP_DIR "${CMAKE_CURRENT_SOURCE_DIR}/vendor/llama.cpp")
set(SQLITE_AMALGAMATION_DIR "${CMAKE_CURRENT_SOURCE_DIR}/vendor/sqlite")

include(ExternalProject)

set(SQLITE_VERSION 3450300)
set(SQLITE_YEAR 2024)
set(SQLITE_URL https://www.sqlite.org/${SQLITE_YEAR}/sqlite-amalgamation-${SQLITE_VERSION}.zip)
ExternalProject_Add(sqlite_amalgamation
URL ${SQLITE_URL}
DOWNLOAD_DIR ${CMAKE_BINARY_DIR}/downloads
SOURCE_DIR ${SQLITE_AMALGAMATION_DIR}
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ""
)


add_subdirectory(${LLAMA_CPP_DIR} ${CMAKE_BINARY_DIR}/llama.cpp)

include_directories(${SQLITE_AMALGAMATION_DIR})

add_library(sqlite_lembed SHARED sqlite-lembed.c)
add_dependencies(sqlite_lembed sqlite_amalgamation)
target_link_libraries(sqlite_lembed ggml_static llama)
target_include_directories(sqlite_lembed PRIVATE ${LLAMA_CPP_DIR})
set_target_properties(sqlite_lembed PROPERTIES PREFIX "")
set_target_properties(sqlite_lembed PROPERTIES OUTPUT_NAME "lembed0")

add_library(sqlite_lembed_static STATIC sqlite-lembed.c)
add_dependencies(sqlite_lembed_static sqlite_amalgamation)
target_link_libraries(sqlite_lembed_static ggml_static llama)
target_include_directories(sqlite_lembed_static PRIVATE ${LLAMA_CPP_DIR})
target_compile_definitions(sqlite_lembed_static PRIVATE SQLITE_CORE)
Expand Down
11 changes: 0 additions & 11 deletions scripts/vendor.sh

This file was deleted.

0 comments on commit f122cc5

Please sign in to comment.