|
|
@ -0,0 +1,129 @@ |
|
|
|
From 632695fe3ee704c1c1c539d79172ac0f9f9ce77b Mon Sep 17 00:00:00 2001 |
|
|
|
From: David Woodhouse <dwmw2@infradead.org> |
|
|
|
Date: Thu, 4 Jun 2020 12:41:27 +0100 |
|
|
|
Subject: [PATCH] Fix up OpenZWave include path handling |
|
|
|
MIME-Version: 1.0 |
|
|
|
Content-Type: text/plain; charset=UTF-8 |
|
|
|
Content-Transfer-Encoding: 8bit |
|
|
|
|
|
|
|
The path specified by the pkg-config file will be, for example, |
|
|
|
/usr/include/openzwave. |
|
|
|
|
|
|
|
That directory needs to be on the compiler's include path, because |
|
|
|
OpenZWave's own include files assume they can include each other |
|
|
|
simply as (e.g.) "ValueIDIndexes.h"; not "openzwave/ValueIDIndexes.h" |
|
|
|
|
|
|
|
Our own files do include <openzwave/Foo.h> though, which means that |
|
|
|
the *parent* directory needs to be on the compilers's include path |
|
|
|
too. We generally get lucky because /usr/include is automatically |
|
|
|
included, so we find /usr/include/openzwave/Foo.h anyway. |
|
|
|
|
|
|
|
Fix our C files to rely on the correct include path discovered from |
|
|
|
pkg-config, and to include OpenZWave headers by name without the |
|
|
|
erroneous openzwave/ prefix. |
|
|
|
|
|
|
|
That means we can fix the ../open-zwave-read-only static build to use |
|
|
|
the header files directly from there just like it does the static |
|
|
|
library .a file, without requiring the 'sudo make install' step — and |
|
|
|
without suffering a mismatch of static openzwave build vs. headers of |
|
|
|
a different version that were installed on the system, which could |
|
|
|
previously happen. |
|
|
|
|
|
|
|
Tested with both static and dynamic builds of OpenZWave. |
|
|
|
---
|
|
|
|
CMakeLists.txt | 11 ++++------- |
|
|
|
hardware/OpenZWave.cpp | 8 ++++---- |
|
|
|
hardware/openzwave/control_panel/ozwcp.cpp | 10 +++++----- |
|
|
|
hardware/openzwave/control_panel/ozwcp.h | 4 ++-- |
|
|
|
4 files changed, 15 insertions(+), 18 deletions(-) |
|
|
|
|
|
|
|
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
|
|
|
index fa5b3099d..1f4b6fb57 100644
|
|
|
|
--- a/CMakeLists.txt
|
|
|
|
+++ b/CMakeLists.txt
|
|
|
|
@@ -694,6 +694,7 @@ endif(WITH_LIBUSB)
|
|
|
|
# |
|
|
|
if(USE_STATIC_OPENZWAVE) |
|
|
|
find_library(OpenZWave NAMES libopenzwave.a HINTS "../open-zwave-read-only" "../open-zwave-read-only/cpp/build") |
|
|
|
+ find_path(OPENZWAVE_INCLUDE_DIRS NAMES OZWException.h HINTS "../open-zwave-read-only/cpp/src")
|
|
|
|
set(OPENZWAVE_LIB ${OpenZWave}) |
|
|
|
else() |
|
|
|
pkg_check_modules(OPENZWAVE libopenzwave) |
|
|
|
@@ -707,16 +708,12 @@ IF(OpenZWave)
|
|
|
|
message(STATUS "OpenZWave library found at: ${OpenZWave}") |
|
|
|
target_link_libraries(domoticz ${OpenZWave}) |
|
|
|
|
|
|
|
- find_path(OPENZWAVE_INCLUDE_DIRS NAMES openzwave/Manager.h)
|
|
|
|
+ find_path(OPENZWAVE_INCLUDE_DIRS NAMES OZWException.h)
|
|
|
|
if (OPENZWAVE_INCLUDE_DIRS) |
|
|
|
- IF(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
|
|
|
|
- include_directories(${OPENZWAVE_INCLUDE_DIRS})
|
|
|
|
- ELSE()
|
|
|
|
- include_directories(${OPENZWAVE_INCLUDE_DIRS}/openzwave)
|
|
|
|
- ENDIF()
|
|
|
|
+ include_directories(${OPENZWAVE_INCLUDE_DIRS})
|
|
|
|
message(STATUS "OpenZWave includes found at: ${OPENZWAVE_INCLUDE_DIRS}") |
|
|
|
else() |
|
|
|
- message(FATAL_ERROR "OpenZWave includes not found. Did you not issue 'sudo make install' after building OpenZWave?")
|
|
|
|
+ message(FATAL_ERROR "OpenZWave includes not found.")
|
|
|
|
endif (OPENZWAVE_INCLUDE_DIRS) |
|
|
|
add_definitions(-DWITH_OPENZWAVE) |
|
|
|
ELSE() |
|
|
|
diff --git a/hardware/OpenZWave.cpp b/hardware/OpenZWave.cpp
|
|
|
|
index 272e3d0a7..a226a8924 100644
|
|
|
|
--- a/hardware/OpenZWave.cpp
|
|
|
|
+++ b/hardware/OpenZWave.cpp
|
|
|
|
@@ -22,10 +22,10 @@
|
|
|
|
#include "../main/localtime_r.h" |
|
|
|
|
|
|
|
//OpenZWave includes |
|
|
|
-#include <openzwave/Options.h>
|
|
|
|
-#include <openzwave/Manager.h>
|
|
|
|
-#include <openzwave/platform/Log.h>
|
|
|
|
-#include <openzwave/ValueIDIndexesDefines.h>
|
|
|
|
+#include <Options.h>
|
|
|
|
+#include <Manager.h>
|
|
|
|
+#include <platform/Log.h>
|
|
|
|
+#include <ValueIDIndexesDefines.h>
|
|
|
|
|
|
|
|
#include "ZWaveCommands.h" |
|
|
|
|
|
|
|
diff --git a/hardware/openzwave/control_panel/ozwcp.cpp b/hardware/openzwave/control_panel/ozwcp.cpp
|
|
|
|
index 0b21a9cf3..5e401b2f1 100644
|
|
|
|
--- a/hardware/openzwave/control_panel/ozwcp.cpp
|
|
|
|
+++ b/hardware/openzwave/control_panel/ozwcp.cpp
|
|
|
|
@@ -39,11 +39,11 @@
|
|
|
|
#include <stdlib.h> |
|
|
|
#include <time.h> |
|
|
|
#include <string.h> |
|
|
|
-#include <openzwave/Options.h>
|
|
|
|
-#include <openzwave/Manager.h>
|
|
|
|
-#include <openzwave/Node.h>
|
|
|
|
-#include <openzwave/Group.h>
|
|
|
|
-#include <openzwave/Notification.h>
|
|
|
|
+#include <Options.h>
|
|
|
|
+#include <Manager.h>
|
|
|
|
+#include <Node.h>
|
|
|
|
+#include <Group.h>
|
|
|
|
+#include <Notification.h>
|
|
|
|
#include "../../../main/Logger.h" |
|
|
|
|
|
|
|
#include <sys/stat.h> |
|
|
|
diff --git a/hardware/openzwave/control_panel/ozwcp.h b/hardware/openzwave/control_panel/ozwcp.h
|
|
|
|
index ebfef1791..96d14b3bf 100644
|
|
|
|
--- a/hardware/openzwave/control_panel/ozwcp.h
|
|
|
|
+++ b/hardware/openzwave/control_panel/ozwcp.h
|
|
|
|
@@ -38,8 +38,8 @@
|
|
|
|
|
|
|
|
#include <list> |
|
|
|
#include <algorithm> |
|
|
|
-#include <openzwave/Driver.h>
|
|
|
|
-#include <openzwave/Notification.h>
|
|
|
|
+#include <Driver.h>
|
|
|
|
+#include <Notification.h>
|
|
|
|
|
|
|
|
#define MAX_NODES 255 |
|
|
|
|
|
|
|
--
|
|
|
|
2.26.2 |
|
|
|
|