diff --git a/cortex-cpp/engines/cortex.llamacpp/engine.cmake b/cortex-cpp/engines/cortex.llamacpp/engine.cmake deleted file mode 100644 index f724a1963..000000000 --- a/cortex-cpp/engines/cortex.llamacpp/engine.cmake +++ /dev/null @@ -1,92 +0,0 @@ -# cortex.llamacpp release version -set(VERSION 0.1.23-29.07.24) -# vulka is unstable, we need to use a customized version -set(VULKA_VERSION 0.1.23-29.07.24) - -set(ENGINE_VERSION v${VERSION}) -add_compile_definitions(CORTEX_LLAMACPP_VERSION="${VERSION}") - -# MESSAGE("ENGINE_VERSION=" ${ENGINE_VERSION}) - -# Download library based on instructions -if(UNIX AND NOT APPLE) - if(CUDA_12_0) - if(LLAMA_AVX512) - set(LIBRARY_NAME cortex.llamacpp-${VERSION}-linux-amd64-avx512-cuda-12-0.tar.gz) - elseif(NOT LLAMA_AVX2) - set(LIBRARY_NAME cortex.llamacpp-${VERSION}-linux-amd64-avx-cuda-12-0.tar.gz) - else() - set(LIBRARY_NAME cortex.llamacpp-${VERSION}-linux-amd64-avx2-cuda-12-0.tar.gz) - endif() - elseif(CUDA_11_7) - if(LLAMA_AVX512) - set(LIBRARY_NAME cortex.llamacpp-${VERSION}-linux-amd64-avx512-cuda-11-7.tar.gz) - elseif(NOT LLAMA_AVX2) - set(LIBRARY_NAME cortex.llamacpp-${VERSION}-linux-amd64-avx-cuda-11-7.tar.gz) - else() - set(LIBRARY_NAME cortex.llamacpp-${VERSION}-linux-amd64-avx2-cuda-11-7.tar.gz) - endif() - elseif(LLAMA_VULKAN) - set(LIBRARY_NAME cortex.llamacpp-${VULKA_VERSION}-linux-amd64-vulkan.tar.gz) - set(ENGINE_VERSION v${VULKA_VERSION}) - elseif(LLAMA_AVX512) - set(LIBRARY_NAME cortex.llamacpp-${VERSION}-linux-amd64-avx512.tar.gz) - elseif(NOT LLAMA_AVX2) - set(LIBRARY_NAME cortex.llamacpp-${VERSION}-linux-amd64-avx.tar.gz) - else() - set(LIBRARY_NAME cortex.llamacpp-${VERSION}-linux-amd64-avx2.tar.gz) - endif() -elseif(UNIX) - if(MAC_ARM64) - set(LIBRARY_NAME cortex.llamacpp-${VERSION}-mac-arm64.tar.gz) - else() - set(LIBRARY_NAME cortex.llamacpp-${VERSION}-mac-amd64.tar.gz) - endif() -else() - if(CUDA_12_0) - if(LLAMA_AVX512) - set(LIBRARY_NAME cortex.llamacpp-${VERSION}-windows-amd64-avx512-cuda-12-0.tar.gz) - elseif(NOT LLAMA_AVX2) - set(LIBRARY_NAME cortex.llamacpp-${VERSION}-windows-amd64-avx-cuda-12-0.tar.gz) - else() - set(LIBRARY_NAME cortex.llamacpp-${VERSION}-windows-amd64-avx2-cuda-12-0.tar.gz) - endif() - elseif(CUDA_11_7) - if(LLAMA_AVX512) - set(LIBRARY_NAME cortex.llamacpp-${VERSION}-windows-amd64-avx512-cuda-11-7.tar.gz) - elseif(NOT LLAMA_AVX2) - set(LIBRARY_NAME cortex.llamacpp-${VERSION}-windows-amd64-avx-cuda-11-7.tar.gz) - else() - set(LIBRARY_NAME cortex.llamacpp-${VERSION}-windows-amd64-avx2-cuda-11-7.tar.gz) - endif() - elseif(LLAMA_VULKAN) - set(LIBRARY_NAME cortex.llamacpp-${VULKA_VERSION}-windows-amd64-vulkan.tar.gz) - set(ENGINE_VERSION v${VULKA_VERSION}) - elseif(LLAMA_AVX512) - set(LIBRARY_NAME cortex.llamacpp-${VERSION}-windows-amd64-avx512.tar.gz) - elseif(NOT LLAMA_AVX2) - set(LIBRARY_NAME cortex.llamacpp-${VERSION}-windows-amd64-avx.tar.gz) - else() - set(LIBRARY_NAME cortex.llamacpp-${VERSION}-windows-amd64-avx2.tar.gz) - endif() -endif() - - -set(LIBLLAMA_ENGINE_URL https://github.com/janhq/cortex.llamacpp/releases/download/${ENGINE_VERSION}/${LIBRARY_NAME}) -# MESSAGE("LIBLLAMA_ENGINE_URL="${LIBLLAMA_ENGINE_URL}) -# MESSAGE("LIBARRY_NAME=" ${LIBRARY_NAME}) - -set(LIBLLAMA_ENGINE_PATH ${CMAKE_BINARY_DIR}/engines/${LIBRARY_NAME}) - -# MESSAGE("CMAKE_BINARY_DIR = " ${CMAKE_BINARY_DIR}) - -file(DOWNLOAD ${LIBLLAMA_ENGINE_URL} ${LIBLLAMA_ENGINE_PATH} STATUS LIBLLAMA_ENGINE_DOWNLOAD_STATUS) -list(GET LIBLLAMA_ENGINE_DOWNLOAD_STATUS 0 LIBLLAMA_ENGINE_DOWNLOAD_STATUS_NO) -# MESSAGE("file = " ${CMAKE_BINARY_DIR}/engines/${LIBRARY_NAME}) - -if(LIBLLAMA_ENGINE_DOWNLOAD_STATUS_NO) - message(STATUS "Pre-built library not downloaded. (${LIBLLAMA_ENGINE_DOWNLOAD_STATUS})") -else() - message(STATUS "Linking downloaded pre-built library.") - file(ARCHIVE_EXTRACT INPUT ${CMAKE_BINARY_DIR}/engines/${LIBRARY_NAME} DESTINATION ${CMAKE_BINARY_DIR}/engines/) -endif() diff --git a/cortex-cpp/package.json b/cortex-cpp/package.json index 6271d7702..e104f616c 100644 --- a/cortex-cpp/package.json +++ b/cortex-cpp/package.json @@ -9,10 +9,11 @@ "url": "git+https://github.com/janhq/cortex.git" }, "scripts": { - "install": "prebuild-install --runtime napi --backend cmake-js --config Release || cmake-js rebuild --config Release", - "build": "cmake-js configure --config Release && cmake-js build --config Release", - "rebuild": "cmake-js rebuild --config Release", - "prebuild": "prebuild --runtime napi --backend cmake-js --all --strip --verbose --config Release --include-regex \"\\.(node|exp|lib|so)$\"", + "install": "prebuild-install --runtime napi --backend cmake-js --config Release || yarn build-deps && cmake-js rebuild --config Release", + "build-deps": "cmake-js configure --directory ./cortex-cpp-deps --out ./build-deps/cortex-cpp-deps && cmake-js build --directory ./cortex-cpp-deps --out ./build-deps/cortex-cpp-deps --config Release", + "build": "yarn build-deps && cmake-js configure --config Release && cmake-js build --config Release", + "rebuild": "yarn build-deps && cmake-js rebuild --config Release", + "prebuild": "yarn build-deps && prebuild --runtime napi --backend cmake-js --all --strip --verbose --config Release --include-regex \"\\.(node|exp|lib|so)$\"", "upload": "prebuild --runtime napi --backend cmake-js --upload ${GITHUB_TOKEN}" }, "author": "Jan ", @@ -35,7 +36,6 @@ ] }, "files": [ - "binding/*.js", - "binding/*.d.ts" + "**" ] }