From b94247ce747fd93bab0161b1a37a9bf6a77a44c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=98=99=E2=97=A6=20The=20Tablet=20=E2=9D=80=20GamerGirla?= =?UTF-8?q?ndCo=20=E2=97=A6=E2=9D=A7?= Date: Fri, 6 Sep 2024 15:44:41 -0400 Subject: [PATCH] android --- CMakeLists.txt | 5 +++-- common/load.h | 4 ++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b90a772..7773958 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -44,7 +44,7 @@ if(NOT CMAKE_BUILD_TYPE) endif(NOT CMAKE_BUILD_TYPE) # detect system type -if(CMAKE_SYSTEM_NAME MATCHES "Linux") +if(CMAKE_SYSTEM_NAME MATCHES "Linux" OR CMAKE_SYSTEM_NAME MATCHES "Android") message(STATUS "Linux detected") set(METER_SOURCES "linux/memory.cc" "linux/cpu.cc" "common/load.cc") elseif(CMAKE_SYSTEM_NAME MATCHES "Darwin") @@ -72,7 +72,8 @@ endif() # set common source files set(COMMON_SOURCES "common/main.cc" "common/memory.cc" "common/graph.cc" "common/powerline.cc") - +set(CMAKE_CXX_COMPILER "clang++") +set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -stdlib=libc++ -lc++abi") add_executable(tmux-mem-cpu-load ${COMMON_SOURCES} ${METER_SOURCES}) # add binary tree so we find version.h target_include_directories(tmux-mem-cpu-load PUBLIC "${PROJECT_BINARY_DIR}") diff --git a/common/load.h b/common/load.h index 5f1f98b..963ba52 100644 --- a/common/load.h +++ b/common/load.h @@ -21,6 +21,10 @@ #define LOAD_H_ #include +#include + +extern "C" int getloadavg(double* loadavg, int nelem); + std::string load_string( bool use_colors = false, bool use_powerline_left = false, bool use_powerline_right = false,