Skip to content

Commit 6b0df5c

Browse files
mmyjonaetra0
andauthored
add ptread link to fix cmake build under linux (antimatter15#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 <[email protected]>
1 parent 2af23d3 commit 6b0df5c

File tree

2 files changed

+43
-3
lines changed

2 files changed

+43
-3
lines changed

.github/workflows/build.yml

Lines changed: 40 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: CI
22
on: [push, pull_request]
33

44
jobs:
5-
ubuntu-latest:
5+
ubuntu-latest-make:
66
runs-on: ubuntu-latest
77

88
steps:
@@ -18,7 +18,26 @@ jobs:
1818
run: |
1919
make
2020
21-
macOS-latest:
21+
ubuntu-latest-cmake:
22+
runs-on: ubuntu-latest
23+
24+
steps:
25+
- name: Clone
26+
uses: actions/checkout@v1
27+
28+
- name: Dependencies
29+
run: |
30+
sudo apt-get update
31+
sudo apt-get install build-essential
32+
33+
- name: Build
34+
run: |
35+
mkdir build
36+
cd build
37+
cmake ..
38+
cmake --build . --config Release
39+
40+
macOS-latest-make:
2241
runs-on: macos-latest
2342

2443
steps:
@@ -33,7 +52,25 @@ jobs:
3352
run: |
3453
make
3554
36-
windows-latest:
55+
macOS-latest-cmake:
56+
runs-on: macOS-latest
57+
58+
steps:
59+
- name: Clone
60+
uses: actions/checkout@v1
61+
62+
- name: Dependencies
63+
run: |
64+
brew update
65+
66+
- name: Build
67+
run: |
68+
mkdir build
69+
cd build
70+
cmake ..
71+
cmake --build . --config Release
72+
73+
windows-latest-cmake:
3774
runs-on: windows-latest
3875

3976
steps:

CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ project("llama.cpp")
44
set(CMAKE_CXX_STANDARD 20)
55
set(CMAKE_CXX_STANDARD_REQUIRED true)
66
set(CMAKE_C_STANDARD 11)
7+
set(THREADS_PREFER_PTHREAD_FLAG ON)
8+
find_package(Threads REQUIRED)
79

810
if (NOT XCODE AND NOT MSVC AND NOT CMAKE_BUILD_TYPE)
911
set(CMAKE_BUILD_TYPE Release CACHE STRING "Build type" FORCE)
@@ -126,3 +128,4 @@ target_link_libraries(ggml PRIVATE ${LLAMA_EXTRA_LIBS})
126128
target_include_directories(ggml PUBLIC .)
127129
target_link_libraries(quantize PRIVATE ggml)
128130
target_link_libraries(llama PRIVATE ggml)
131+
target_link_libraries(ggml PRIVATE Threads::Threads)

0 commit comments

Comments
 (0)