mirror of
https://github.com/aristocratos/btop.git
synced 2024-06-02 10:35:14 +12:00
19bcff894b
commit0267eba2bb
Merge:50bbab0
e81cf2b
Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Wed Nov 15 21:43:18 2023 +0100 Merge pull request #659 from ivanp7/patch-1 Add alternative key codes for Delete, Insert, Home, End commit50bbab0512
Merge:9edbf27
5a14c7b
Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Wed Nov 15 21:35:50 2023 +0100 Merge pull request #660 from stradicat/feature/elementarish Elementarish theme: color update according to Elementary palette commit5a14c7b6fa
Merge:979506f
71eb414
Author: Dennis Mayr <dmayr.dev@gmail.com> Date: Wed Nov 15 17:27:34 2023 -0300 Merge branch 'main' of https://github.com/stradicat/btop commit979506f18e
Author: Dennis Mayr <dmayr.dev@gmail.com> Date: Wed Nov 8 11:17:47 2023 -0300 Elementarish theme: color update according to Elementary palette commit71eb4142e8
Author: Dennis Mayr <dmayr.dev@gmail.com> Date: Wed Nov 8 11:17:47 2023 -0300 Elementarish theme: color update according to Elementary palette commite81cf2b7ff
Author: vân <3432246+ivanp7@users.noreply.github.com> Date: Tue Nov 7 15:12:27 2023 +0000 Add alternative key codes for Insert, Home, End commitf9452ff6d5
Author: vân <3432246+ivanp7@users.noreply.github.com> Date: Mon Nov 6 13:31:53 2023 +0000 Add alternative Delete key code Delete key not always produces ^[[3~, on some terminals (like st) it produces ^[[P. commit9edbf27f1b
Merge:2a864f6
ff1f51c
Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Sat Oct 21 02:09:55 2023 +0200 Merge pull request #649 from nobounce/workflow-timeout Set FreeBSD workflow timeout commitff1f51ccbb
Author: Steffen Winter <steffen.winter@proton.me> Date: Wed Oct 18 22:26:36 2023 +0200 Set FreeBSD workflow timeout Recently the FreeBSD workflow has started to hang in a boot loop when the VM starts up. The issue is being tracked upstream but there is not response at the moment. To work around this set a timeout to not waste CI minutes. Other workflows might also want this change since they don't take 20 minutes anyway. commit2a864f6f2e
Merge:636eb25
b2bf8ef
Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Sat Oct 7 10:40:54 2023 +0200 Merge pull request #643 from DecklynKern/main Fix scrollbar not clearing sometimes. commitb2bf8ef504
Author: DecklynKern <DecklynKern@gmail.com> Date: Fri Oct 6 17:33:38 2023 -0600 Fix scrollbar not clearing sometimes. commit636eb25f5e
Merge:260c0f6
b5ba2fc
Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Sat Sep 30 19:51:03 2023 +0200 Merge pull request #623 from rahulaggarwal965/main Add keybind for toggling memory display mode in PROC box commitb5ba2fc963
Author: Rahul Aggarwal <rahulaggarwal965@gmail.com> Date: Wed Sep 20 22:55:56 2023 -0400 Add keybind for toggling memory display mode in PROC box commit260c0f6623
Merge:52bfff7
e6a06eb
Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Sat Sep 30 18:56:25 2023 +0200 Merge pull request #635 from lvxnull/editorconfig Add hpp files to .editorconfig commite6a06eb729
Author: lvxnull <86745229+lvxnull@users.noreply.github.com> Date: Thu Sep 28 19:44:47 2023 +0200 Add hpp files to .editorconfig commit52bfff7ceb
Merge:1f72e56
19dbbe1
Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Sat Sep 30 18:55:08 2023 +0200 Merge pull request #636 from nobounce/performance-iili Minor string initialization improvement commit19dbbe1a17
Author: nobounce <steffen.winter@proton.me> Date: Fri Sep 29 12:20:59 2023 +0200 Minor string initialization improvement commit1f72e56c7d
Merge:278a0e6
cdcf8bc
Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Fri Sep 29 10:43:21 2023 +0200 Merge pull request #633 from crestfallnatwork/main [fix] Made disks statvfs logic asynchronous. commitcdcf8bc929
Author: crestfalln <guptahiman01@gmail.com> Date: Fri Sep 29 09:07:27 2023 +0530 fixed bug where updated disks stats overrided disk io data commit9b4e85f08d
Author: crestfalln <no-reply@crestfalln.com> Date: Thu Sep 28 04:57:05 2023 +0530 fixed bug where updated disks stats overrided disk io data commit889623874e
Author: crestfalln <no-reply@crestfalln.com> Date: Wed Sep 27 23:57:06 2023 +0530 made disks stat logic async commit278a0e6b17
Merge:d16adc9
e89519f
Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Thu Sep 28 18:32:09 2023 +0200 Merge pull request #630 from lvxnull/signal-list Fix signal list on non-linux/weird linux platforms commite89519fbb2
Author: lvxnull <86745229+lvxnull@users.noreply.github.com> Date: Sun Sep 24 21:44:38 2023 +0200 Fix signal list on non-linux/weird linux platforms commitd16adc9fd0
Merge:2c3ac48
f34b408
Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Thu Sep 28 18:20:42 2023 +0200 Merge pull request #618 from nobounce/aggregate-child-processes Add option to accumulate a child's resources in parent in tree-view commitf34b40892f
Author: nobounce <steffen.winter@proton.me> Date: Sun Sep 24 16:34:50 2023 +0200 Make process thread count better readable when wider than 5 digits commit6027cedd42
Author: nobounce <steffen.winter@proton.me> Date: Thu Sep 14 23:27:05 2023 +0200 Add option to accumulate a child's resources in parent in tree-view commit2c3ac4855d
Merge:f90dc37
5c6a281
Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Wed Sep 13 21:14:56 2023 +0200 Merge pull request #589 from nobounce/cmake Add CMake support for Linux commitf90dc37c26
Merge:0cac861
68a49c1
Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Wed Sep 13 20:27:05 2023 +0200 Merge pull request #610 from SidVeld/feature/horizon-theme Horizon theme commit5c6a281002
Author: nobounce <steffen.winter@proton.me> Date: Tue Aug 29 20:39:00 2023 +0200 Add CMake support Linux is completly supported FreeBSD is not able to create a static executable for now. See https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=273398 MacOS was not tested commit68a49c10a6
Author: SidVeld <sidveld@gmail.com> Date: Wed Sep 6 18:03:31 2023 +0300 Add horizon theme commit0cac861910
Merge:31be436
f798acd
Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Tue Sep 5 19:27:38 2023 +0200 Merge pull request #609 from scorpion-26/byteconv Fix short conversion of 1000-1023 *iB commitf798acdaf7
Author: scorpion-26 <dev.scorpion26@gmail.com> Date: Tue Sep 5 18:00:47 2023 +0200 Fix short conversion of 1000-1023*iB floating_humanizer([1000-1024], true) with base 8 returns "2K", whereas it should return "1.0K" to align with other formats. The conversion is also broken for all other units(e.g. 1023M is also broken and returns "2G") commit31be4362ce
Author: aristocratos <gnmjpl@gmail.com> Date: Sun Aug 27 02:00:07 2023 +0200 FreeBSD Github action 13.1 -> 13.2 and static libgcc and libstdc++ commitfc523fd1d0
Author: aristocratos <gnmjpl@gmail.com> Date: Sun Aug 27 01:36:26 2023 +0200 Fix for FreeBSD github action not failing "correctly"...
168 lines
4.7 KiB
CMake
168 lines
4.7 KiB
CMake
# SPDX-License-Identifier: Apache-2.0
|
|
#
|
|
# CMake configuration for btop
|
|
#
|
|
|
|
cmake_minimum_required(VERSION 3.12)
|
|
|
|
# Disable in-source builds since they would override the Makefile
|
|
if("${CMAKE_CURRENT_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_BINARY_DIR}")
|
|
message(FATAL_ERROR "In-source builds are not allowed")
|
|
endif()
|
|
|
|
project("btop"
|
|
VERSION 1.2.13
|
|
DESCRIPTION "A monitor of resources"
|
|
HOMEPAGE_URL "https://github.com/aristocratos/btop"
|
|
LANGUAGES CXX
|
|
)
|
|
|
|
# Make custom modules available
|
|
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules/")
|
|
|
|
# When the build type is not set we can't fortify
|
|
if(NOT CMAKE_BUILD_TYPE)
|
|
set(CMAKE_BUILD_TYPE Release)
|
|
endif()
|
|
|
|
set(CMAKE_CXX_STANDARD 20)
|
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
set(CMAKE_CXX_EXTENSIONS OFF)
|
|
set(CMAKE_COLOR_DIAGNOSTICS ON)
|
|
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
|
|
|
# Options
|
|
option(BTOP_STATIC "Link btop statically" OFF)
|
|
option(BTOP_LTO "Enable LTO" ON)
|
|
option(BTOP_USE_MOLD "Use mold to link btop" OFF)
|
|
option(BTOP_PEDANTIC "Enable a bunch of additional warnings" OFF)
|
|
option(BTOP_WERROR "Compile with warnings as errors" OFF)
|
|
|
|
if(BTOP_STATIC)
|
|
# Set this before calling find_package
|
|
set(CMAKE_FIND_LIBRARY_SUFFIXES ".a")
|
|
endif()
|
|
|
|
if(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
|
|
find_package(devstat REQUIRED)
|
|
find_package(kvm REQUIRED)
|
|
if(BTOP_STATIC)
|
|
find_package(elf REQUIRED)
|
|
endif()
|
|
endif()
|
|
|
|
include(CheckCXXCompilerFlag)
|
|
include(CheckIPOSupported)
|
|
|
|
add_executable(btop
|
|
src/btop.cpp
|
|
src/btop_config.cpp
|
|
src/btop_draw.cpp
|
|
src/btop_input.cpp
|
|
src/btop_menu.cpp
|
|
src/btop_shared.cpp
|
|
src/btop_theme.cpp
|
|
src/btop_tools.cpp
|
|
)
|
|
|
|
# NOTE: Checks can be simplified with CMake 3.25
|
|
if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
|
|
target_sources(btop PRIVATE
|
|
src/osx/btop_collect.cpp
|
|
src/osx/sensors.cpp
|
|
src/osx/smc.cpp
|
|
)
|
|
elseif(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
|
|
target_sources(btop PRIVATE src/freebsd/btop_collect.cpp)
|
|
elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
|
target_sources(btop PRIVATE src/linux/btop_collect.cpp)
|
|
else()
|
|
message(FATAL_ERROR "${CMAKE_SYSTEM_NAME} is not supported")
|
|
endif()
|
|
|
|
# Check for and enable LTO
|
|
check_ipo_supported(RESULT ipo_supported)
|
|
if(ipo_supported AND BTOP_LTO)
|
|
set_target_properties(btop PROPERTIES INTERPROCEDURAL_OPTIMIZATION ON)
|
|
endif()
|
|
|
|
# TODO: enable more warnings in coordination with upstream
|
|
target_compile_options(btop PRIVATE
|
|
-Wall -Wextra -Wpedantic
|
|
-ftree-vectorize -fstack-clash-protection
|
|
)
|
|
if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
|
|
target_compile_options(btop PRIVATE
|
|
-Wheader-hygiene -Wgnu -Wthread-safety
|
|
)
|
|
endif()
|
|
|
|
if(BTOP_PEDANTIC)
|
|
target_compile_options(btop PRIVATE
|
|
-Wshadow -Wnon-virtual-dtor -Wold-style-cast -Wcast-align -Wunused
|
|
-Woverloaded-virtual -Wconversion -Wsign-conversion -Wdouble-promotion
|
|
-Wformat=2 -Wimplicit-fallthrough -Weffc++
|
|
)
|
|
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
|
target_compile_options(btop PRIVATE
|
|
-Wduplicated-cond -Wduplicated-branches -Wlogical-op -Wnull-dereference
|
|
-Wuseless-cast
|
|
)
|
|
endif()
|
|
endif()
|
|
|
|
if(BTOP_WERROR)
|
|
target_compile_options(btop PRIVATE -Werror)
|
|
endif()
|
|
|
|
check_cxx_compiler_flag(-fstack-protector CXX_HAS_FSTACK_PROTECTOR)
|
|
if(CXX_HAS_FSTACK_PROTECTOR)
|
|
target_compile_options(btop PRIVATE -fstack-protector)
|
|
endif()
|
|
|
|
check_cxx_compiler_flag(-fcf-protection CXX_HAS_FCF_PROTECTION)
|
|
if(CXX_HAS_FCF_PROTECTION)
|
|
target_compile_options(btop PRIVATE -fcf-protection)
|
|
endif()
|
|
|
|
target_compile_definitions(btop PRIVATE
|
|
_FILE_OFFSET_BITS=64
|
|
_GLIBCXX_ASSERTIONS _LIBCPP_ENABLE_ASSERTIONS=1
|
|
# Only has an effect with optimizations enabled
|
|
$<$<NOT:$<CONFIG:Debug>>:_FORTIFY_SOURCE=2>
|
|
)
|
|
|
|
target_include_directories(btop SYSTEM PRIVATE include)
|
|
|
|
# mold
|
|
if(BTOP_USE_MOLD)
|
|
target_link_options(btop PRIVATE -fuse-ld=mold)
|
|
endif()
|
|
|
|
if(BTOP_STATIC)
|
|
target_compile_definitions(btop PRIVATE STATIC_BUILD)
|
|
target_link_options(btop PRIVATE -static LINKER:--fatal-warnings)
|
|
endif()
|
|
|
|
# Add libraries
|
|
set(THREADS_PREFER_PTHREAD_FLAG ON)
|
|
find_package(Threads REQUIRED)
|
|
target_link_libraries(btop PRIVATE Threads::Threads)
|
|
|
|
if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
|
|
target_link_libraries(btop PRIVATE $<LINK_LIBRARY:FRAMEWORK,CoreFoundation)
|
|
target_link_libraries(btop PRIVATE $<LINK_LIBRARY:FRAMEWORK,IOKit)
|
|
elseif(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
|
|
target_link_libraries(btop PRIVATE devstat::devstat kvm::kvm)
|
|
if(BTOP_STATIC)
|
|
target_link_libraries(btop PRIVATE elf::elf)
|
|
endif()
|
|
endif()
|
|
|
|
install(TARGETS btop RUNTIME)
|
|
install(FILES "btop.desktop" DESTINATION "share/applications")
|
|
install(FILES "Img/icon.png" DESTINATION "share/icons/hicolor/48x48/apps" RENAME "btop.png")
|
|
install(FILES "Img/icon.svg" DESTINATION "share/icons/hicolor/scalable/apps" RENAME "btop.svg")
|
|
install(DIRECTORY "themes" DESTINATION "share/btop")
|
|
|