add ptread link to fix cmake build under linux (#114)

* add ptread link to fix cmake build under linux

* add cmake to linux and macos platform

* separate make and cmake workflow

---------

Co-authored-by: Sebastián A <sebastian.aedo29@gmail.com>
This commit is contained in:
mmyjona 2023-03-18 00:38:24 +08:00 committed by GitHub
parent 2af23d3043
commit 6b0df5ccf3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 43 additions and 3 deletions

View File

@ -2,7 +2,7 @@ name: CI
on: [push, pull_request]
jobs:
ubuntu-latest:
ubuntu-latest-make:
runs-on: ubuntu-latest
steps:
@ -18,7 +18,26 @@ jobs:
run: |
make
macOS-latest:
ubuntu-latest-cmake:
runs-on: ubuntu-latest
steps:
- name: Clone
uses: actions/checkout@v1
- name: Dependencies
run: |
sudo apt-get update
sudo apt-get install build-essential
- name: Build
run: |
mkdir build
cd build
cmake ..
cmake --build . --config Release
macOS-latest-make:
runs-on: macos-latest
steps:
@ -33,7 +52,25 @@ jobs:
run: |
make
windows-latest:
macOS-latest-cmake:
runs-on: macOS-latest
steps:
- name: Clone
uses: actions/checkout@v1
- name: Dependencies
run: |
brew update
- name: Build
run: |
mkdir build
cd build
cmake ..
cmake --build . --config Release
windows-latest-cmake:
runs-on: windows-latest
steps:

View File

@ -4,6 +4,8 @@ project("llama.cpp")
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED true)
set(CMAKE_C_STANDARD 11)
set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)
if (NOT XCODE AND NOT MSVC AND NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release CACHE STRING "Build type" FORCE)
@ -126,3 +128,4 @@ target_link_libraries(ggml PRIVATE ${LLAMA_EXTRA_LIBS})
target_include_directories(ggml PUBLIC .)
target_link_libraries(quantize PRIVATE ggml)
target_link_libraries(llama PRIVATE ggml)
target_link_libraries(ggml PRIVATE Threads::Threads)