Skip to content

Commit

Permalink
Setup cmake files and project code for Objective-C code #17
Browse files Browse the repository at this point in the history
We want to use CoreWLAN framework.
  • Loading branch information
npyl committed Jul 30, 2018
1 parent aa69475 commit 23b27ff
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 4 deletions.
11 changes: 8 additions & 3 deletions cmake/ConkyPlatformChecks.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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_)
Expand Down
2 changes: 1 addition & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
Expand Down
16 changes: 16 additions & 0 deletions src/darwin.cc → src/darwin.mm
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,10 @@
#include <IntelPowerGadget/EnergyLib.h>
#endif

#ifdef BUILD_WLAN
#import <CoreWLAN/CoreWLAN.h>
#endif

/* clock_gettime includes */
#ifndef HAVE_CLOCK_GETTIME
#include <errno.h>
Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand Down

0 comments on commit 23b27ff

Please sign in to comment.