From 9d3a58c103e2c2475461a964a9012ac76944cac7 Mon Sep 17 00:00:00 2001 From: SASANO Takayoshi Date: Wed, 13 Mar 2019 20:18:12 +0900 Subject: [PATCH 1/4] of Linux automatically includes , but OpenBSD's not. So added it. --- NetworkInfo.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/NetworkInfo.cpp b/NetworkInfo.cpp index eb3ed6e..0c27b6b 100644 --- a/NetworkInfo.cpp +++ b/NetworkInfo.cpp @@ -28,6 +28,7 @@ #include #if !defined(_WIN32) && !defined(_WIN64) #include +#include #include #include #include From e5a1ed5de59055f393ef3aa1a21b68e9b13f04d2 Mon Sep 17 00:00:00 2001 From: SASANO Takayoshi Date: Wed, 13 Mar 2019 20:29:45 +0900 Subject: [PATCH 2/4] There is no I2C related code, removed. --- SerialController.cpp | 3 --- 1 file changed, 3 deletions(-) diff --git a/SerialController.cpp b/SerialController.cpp index 3171157..43e9e2a 100644 --- a/SerialController.cpp +++ b/SerialController.cpp @@ -35,9 +35,6 @@ #include #include #include -#if !defined(__APPLE__) -#include -#endif #endif From 4e910ef9700c99b886bd3b56cd8e20daefd7b201 Mon Sep 17 00:00:00 2001 From: SASANO Takayoshi Date: Wed, 13 Mar 2019 20:30:49 +0900 Subject: [PATCH 3/4] I2C support is only Linux. So code should be compiled under Linux, not avoiding Apple. --- I2CController.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/I2CController.cpp b/I2CController.cpp index b44ab03..247129c 100644 --- a/I2CController.cpp +++ b/I2CController.cpp @@ -63,7 +63,7 @@ int CI2CController::write(const unsigned char* buffer, unsigned int length) #include #include #include -#if !defined(__APPLE__) +#if defined(__linux__) #include #endif @@ -81,7 +81,7 @@ bool CI2CController::open() { assert(m_fd == -1); -#if !defined(__APPLE__) +#if defined(__linux__) m_fd = ::open(m_device.c_str(), O_RDWR); if (m_fd < 0) { LogError("Cannot open device - %s", m_device.c_str()); @@ -100,7 +100,7 @@ bool CI2CController::open() return false; } #else - #warning "I2C controller does not support OSX" + #warning "I2C controller supports Linux only" #endif return true; @@ -117,7 +117,7 @@ int CI2CController::read(unsigned char* buffer, unsigned int length) unsigned int offset = 0U; while (offset < length) { -#if !defined(__APPLE__) +#if defined(__linux__) ssize_t n = ::read(m_fd, buffer + offset, 1U); if (n < 0) { if (errno != EAGAIN) { @@ -145,7 +145,7 @@ int CI2CController::write(const unsigned char* buffer, unsigned int length) unsigned int ptr = 0U; while (ptr < length) { ssize_t n = 0U; -#if !defined(__APPLE__) +#if defined(__linux__) n = ::write(m_fd, buffer + ptr, 1U); #endif if (n < 0) { From 7cf1e602e6bb9b6b9dedb269d62fd838de686d29 Mon Sep 17 00:00:00 2001 From: SASANO Takayoshi Date: Wed, 13 Mar 2019 20:33:02 +0900 Subject: [PATCH 4/4] Use system default compiler. At least there is no difference under Linux. OpenBSD's gcc is old (4.2) so we have to use clang-6.0.0 compiler. --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 6c02bec..45c3c9c 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ # This makefile is for all platforms, but doesn't include support for the HD44780, OLED, or PCF8574 displays on the Raspberry Pi. -CC = gcc -CXX = g++ +CC = cc +CXX = c++ CFLAGS = -g -O3 -Wall -std=c++0x -pthread LIBS = -lpthread LDFLAGS = -g