mirror of
https://github.com/aristocratos/btop.git
synced 2024-09-29 22:51:35 +02:00
Add cmake workflow for all platforms
This commit is contained in:
parent
e35538fa29
commit
97b35d9720
40
.github/workflows/cmake-freebsd.yml
vendored
Normal file
40
.github/workflows/cmake-freebsd.yml
vendored
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
name: FreeBSD CMake
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: main
|
||||||
|
tags-ignore: '*.*'
|
||||||
|
paths:
|
||||||
|
- '.github/workflows/cmake-freebsd.yml'
|
||||||
|
- 'CMakeLists.txt'
|
||||||
|
- 'include/**'
|
||||||
|
- 'src/*pp'
|
||||||
|
- 'src/freebsd/*pp'
|
||||||
|
pull_request:
|
||||||
|
branches: main
|
||||||
|
paths:
|
||||||
|
- '.github/workflows/cmake-freebsd.yml'
|
||||||
|
- 'CMakeLists.txt'
|
||||||
|
- 'include/**'
|
||||||
|
- 'src/*pp'
|
||||||
|
- 'src/freebsd/*pp'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
cmake_build_on_freebsd:
|
||||||
|
runs-on: ubuntu-22.04
|
||||||
|
concurrency:
|
||||||
|
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
||||||
|
cancel-in-progress: true
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Compile
|
||||||
|
uses: vmactions/freebsd-vm@v1
|
||||||
|
with:
|
||||||
|
release: '14.0'
|
||||||
|
usesh: true
|
||||||
|
prepare: pkg install -y cmake ninja
|
||||||
|
run: |
|
||||||
|
CXX=clang++ cmake -B build -G Ninja -DBTOP_STATIC=ON
|
||||||
|
cmake --build build --verbose
|
||||||
|
|
40
.github/workflows/cmake-linux.yml
vendored
Normal file
40
.github/workflows/cmake-linux.yml
vendored
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
name: Linux CMake
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: main
|
||||||
|
tags-ignore: '*.*'
|
||||||
|
paths:
|
||||||
|
- '.github/workflows/cmake-linux.yml'
|
||||||
|
- 'CMakeLists.txt'
|
||||||
|
- 'include/**'
|
||||||
|
- 'src/*pp'
|
||||||
|
- 'src/linux/*pp'
|
||||||
|
pull_request:
|
||||||
|
branches: main
|
||||||
|
paths:
|
||||||
|
- '.github/workflows/cmake-linux.yml'
|
||||||
|
- 'CMakeLists.txt'
|
||||||
|
- 'include/**'
|
||||||
|
- 'src/*pp'
|
||||||
|
- 'src/linux/*pp'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
cmake_build_on_linux:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
container: alpine:edge
|
||||||
|
concurrency:
|
||||||
|
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
||||||
|
cancel-in-progress: true
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Install build tools
|
||||||
|
run: apk add --no-cache --update clang cmake lld ninja
|
||||||
|
|
||||||
|
- name: Configure
|
||||||
|
run: CXX=clang++ LDFLAGS=-fuse-ld=lld cmake -B build -G Ninja -DBTOP_STATIC=ON
|
||||||
|
|
||||||
|
- name: Compile
|
||||||
|
run: cmake --build build --verbose
|
||||||
|
|
47
.github/workflows/cmake-macos.yml
vendored
Normal file
47
.github/workflows/cmake-macos.yml
vendored
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
name: macOS CMake
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: main
|
||||||
|
tags-ignore: '*.*'
|
||||||
|
paths:
|
||||||
|
- '.github/workflows/cmake-macos.yml'
|
||||||
|
- 'CMakeLists.txt'
|
||||||
|
- 'include/**'
|
||||||
|
- 'src/*pp'
|
||||||
|
- 'src/osx/*pp'
|
||||||
|
pull_request:
|
||||||
|
branches: main
|
||||||
|
paths:
|
||||||
|
- '.github/workflows/cmake-macos.yml'
|
||||||
|
- 'CMakeLists.txt'
|
||||||
|
- 'include/**'
|
||||||
|
- 'src/*pp'
|
||||||
|
- 'src/osx/*pp'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
cmake_build_on_macos:
|
||||||
|
runs-on: macos-latest
|
||||||
|
concurrency:
|
||||||
|
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
||||||
|
cancel-in-progress: true
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Install build tools
|
||||||
|
run: |
|
||||||
|
export HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=1
|
||||||
|
brew update --quiet
|
||||||
|
brew install --force --overwrite cmake llvm@17 ninja
|
||||||
|
|
||||||
|
- name: Configure
|
||||||
|
run: |
|
||||||
|
export LLVM_PREFIX="$(brew --prefix llvm)"
|
||||||
|
export CXX="$LLVM_PREFIX/bin/clang++"
|
||||||
|
export CPPFLAGS="-I$LLVM_PREFIX/include"
|
||||||
|
export LDFLAGS="-L$LLVM_PREFIX/lib -L$LLVM_PREFIX/lib/c++ -Wl,-rpath,$LLVM_PREFIX/lib/c++ -fuse-ld=$LLVM_PREFIX/bin/ld64.lld"
|
||||||
|
cmake -B build -G Ninja
|
||||||
|
|
||||||
|
- name: Compile
|
||||||
|
run: cmake --build build --verbose
|
||||||
|
|
15
.github/workflows/continuous-build-freebsd.yml
vendored
15
.github/workflows/continuous-build-freebsd.yml
vendored
@ -58,18 +58,3 @@ jobs:
|
|||||||
path: 'bin/*'
|
path: 'bin/*'
|
||||||
if-no-files-found: error
|
if-no-files-found: error
|
||||||
|
|
||||||
build-freebsd-cmake:
|
|
||||||
runs-on: ubuntu-22.04
|
|
||||||
timeout-minutes: 20
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Compile
|
|
||||||
uses: vmactions/freebsd-vm@v1
|
|
||||||
with:
|
|
||||||
release: '14.0'
|
|
||||||
usesh: true
|
|
||||||
prepare: pkg install -y cmake git ninja
|
|
||||||
run: |
|
|
||||||
CXX=clang++ cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DBTOP_STATIC=ON
|
|
||||||
cmake --build build
|
|
||||||
|
@ -70,8 +70,8 @@ else()
|
|||||||
message(FATAL_ERROR "${CMAKE_SYSTEM_NAME} is not supported")
|
message(FATAL_ERROR "${CMAKE_SYSTEM_NAME} is not supported")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
check_include_file_cxx(ranges CXX_HAS_RANGES)
|
check_include_file_cxx(ranges CXX_HAVE_RANGES)
|
||||||
if(NOT CXX_HAS_RANGES)
|
if(NOT CXX_HAVE_RANGES)
|
||||||
message(FATAL_ERROR "The compiler doesn't support <ranges>")
|
message(FATAL_ERROR "The compiler doesn't support <ranges>")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
108
README.md
108
README.md
@ -450,7 +450,6 @@ Also needs a UTF8 locale and a font that covers:
|
|||||||
```
|
```
|
||||||
|
|
||||||
</details>
|
</details>
|
||||||
|
|
||||||
<details>
|
<details>
|
||||||
|
|
||||||
<summary>
|
<summary>
|
||||||
@ -526,14 +525,22 @@ Also needs a UTF8 locale and a font that covers:
|
|||||||
|
|
||||||
## Compilation macOS OSX
|
## Compilation macOS OSX
|
||||||
|
|
||||||
Needs GCC 10 or higher, (GCC 11 or above strongly recommended for better CPU efficiency in the compiled binary).
|
Needs GCC 10 / Clang 16 (or higher).
|
||||||
|
|
||||||
GCC 12 needed for macOS Ventura. If you get linker errors on Ventura you'll need to upgrade your command line tools (Version 14.0) is bugged.
|
With GCC, version 12 (or better) is needed for macOS Ventura. If you get linker errors on Ventura you'll need to upgrade your command line tools (Version 14.0) is bugged.
|
||||||
|
|
||||||
The makefile also needs GNU coreutils and `sed`.
|
The makefile also needs GNU coreutils and `sed`.
|
||||||
|
|
||||||
Install and use Homebrew or MacPorts package managers for easy dependency installation
|
Install and use Homebrew or MacPorts package managers for easy dependency installation
|
||||||
|
|
||||||
|
<details>
|
||||||
|
|
||||||
|
<summary>
|
||||||
|
|
||||||
|
### With Make
|
||||||
|
|
||||||
|
</summary>
|
||||||
|
|
||||||
1. **Install dependencies (example for Homebrew)**
|
1. **Install dependencies (example for Homebrew)**
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
@ -612,9 +619,99 @@ Also needs a UTF8 locale and a font that covers:
|
|||||||
gmake help
|
gmake help
|
||||||
```
|
```
|
||||||
|
|
||||||
|
</details>
|
||||||
|
<details>
|
||||||
|
|
||||||
|
<summary>
|
||||||
|
|
||||||
|
### With CMake (Community maintained)
|
||||||
|
|
||||||
|
</summary>
|
||||||
|
|
||||||
|
1. **Install build dependencies**
|
||||||
|
|
||||||
|
Requires Clang / GCC, CMake, Ninja and Git
|
||||||
|
|
||||||
|
_**Note**: Since btop uses C++ 20 features the compiler choice is important._
|
||||||
|
|
||||||
|
With LLVM:
|
||||||
|
```bash
|
||||||
|
brew update --quiet
|
||||||
|
brew install llvm@17 ninja
|
||||||
|
```
|
||||||
|
|
||||||
|
With GCC:
|
||||||
|
```bash
|
||||||
|
brew update --quiet
|
||||||
|
brew install gcc@13
|
||||||
|
|
||||||
|
2. **Clone the repository**
|
||||||
|
|
||||||
|
```bash
|
||||||
|
git clone https://github.com/aristocratos/btop.git && cd btop
|
||||||
|
```
|
||||||
|
|
||||||
|
3. **Compile**
|
||||||
|
|
||||||
|
FreeBSD 14 and later:
|
||||||
|
```bash
|
||||||
|
# Configure
|
||||||
|
cmake -B build -G Ninja
|
||||||
|
# Build
|
||||||
|
cmake --build build
|
||||||
|
```
|
||||||
|
|
||||||
|
FreeBSD 13:
|
||||||
|
```bash
|
||||||
|
# Configure
|
||||||
|
CXX=g++13 cmake -B build -G Ninja
|
||||||
|
# Build
|
||||||
|
cmake --build build
|
||||||
|
```
|
||||||
|
|
||||||
|
This will automatically build a release version of btop.
|
||||||
|
|
||||||
|
Some useful options to pass to the configure step:
|
||||||
|
|
||||||
|
| Configure flag | Description |
|
||||||
|
|---------------------------------|-------------------------------------------------------------------------|
|
||||||
|
| `-DBTOP_STATIC=<ON\|OFF>` | Enables static linking (OFF by default) |
|
||||||
|
| `-DBTOP_LTO=<ON\|OFF>` | Enables link time optimization (ON by default) |
|
||||||
|
| `-DBTOP_USE_MOLD=<ON\|OFF>` | Use mold to link btop (OFF by default) |
|
||||||
|
| `-DBTOP_PEDANTIC=<ON\|OFF>` | Compile with additional warnings (OFF by default) |
|
||||||
|
| `-DBTOP_WERROR=<ON\|OFF>` | Compile with warnings as errors (OFF by default) |
|
||||||
|
| `-DCMAKE_INSTALL_PREFIX=<path>` | The installation prefix ('/usr/local' by default) |
|
||||||
|
|
||||||
|
_**Note:** Static linking does not work with GCC._
|
||||||
|
|
||||||
|
To force a compiler, run `CXX=<compiler> cmake -B build -G Ninja`
|
||||||
|
|
||||||
|
4. **Install**
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cmake --install build
|
||||||
|
```
|
||||||
|
|
||||||
|
May require root privileges
|
||||||
|
|
||||||
|
5. **Uninstall**
|
||||||
|
|
||||||
|
CMake doesn't generate an uninstall target by default. To remove installed files, run
|
||||||
|
```
|
||||||
|
cat build/install_manifest.txt | xargs rm -irv
|
||||||
|
```
|
||||||
|
|
||||||
|
6. **Cleanup build directory**
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cmake --build build -t clean
|
||||||
|
```
|
||||||
|
|
||||||
|
</details>
|
||||||
|
|
||||||
## Compilation FreeBSD
|
## Compilation FreeBSD
|
||||||
|
|
||||||
Needs GCC 10 or higher, (GCC 11 or above strongly recommended for better CPU efficiency in the compiled binary).
|
Needs GCC 10 / Clang 16 (or higher).
|
||||||
|
|
||||||
Note that GNU make (`gmake`) is required to compile on FreeBSD.
|
Note that GNU make (`gmake`) is required to compile on FreeBSD.
|
||||||
|
|
||||||
@ -706,7 +803,6 @@ Also needs a UTF8 locale and a font that covers:
|
|||||||
```
|
```
|
||||||
|
|
||||||
</details>
|
</details>
|
||||||
|
|
||||||
<details>
|
<details>
|
||||||
|
|
||||||
<summary>
|
<summary>
|
||||||
@ -735,7 +831,7 @@ Also needs a UTF8 locale and a font that covers:
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
git clone https://github.com/aristocratos/btop.git && cd btop
|
git clone https://github.com/aristocratos/btop.git && cd btop
|
||||||
``````
|
```
|
||||||
|
|
||||||
3. **Compile**
|
3. **Compile**
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user