Skip to content

add ptread link to fix cmake build under linux #114

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Mar 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 40 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: CI
on: [push, pull_request]

jobs:
ubuntu-latest:
ubuntu-latest-make:
runs-on: ubuntu-latest

steps:
Expand All @@ -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:
Expand All @@ -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:
Expand Down
3 changes: 3 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)