: bharatvaj/forwarder

commit 471c65878a06ca2b3f8307472448e59469b85f21
parent 8559076b1997c7b600b830f4d54333c5aedbb7c4
Author: Bharatvaj H <bharatvajph@gmail.com>
Date: Fri, 15 Mar 2019 19:22:43 +0000

3rdparty lib xbee is now exported as interface rather than hard install
5 files changed, 11 insertions(+), 7 deletions(-)
diff --git a/.gitignore b/.gitignore
@@ -1,2 +1,3 @@
 build/
 deps/
+.vscode/
diff --git a/3rdparty/xbee/CMakeLists.txt b/3rdparty/xbee/CMakeLists.txt
@@ -1,10 +1,10 @@
-cmake_minimum_required(VERSION 3.0)
+cmake_minimum_required(VERSION 3.3)
 
 project(xbee LANGUAGES C)
 
+target_compile_definitions(xbee PUBLIC POSIX)
 file(GLOB_RECURSE xbee_HDRS "include/*.h")
 file(GLOB_RECURSE xbee_SRCS "src/util/*.c" "src/posix/*.c" "src/wpan/*.c" "src/xbee/*.c" "src/zigbee/*.c")
-add_definitions(-DPOSIX)
 add_library(xbee ${xbee_HDRS} ${xbee_SRCS})
 target_include_directories(xbee PUBLIC
     $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
diff --git a/CMakeLists.txt b/CMakeLists.txt
@@ -5,11 +5,14 @@ find_package(comm)
 find_package(Threads)
 add_subdirectory(deps/xbee_ansic_library)
 
-add_definitions(-DPOSIX)
 add_executable(forwarder forwarder.cpp)
 
+#FIXME should be obtained from xbee
+target_compile_definitions(forwarder PUBLIC POSIX)
+
 target_include_directories(forwarder PRIVATE ${COMM_INCLUDE_LIBS})
 target_include_directories(forwarder PRIVATE include)
+target_include_directories(forwarder PUBLIC xbee)
 
 target_link_libraries(forwarder ${COMM_LIBS})
 target_link_libraries(forwarder ${CMAKE_THREAD_LIBS_INIT})
diff --git a/depinstall.sh b/depinstall.sh
@@ -29,7 +29,7 @@ downloadAndInstallXBee() {
 	url=https://github.com/digidotcom/xbee_ansic_library 
 	str=${url##*/}
 	git clone $url $str
-	cp ../3rdparty/xbee_CMakeLists.txt $str/CMakeLists.txt
+	cp ../3rdparty/xbee/CMakeLists.txt $str/CMakeLists.txt
 	makeAndInstall $str
 }
 
diff --git a/include/ZigBee.hpp b/include/ZigBee.hpp
@@ -9,9 +9,9 @@
 #include <sys/socket.h>
 #include <net/if.h>
 
-#include "xbee/device.h"
-#include "xbee/atcmd.h"
-#include "xbee/wpan.h"
+#include <xbee/device.h>
+#include <xbee/atcmd.h>
+#include <xbee/wpan.h>
 #include <xbee/sxa.h>
 
 #include <Network.hpp>