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,