From 694241f7905967bf69af3a31265180c00b73e28c Mon Sep 17 00:00:00 2001 From: Michael Cronenworth Date: Fri, 11 Aug 2017 10:08:27 -0500 Subject: [PATCH] build: Detect and allow external tinyxpath library usage Signed-off-by: Michael Cronenworth --- CMakeLists.txt | 57 +++++++++++++++++++++--------- removed from Fedora patch hardware/AnnaThermostat.cpp | 3 +- removed from Fedora patch hardware/RAVEn.cpp | 3 +- removed from Fedora patch hardware/openzwave/control_panel/ozwcp.cpp | 3 +- removed from Fedora patch hardware/plugins/PluginManager.cpp | 3 +- removed from Fedora patch hardware/plugins/Plugins.cpp | 3 +- removed from Fedora patch main/LuaCommon.cpp | 7 +++- removed from Fedora patch main/LuaHandler.cpp | 3 +- removed from Fedora patch msbuild/domoticz.vcxproj | 6 ++-- 9 files changed, 62 insertions(+), 26 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index bc231d8f6..334f203a6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -365,22 +365,6 @@ webserver/server.cpp webserver/Websockets.cpp webserver/WebsocketHandler.cpp -tinyxpath/action_store.cpp -tinyxpath/htmlutil.cpp -tinyxpath/lex_util.cpp -tinyxpath/node_set.cpp -tinyxpath/tinystr.cpp -tinyxpath/tinyxml.cpp -tinyxpath/tinyxmlerror.cpp -tinyxpath/tinyxmlparser.cpp -tinyxpath/tokenlist.cpp -tinyxpath/xml_util.cpp -tinyxpath/xpath_expression.cpp -tinyxpath/xpath_processor.cpp -tinyxpath/xpath_stream.cpp -tinyxpath/xpath_stack.cpp -tinyxpath/xpath_static.cpp -tinyxpath/xpath_syntax.cpp ) add_executable(domoticz ${domoticz_SRCS}) @@ -682,6 +666,47 @@ ENDIF(LIBUSB_FOUND) ENDIF(WITH_LIBUSB) +option(USE_BUILTIN_TINYXPATH "Use builtin tinyxpath library" YES) +IF(USE_BUILTIN_TINYXPATH) + include_directories(tinyxpath) + target_sources( + domoticz + PUBLIC + tinyxpath/action_store.cpp + tinyxpath/htmlutil.cpp + tinyxpath/lex_util.cpp + tinyxpath/node_set.cpp + tinyxpath/tinystr.cpp + tinyxpath/tinyxml.cpp + tinyxpath/tinyxmlerror.cpp + tinyxpath/tinyxmlparser.cpp + tinyxpath/tokenlist.cpp + tinyxpath/xml_util.cpp + tinyxpath/xpath_expression.cpp + tinyxpath/xpath_processor.cpp + tinyxpath/xpath_stream.cpp + tinyxpath/xpath_stack.cpp + tinyxpath/xpath_static.cpp + tinyxpath/xpath_syntax.cpp + ) +else() + pkg_check_modules(TinyXML QUIET tinyxml) + IF(TinyXML_FOUND) + MESSAGE(STATUS "TinyXML found at: ${TinyXML_LIBRARIES}") + IF(EXISTS "/usr/include/tinyxpath/xpath_processor.h") + MESSAGE(STATUS "TinyXPath found") + target_link_libraries(domoticz ${TinyXML_LIBRARIES}) + target_link_libraries(domoticz tinyxpath) + include_directories(/usr/include/tinyxpath) + add_definitions(-DWITH_EXTERNAL_TINYXPATH) + else() + MESSAGE(FATAL_ERROR "TinyXPath not found but USE_BUILTIN_TINYXPATH=NO") + ENDIF() + else() + MESSAGE(FATAL_ERROR "TinyXML not found but USE_BUILTIN_TINYXPATH=NO") + ENDIF(TinyXML_FOUND) +ENDIF(USE_BUILTIN_TINYXPATH) + # # OpenZWave # try to find open-zwave, if found, include support --- a/hardware/openzwave/control_panel/ozwcp.cpp 2020-03-22 09:16:16.000000000 -0500 +++ b/hardware/openzwave/control_panel/ozwcp.cpp 2020-03-24 10:53:04.968630391 -0500 @@ -49,7 +49,7 @@ #include #include #include -#include "../../../tinyxpath/tinyxml.h" +#include //#include "microhttpd.h" #include "ozwcp.h" --- a/hardware/plugins/PluginManager.cpp 2020-03-22 09:16:16.000000000 -0500 +++ b/hardware/plugins/PluginManager.cpp 2020-03-24 13:53:05.305852598 -0500 @@ -21,11 +21,12 @@ #include "../../main/Logger.h" #include "../../main/SQLHelper.h" #include "../../main/WebServer.h" -#include "../../tinyxpath/tinyxml.h" #ifdef WIN32 +# include "../../tinyxpath/tinyxml.h" # include #else # include +# include #endif #include "DelayedLink.h" --- a/hardware/plugins/Plugins.cpp 2020-03-22 09:16:16.000000000 -0500 +++ b/hardware/plugins/Plugins.cpp 2020-03-24 13:45:46.056965796 -0500 @@ -16,10 +16,11 @@ #include "../../main/Logger.h" #include "../../main/SQLHelper.h" #include "../../main/mainworker.h" -#include "../../tinyxpath/tinyxml.h" #include "../../notifications/NotificationHelper.h" +#include + #define ADD_STRING_TO_DICT(pPlugin, pDict, key, value) \ { \ PyNewRef pStr(value); \ --- a/hardware/AnnaThermostat.cpp 2020-03-22 09:16:16.000000000 -0500 +++ b/hardware/AnnaThermostat.cpp 2020-03-24 10:41:00.530030798 -0500 @@ -9,7 +9,7 @@ #include "../httpclient/HTTPClient.h" #include "../main/mainworker.h" -#include "../tinyxpath/tinyxml.h" +#include #define round(a) ( int ) ( a + .5 ) --- a/hardware/EcoDevices.cpp 2020-03-22 09:16:16.000000000 -0500 +++ b/hardware/EcoDevices.cpp 2020-03-24 10:47:20.095926641 -0500 @@ -33,11 +33,11 @@ #include "../main/Logger.h" #include "hardwaretypes.h" #include "../httpclient/HTTPClient.h" -#include "../tinyxpath/tinyxml.h" -#include "../tinyxpath/xpath_static.h" #include "../webserver/Base64.h" #include "../main/json_helper.h" #include +#include +#include // Minimum EcoDevises firmware required #define MAJOR 1 --- a/hardware/OnkyoAVTCP.cpp 2018-06-23 09:18:06.000000000 -0500 +++ b/hardware/OnkyoAVTCP.cpp 2018-07-08 14:21:06.884163094 -0500 @@ -3,14 +3,14 @@ #include "../main/Logger.h" #include "../main/Helper.h" #include "../main/SQLHelper.h" -#include #include "../main/mainworker.h" #include "../hardware/hardwaretypes.h" -#include -#include "../tinyxpath/tinyxml.h" #include "../main/WebServer.h" +#include #include +#include +#include #define RETRY_DELAY 30 --- a/hardware/RAVEn.cpp 2020-03-22 09:16:16.000000000 -0500 +++ b/hardware/RAVEn.cpp 2020-03-24 12:55:59.616310732 -0500 @@ -5,8 +5,8 @@ #include "../main/Logger.h" #include "../main/mainworker.h" #include "../main/RFXtrx.h" -#include "../tinyxpath/tinyxml.h" #include "hardwaretypes.h" +#include //Rainforest RAVEn USB ZigBee Smart Meter Adapter //https://rainforestautomation.com/rfa-z106-raven/ --- domoticz-2023.1/hardware/EnphaseAPI.cpp.orig 2023-02-14 14:48:00.000000000 +0100 +++ domoticz-2023.1/hardware/EnphaseAPI.cpp 2023-02-15 19:45:27.206931016 +0100 @@ -10,7 +10,7 @@ #include "../main/RFXtrx.h" #include "../main/SQLHelper.h" #include "../notifications/NotificationHelper.h" -#include "../tinyxpath/tinyxml.h" +#include #include "../webserver/Base64.h" #include "hardwaretypes.h" #include --- domoticz-2023.2/hardware/Enever.cpp.orig 2023-07-21 17:23:44.000000000 +0200 +++ domoticz-2023.2/hardware/Enever.cpp 2023-07-21 20:39:42.240298598 +0200 @@ -9,7 +9,7 @@ #include "../main/RFXtrx.h" #include "../main/SQLHelper.h" #include "../notifications/NotificationHelper.h" -#include "../tinyxpath/tinyxml.h" +#include #include "../webserver/Base64.h" #include "hardwaretypes.h" #include --- domoticz-2024.1/hardware/MitsubishiWF.cpp.orig 2024-01-01 12:59:22.000000000 +0100 +++ domoticz-2024.1/hardware/MitsubishiWF.cpp 2024-01-01 14:16:42.214198241 +0100 @@ -9,10 +9,10 @@ #include "../main/RFXtrx.h" #include "../main/SQLHelper.h" #include "../notifications/NotificationHelper.h" -#include "../tinyxpath/tinyxml.h" #include "../webserver/Base64.h" #include "hardwaretypes.h" #include +#include #ifdef _DEBUG