]> git.pld-linux.org Git - packages/domoticz.git/blame - domoticz-tinyxpath.patch
- correct install
[packages/domoticz.git] / domoticz-tinyxpath.patch
CommitLineData
9dda6696
AM
1From 694241f7905967bf69af3a31265180c00b73e28c Mon Sep 17 00:00:00 2001
2From: Michael Cronenworth <mike@cchtml.com>
3Date: Fri, 11 Aug 2017 10:08:27 -0500
4Subject: [PATCH] build: Detect and allow external tinyxpath library usage
5
6Signed-off-by: Michael Cronenworth <mike@cchtml.com>
7---
8 CMakeLists.txt | 57 +++++++++++++++++++++---------
9 hardware/AnnaThermostat.cpp | 3 +-
10 hardware/RAVEn.cpp | 3 +-
11 hardware/openzwave/control_panel/ozwcp.cpp | 3 +-
12 hardware/plugins/PluginManager.cpp | 3 +-
13 hardware/plugins/Plugins.cpp | 3 +-
14 main/LuaCommon.cpp | 7 +++-
15 main/LuaHandler.cpp | 3 +-
16 removed from Fedora patch msbuild/domoticz.vcxproj | 6 ++--
17 9 files changed, 62 insertions(+), 26 deletions(-)
18
19diff --git a/CMakeLists.txt b/CMakeLists.txt
20index bc231d8f6..334f203a6 100644
21--- a/CMakeLists.txt
22+++ b/CMakeLists.txt
23@@ -451,22 +451,6 @@ webserver/proxyclient.cpp
24 json/json_reader.cpp
25 json/json_value.cpp
26 json/json_writer.cpp
27-tinyxpath/action_store.cpp
28-tinyxpath/htmlutil.cpp
29-tinyxpath/lex_util.cpp
30-tinyxpath/node_set.cpp
31-tinyxpath/tinystr.cpp
32-tinyxpath/tinyxml.cpp
33-tinyxpath/tinyxmlerror.cpp
34-tinyxpath/tinyxmlparser.cpp
35-tinyxpath/tokenlist.cpp
36-tinyxpath/xml_util.cpp
37-tinyxpath/xpath_expression.cpp
38-tinyxpath/xpath_processor.cpp
39-tinyxpath/xpath_stream.cpp
40-tinyxpath/xpath_stack.cpp
41-tinyxpath/xpath_static.cpp
42-tinyxpath/xpath_syntax.cpp
43 )
44 add_executable(domoticz ${domoticz_SRCS})
45
46@@ -538,6 +522,47 @@ else()
47 MESSAGE(STATUS "==== LibUSB not found, support for TE923/Voltcraft disabled!")
48 ENDIF(LIBUSB_FOUND)
49
50+option(USE_BUILTIN_TINYXPATH "Use builtin tinyxpath library" YES)
51+IF(USE_BUILTIN_TINYXPATH)
52+ include_directories(tinyxpath)
53+ target_sources(
54+ domoticz
55+ PUBLIC
56+ tinyxpath/action_store.cpp
57+ tinyxpath/htmlutil.cpp
58+ tinyxpath/lex_util.cpp
59+ tinyxpath/node_set.cpp
60+ tinyxpath/tinystr.cpp
61+ tinyxpath/tinyxml.cpp
62+ tinyxpath/tinyxmlerror.cpp
63+ tinyxpath/tinyxmlparser.cpp
64+ tinyxpath/tokenlist.cpp
65+ tinyxpath/xml_util.cpp
66+ tinyxpath/xpath_expression.cpp
67+ tinyxpath/xpath_processor.cpp
68+ tinyxpath/xpath_stream.cpp
69+ tinyxpath/xpath_stack.cpp
70+ tinyxpath/xpath_static.cpp
71+ tinyxpath/xpath_syntax.cpp
72+ )
73+else()
74+ pkg_check_modules(TinyXML QUIET tinyxml)
75+ IF(TinyXML_FOUND)
76+ MESSAGE(STATUS "TinyXML found at: ${TinyXML_LIBRARIES}")
77+ IF(EXISTS "/usr/include/tinyxpath/xpath_processor.h")
78+ MESSAGE(STATUS "TinyXPath found")
79+ target_link_libraries(domoticz ${TinyXML_LIBRARIES})
80+ target_link_libraries(domoticz tinyxpath)
81+ include_directories(/usr/include/tinyxpath)
82+ add_definitions(-DWITH_EXTERNAL_TINYXPATH)
83+ else()
84+ MESSAGE(FATAL_ERROR "TinyXPath not found but USE_BUILTIN_TINYXPATH=NO")
85+ ENDIF()
86+ else()
87+ MESSAGE(FATAL_ERROR "TinyXML not found but USE_BUILTIN_TINYXPATH=NO")
88+ ENDIF(TinyXML_FOUND)
89+ENDIF(USE_BUILTIN_TINYXPATH)
90+
91 #
92 # Find MD5/RMD160/SHA library
93 #
94diff --git a/hardware/AnnaThermostat.cpp b/hardware/AnnaThermostat.cpp
95index 9c8cf26ef..9c91513ba 100644
96--- a/hardware/AnnaThermostat.cpp
97+++ b/hardware/AnnaThermostat.cpp
98@@ -8,7 +8,8 @@
99 #include "../main/SQLHelper.h"
100 #include "../httpclient/HTTPClient.h"
101 #include "../main/mainworker.h"
102-#include "../tinyxpath/tinyxml.h"
103+
104+#include <tinyxml.h>
105
106 #define round(a) ( int ) ( a + .5 )
107
108diff --git a/hardware/RAVEn.cpp b/hardware/RAVEn.cpp
109index 3ffe4f724..36f97bffb 100644
110--- a/hardware/RAVEn.cpp
111+++ b/hardware/RAVEn.cpp
112@@ -6,7 +6,8 @@
113 #include "../main/RFXtrx.h"
114 #include "../main/localtime_r.h"
115 #include "../main/mainworker.h"
116-#include "../tinyxpath/tinyxml.h"
117+
118+#include <tinyxml.h>
119
120 //Rainforest RAVEn USB ZigBee Smart Meter Adapter
121 //https://rainforestautomation.com/rfa-z106-raven/
122diff --git a/hardware/openzwave/control_panel/ozwcp.cpp b/hardware/openzwave/control_panel/ozwcp.cpp
123index 9a948c976..8fd4f77f0 100644
124--- a/hardware/openzwave/control_panel/ozwcp.cpp
125+++ b/hardware/openzwave/control_panel/ozwcp.cpp
126@@ -45,11 +45,10 @@
127 #include "Group.h"
128 #include "Notification.h"
129
130-#include "../../tinyxpath/tinyxml.h"
131-
132 #include <sys/stat.h>
133 #include <fstream>
134 #include <iostream>
135+#include <tinyxml.h>
136
137 //#include "microhttpd.h"
138 #include "ozwcp.h"
139diff --git a/hardware/plugins/PluginManager.cpp b/hardware/plugins/PluginManager.cpp
140index ea7bbe48a..9af41e42e 100644
141--- a/hardware/plugins/PluginManager.cpp
142+++ b/hardware/plugins/PluginManager.cpp
143@@ -5,6 +5,8 @@
144 //
145 #ifdef ENABLE_PYTHON
146
147+#include <tinyxml.h>
148+
149 #include "PluginManager.h"
150 #include "Plugins.h"
151 #include "PluginMessages.h"
152@@ -17,7 +19,6 @@
153 #include "../main/mainworker.h"
154 #include "../main/EventSystem.h"
155 #include "../json/json.h"
156-#include "../tinyxpath/tinyxml.h"
157 #include "../main/localtime_r.h"
158 #ifdef WIN32
159 # include <direct.h>
160diff --git a/hardware/plugins/Plugins.cpp b/hardware/plugins/Plugins.cpp
161index dc2420d6a..8cba255a2 100644
162--- a/hardware/plugins/Plugins.cpp
163+++ b/hardware/plugins/Plugins.cpp
164@@ -5,6 +5,8 @@
165 //
166 #ifdef ENABLE_PYTHON
167
168+#include <tinyxml.h>
169+
170 #include "Plugins.h"
171 #include "PluginMessages.h"
172 #include "PluginProtocols.h"
173@@ -15,7 +17,6 @@
174 #include "../main/Logger.h"
175 #include "../main/SQLHelper.h"
176 #include "../main/mainworker.h"
177-#include "../tinyxpath/tinyxml.h"
178 #include "../main/localtime_r.h"
179
180 #include "../../notifications/NotificationHelper.h"
181diff --git a/main/LuaCommon.cpp b/main/LuaCommon.cpp
182index ec99429a5..76085aed6 100644
183--- a/main/LuaCommon.cpp
184+++ b/main/LuaCommon.cpp
185@@ -16,7 +16,8 @@ extern "C" {
186 #endif
187 }
188
189-#include "../tinyxpath/xpath_processor.h"
190+#include <xpath_processor.h>
191+
192 #include "../json/json.h"
193 #include "SQLHelper.h"
194 #include "mainworker.h"
195@@ -44,7 +45,11 @@ int CLuaCommon::l_domoticz_applyXPath(lua_State* lua_state)
196 return 0;
197 }
198 TinyXPath::xpath_processor processor(root, xpath.c_str());
199+#ifdef WITH_EXTERNAL_TINYXPATH
200+ TIXML_STRING xresult = processor.S_compute_xpath();
201+#else
202 TiXmlString xresult = processor.S_compute_xpath();
203+#endif
204 lua_pushstring(lua_state, xresult.c_str());
205 return 1;
206 }
207diff --git a/main/LuaHandler.cpp b/main/LuaHandler.cpp
208index 8fdcb278b..a66cafee7 100644
209--- a/main/LuaHandler.cpp
210+++ b/main/LuaHandler.cpp
211@@ -16,7 +16,8 @@ extern "C" {
212 #endif
213 }
214
215-#include "../tinyxpath/xpath_processor.h"
216+#include <xpath_processor.h>
217+
218 #include "../json/json.h"
219 #include "SQLHelper.h"
220 #include "mainworker.h"
This page took 0.121624 seconds and 4 git commands to generate.