Skip to content
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
11 changes: 11 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -198,11 +198,22 @@ if(BTOP_STATIC)
target_link_options(libbtop PUBLIC -static LINKER:--fatal-warnings)
endif()

# Enable GPU support on Apple Silicon
if(APPLE AND BTOP_GPU)
target_compile_definitions(libbtop PUBLIC GPU_SUPPORT)
endif()

# Other platform dependent flags
if(APPLE)
target_link_libraries(libbtop
$<LINK_LIBRARY:FRAMEWORK,CoreFoundation> $<LINK_LIBRARY:FRAMEWORK,IOKit>
)
if(BTOP_GPU)
find_library(IOREPORT_LIB IOReport)
if(IOREPORT_LIB)
target_link_libraries(libbtop ${IOREPORT_LIB})
endif()
endif()
elseif(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD" OR CMAKE_SYSTEM_NAME STREQUAL "MidnightBSD")
# Avoid version mismatch for libstdc++ when a specific version of GCC is installed and not the
# default one since all use the default ones RPATH
Expand Down
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ ifeq ($(PLATFORM_LC)$(ARCH),linuxx86_64)
INTEL_GPU_SUPPORT := true
endif
endif
ifeq ($(PLATFORM_LC),macos)
GPU_SUPPORT := true
endif
ifneq ($(GPU_SUPPORT),true)
GPU_SUPPORT := false
endif
Expand Down Expand Up @@ -115,7 +118,7 @@ else ifeq ($(PLATFORM_LC),$(filter $(PLATFORM_LC),freebsd midnightbsd))
else ifeq ($(PLATFORM_LC),macos)
PLATFORM_DIR := osx
THREADS := $(shell sysctl -n hw.ncpu || echo 1)
override ADDFLAGS += -framework IOKit -framework CoreFoundation -Wno-format-truncation
override ADDFLAGS += -framework IOKit -framework CoreFoundation -lIOReport -Wno-format-truncation
SU_GROUP := wheel
else ifeq ($(PLATFORM_LC),openbsd)
PLATFORM_DIR := openbsd
Expand Down
3 changes: 3 additions & 0 deletions src/btop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,9 @@ void clean_quit(int sig) {
#ifdef GPU_SUPPORT
Gpu::Nvml::shutdown();
Gpu::Rsmi::shutdown();
#ifdef __APPLE__
Gpu::AppleSilicon::shutdown();
#endif
#endif


Expand Down
4 changes: 2 additions & 2 deletions src/btop_config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ namespace Config {
{"rsmi_measure_pcie_speeds",
"#* Measure PCIe throughput on AMD cards, may impact performance on certain cards."},
{"gpu_mirror_graph", "#* Horizontally mirror the GPU graph."},
{"shown_gpus", "#* Set which GPU vendors to show. Available values are \"nvidia amd intel\""},
{"shown_gpus", "#* Set which GPU vendors to show. Available values are \"nvidia amd intel apple\""},
{"custom_gpu_name0", "#* Custom gpu0 model name, empty string to disable."},
{"custom_gpu_name1", "#* Custom gpu1 model name, empty string to disable."},
{"custom_gpu_name2", "#* Custom gpu2 model name, empty string to disable."},
Expand Down Expand Up @@ -288,7 +288,7 @@ namespace Config {
{"custom_gpu_name4", ""},
{"custom_gpu_name5", ""},
{"show_gpu_info", "Auto"},
{"shown_gpus", "nvidia amd intel"}
{"shown_gpus", "nvidia amd intel apple"}
Comment thread
gneitzke marked this conversation as resolved.
#endif
};
std::unordered_map<std::string_view, string> stringsTmp;
Expand Down
3 changes: 2 additions & 1 deletion src/btop_menu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -598,7 +598,8 @@ namespace Menu {
"Manually set which gpu vendors to show.",
"",
"Available values are",
"\"nvidia\", \"amd\", and \"intel\".",
"\"nvidia\", \"amd\", \"intel\",",
"and \"apple\".",
"Separate values with whitespace.",
"",
"A restart is required to apply changes."},
Expand Down
5 changes: 5 additions & 0 deletions src/btop_shared.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,11 @@ namespace Gpu {
namespace Rsmi {
extern bool shutdown();
}
#ifdef __APPLE__
namespace AppleSilicon {
extern bool shutdown();
}
#endif

//* Collect gpu stats and temperatures
auto collect(bool no_update = false) -> vector<gpu_info>&;
Expand Down
Loading
Loading