Add CMake compile instructions for macOS

This commit is contained in:
Steffen Winter 2023-12-05 01:00:14 +01:00
parent 97b35d9720
commit f4b14ce97e
No known key found for this signature in database
GPG key ID: D4053C3600EF3B1F

View file

@ -326,7 +326,7 @@ Also needs a UTF8 locale and a font that covers:
## Compilation Linux
Needs GCC 10 / Clang 16 (or higher).
Requires at least GCC 10 or Clang 16.
The makefile also needs GNU coreutils and `sed` (should already be installed on any modern distribution).
@ -359,11 +359,9 @@ Also needs a UTF8 locale and a font that covers:
```
<details>
<summary>
### With Make
</summary>
1. **Install dependencies (example for Ubuntu 21.04 Hirsute)**
@ -451,11 +449,9 @@ Also needs a UTF8 locale and a font that covers:
</details>
<details>
<summary>
### With CMake (Community maintained)
</summary>
1. **Install build dependencies**
@ -498,7 +494,7 @@ Also needs a UTF8 locale and a font that covers:
| `-DBTOP_RSMI_STATIC=<ON\|OFF>` | Build and link the ROCm SMI library statically (OFF by default) |
| `-DCMAKE_INSTALL_PREFIX=<path>` | The installation prefix ('/usr/local' by default) |
To force a compiler, run `CXX=<compiler> cmake -B build -G Ninja`
To force any other compiler, run `CXX=<compiler> cmake -B build -G Ninja`
4. **Install**
@ -525,7 +521,7 @@ Also needs a UTF8 locale and a font that covers:
## Compilation macOS OSX
Needs GCC 10 / Clang 16 (or higher).
Requires at least GCC 10 or Clang 16.
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.
@ -534,11 +530,9 @@ Also needs a UTF8 locale and a font that covers:
Install and use Homebrew or MacPorts package managers for easy dependency installation
<details>
<summary>
### With Make
</summary>
1. **Install dependencies (example for Homebrew)**
@ -621,30 +615,20 @@ Also needs a UTF8 locale and a font that covers:
</details>
<details>
<summary>
### With CMake (Community maintained)
</summary>
1. **Install build dependencies**
Requires Clang / GCC, CMake, Ninja and Git
Requires Clang, 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
brew install cmake git llvm ninja
```
With GCC:
```bash
brew update --quiet
brew install gcc@13
2. **Clone the repository**
```bash
@ -653,21 +637,18 @@ Also needs a UTF8 locale and a font that covers:
3. **Compile**
FreeBSD 14 and later:
```bash
# Configure
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
# Build
cmake --build build
```
FreeBSD 13:
```bash
# Configure
CXX=g++13 cmake -B build -G Ninja
# Build
cmake --build build
```
_**Note:** btop uses lots of C++ 20 features, so it's necessary to be specific about the compiler and the standard library. If you get a compile with Apple-Clang or GCC, feel free to add the instructions here._
This will automatically build a release version of btop.
@ -675,16 +656,13 @@ Also needs a UTF8 locale and a font that covers:
| 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`
To force any specific compiler, run `CXX=<compiler> cmake -B build -G Ninja`
4. **Install**
@ -711,16 +689,14 @@ Also needs a UTF8 locale and a font that covers:
## Compilation FreeBSD
Needs GCC 10 / Clang 16 (or higher).
Requires at least GCC 10 or Clang 16.
Note that GNU make (`gmake`) is required to compile on FreeBSD.
<details>
<summary>
### With gmake
</summary>
1. **Install dependencies**
@ -804,11 +780,9 @@ Also needs a UTF8 locale and a font that covers:
</details>
<details>
<summary>
### With CMake (Community maintained)
</summary>
1. **Install build dependencies**
@ -866,7 +840,7 @@ Also needs a UTF8 locale and a font that covers:
_**Note:** Static linking does not work with GCC._
To force a compiler, run `CXX=<compiler> cmake -B build -G Ninja`
To force any other compiler, run `CXX=<compiler> cmake -B build -G Ninja`
4. **Install**