mirror of
https://github.com/aristocratos/btop.git
synced 2024-09-30 09:06:17 +13:00
Merge pull request #718 from imwints/cmake-openbsd
This commit is contained in:
commit
91e137a411
3 changed files with 77 additions and 1 deletions
|
@ -65,6 +65,8 @@ if(APPLE)
|
||||||
target_sources(btop PRIVATE src/osx/btop_collect.cpp src/osx/sensors.cpp src/osx/smc.cpp)
|
target_sources(btop PRIVATE src/osx/btop_collect.cpp src/osx/sensors.cpp src/osx/smc.cpp)
|
||||||
elseif(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
|
elseif(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
|
||||||
target_sources(btop PRIVATE src/freebsd/btop_collect.cpp)
|
target_sources(btop PRIVATE src/freebsd/btop_collect.cpp)
|
||||||
|
elseif(CMAKE_SYSTEM_NAME STREQUAL "OpenBSD")
|
||||||
|
target_sources(btop PRIVATE src/openbsd/btop_collect.cpp src/openbsd/sysctlbyname.cpp)
|
||||||
elseif(LINUX)
|
elseif(LINUX)
|
||||||
target_sources(btop PRIVATE src/linux/btop_collect.cpp)
|
target_sources(btop PRIVATE src/linux/btop_collect.cpp)
|
||||||
else()
|
else()
|
||||||
|
@ -185,6 +187,12 @@ elseif(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
|
||||||
find_package(kvm REQUIRED)
|
find_package(kvm REQUIRED)
|
||||||
target_link_libraries(btop elf::elf kvm::kvm)
|
target_link_libraries(btop elf::elf kvm::kvm)
|
||||||
endif()
|
endif()
|
||||||
|
elseif(CMAKE_SYSTEM_NAME STREQUAL "OpenBSD")
|
||||||
|
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||||
|
target_compile_options(btop PRIVATE -static-libstdc++)
|
||||||
|
endif()
|
||||||
|
find_package(kvm REQUIRED)
|
||||||
|
target_link_libraries(btop kvm::kvm)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
install(TARGETS btop RUNTIME)
|
install(TARGETS btop RUNTIME)
|
||||||
|
|
68
README.md
68
README.md
|
@ -995,6 +995,74 @@ If you have an AMD GPU `rocm_smi_lib` is required, which may or may not be packa
|
||||||
gmake help
|
gmake help
|
||||||
```
|
```
|
||||||
|
|
||||||
|
</details>
|
||||||
|
<details>
|
||||||
|
<summary>
|
||||||
|
|
||||||
|
### With CMake (Community maintained)
|
||||||
|
</summary>
|
||||||
|
|
||||||
|
1. **Install build dependencies**
|
||||||
|
|
||||||
|
Requires GCC, CMake, Ninja and Git
|
||||||
|
|
||||||
|
_**Note:** LLVM's libc++ shipped with OpenBSD 7.4 is too old and cannot compile btop._
|
||||||
|
|
||||||
|
```bash
|
||||||
|
pkg_add cmake g++%11 git ninja
|
||||||
|
```
|
||||||
|
|
||||||
|
2. **Clone the repository**
|
||||||
|
|
||||||
|
```bash
|
||||||
|
git clone https://github.com/aristocratos/btop.git && cd btop
|
||||||
|
```
|
||||||
|
|
||||||
|
3. **Compile**
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Configure
|
||||||
|
CXX=eg++ 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_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) |
|
||||||
|
| `-DBTOP_FORTIFY=<ON\|OFF>` | Detect buffer overflows with `_FORTIFY_SOURCE=3` (ON by default) |
|
||||||
|
| `-DCMAKE_INSTALL_PREFIX=<path>` | The installation prefix ('/usr/local' by default) |
|
||||||
|
|
||||||
|
To force any other 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>
|
</details>
|
||||||
|
|
||||||
## Installing the snap
|
## Installing the snap
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
# Find libkvm, the Kernel Data Access Library
|
# Find libkvm, the Kernel Data Access Library
|
||||||
#
|
#
|
||||||
|
|
||||||
if(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
|
if(BSD)
|
||||||
find_path(kvm_INCLUDE_DIR NAMES kvm.h)
|
find_path(kvm_INCLUDE_DIR NAMES kvm.h)
|
||||||
find_library(kvm_LIBRARY NAMES kvm)
|
find_library(kvm_LIBRARY NAMES kvm)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue