From 23b27ffdc78b4a59cd63c6010a6d4eb2e1cc5f74 Mon Sep 17 00:00:00 2001 From: npyl Date: Mon, 30 Jul 2018 17:22:02 +0300 Subject: [PATCH] Setup cmake files and project code for Objective-C code #17 We want to use CoreWLAN framework. --- cmake/ConkyPlatformChecks.cmake | 11 ++++++++--- src/CMakeLists.txt | 2 +- src/{darwin.cc => darwin.mm} | 16 ++++++++++++++++ 3 files changed, 25 insertions(+), 4 deletions(-) rename src/{darwin.cc => darwin.mm} (99%) diff --git a/cmake/ConkyPlatformChecks.cmake b/cmake/ConkyPlatformChecks.cmake index 7c6415714..39cd66d7c 100644 --- a/cmake/ConkyPlatformChecks.cmake +++ b/cmake/ConkyPlatformChecks.cmake @@ -137,15 +137,20 @@ if(BUILD_NCURSES AND OS_DARWIN) set(conky_libs ${conky_libs} -lncurses) endif(BUILD_NCURSES AND OS_DARWIN) -if(BUILD_MATH) - set(conky_libs ${conky_libs} -lm) -endif(BUILD_MATH) +if(BUILD_WLAN AND OS_DARWIN) + find_library(CW CoreWLAN) + set(conky_libs ${conky_libs} ${CW}) +endif(BUILD_WLAN AND OS_DARWIN) if(OS_DARWIN AND BUILD_IPGFREQ) find_library(IPG IntelPowerGadget) set(conky_libs ${conky_libs} ${IPG}) endif(OS_DARWIN AND BUILD_IPGFREQ) +if(BUILD_MATH) + set(conky_libs ${conky_libs} -lm) +endif(BUILD_MATH) + if(BUILD_ICAL) check_include_files(libical/ical.h ICAL_H_) if(NOT ICAL_H_) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 5598a34f0..fbe5432df 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -134,7 +134,7 @@ endif(OS_HAIKU) if(OS_DARWIN) set(darwin - darwin.cc darwin.h + darwin.mm darwin.h darwin_sip.h i18n.h ) diff --git a/src/darwin.cc b/src/darwin.mm similarity index 99% rename from src/darwin.cc rename to src/darwin.mm index d66498609..d83e3d1e5 100644 --- a/src/darwin.cc +++ b/src/darwin.mm @@ -72,6 +72,10 @@ #include #endif +#ifdef BUILD_WLAN +#import +#endif + /* clock_gettime includes */ #ifndef HAVE_CLOCK_GETTIME #include @@ -636,6 +640,14 @@ int update_meminfo() { return 0; } +#ifdef BUILD_WLAN + +void update_wlan_stats(struct net_stat *ns) { + +} + +#endif + int update_net_stats() { struct net_stat *ns; double delta; @@ -655,6 +667,10 @@ int update_net_stats() { if ((ifa->ifa_flags & IFF_UP) != 0u) { struct ifaddrs *iftmp; +#ifdef BUILD_WLAN + update_wlan_stats(ns); +#endif + ns->up = 1; last_recv = ns->recv; last_trans = ns->trans;