aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormmyjona <jonathan.gonse@gmail.com>2023-03-18 00:38:24 +0800
committerGitHub <noreply@github.com>2023-03-17 13:38:24 -0300
commit6b0df5ccf360fe5c015f6607f0375bfc6849005e (patch)
tree78c02bebf09a8f443b1650dcae0275c695e239e7
parent2af23d30434a677c6416812eea52ccc0af65119c (diff)
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>
-rw-r--r--.github/workflows/build.yml43
-rw-r--r--CMakeLists.txt3
2 files changed, 43 insertions, 3 deletions
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 94f199c..a94a389 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -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:
diff --git a/CMakeLists.txt b/CMakeLists.txt
index ca3be38..38e7266 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -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)