From 014e4b95648f2b8e7deb57acb0cdd8cefc363477 Mon Sep 17 00:00:00 2001 From: Michele Calgaro Date: Mon, 6 May 2024 18:26:24 +0900 Subject: Allow generation of build time data files in out-of-source builds. Also fix generation of data file for devices/mem24 subfolder Signed-off-by: Michele Calgaro (cherry picked from commit ac3f0014232619edc41865f6e42e6510bdd8acc6) --- src/devices/mem24/xml/mem24_xml_to_data.cpp | 3 +++ src/devices/mem24/xml_data/Makefile.am | 2 +- src/devices/pic/xml/pic_xml_to_data.cpp | 13 +++++++++++-- src/devices/pic/xml_data/Makefile.am | 6 +++--- 4 files changed, 18 insertions(+), 6 deletions(-) (limited to 'src/devices') diff --git a/src/devices/mem24/xml/mem24_xml_to_data.cpp b/src/devices/mem24/xml/mem24_xml_to_data.cpp index d2a4da5..43f3ba5 100644 --- a/src/devices/mem24/xml/mem24_xml_to_data.cpp +++ b/src/devices/mem24/xml/mem24_xml_to_data.cpp @@ -18,6 +18,9 @@ namespace Mem24 class XmlToData : public Device::XmlToData { +public: + XmlToData(const TQString &folder) : Device::XmlToData(folder) {} + private: virtual uint nbOutputFiles(uint) const { return 1; } virtual bool isIncluded(uint, uint) const { return true; } diff --git a/src/devices/mem24/xml_data/Makefile.am b/src/devices/mem24/xml_data/Makefile.am index 42cacaa..1b42fae 100644 --- a/src/devices/mem24/xml_data/Makefile.am +++ b/src/devices/mem24/xml_data/Makefile.am @@ -8,5 +8,5 @@ libmem24xml_la_DEPENDENCIES = mem24_data.cpp include deps.mak mem24_data.cpp: ../xml/mem24_xml_to_data $(noinst_DATA) - ../xml/mem24_xml_to_data + cd $(abs_builddir) && ./../xml/mem24_xml_to_data $(srcdir) CLEANFILES = mem24_data.cpp diff --git a/src/devices/pic/xml/pic_xml_to_data.cpp b/src/devices/pic/xml/pic_xml_to_data.cpp index 7cb573e..2419b46 100644 --- a/src/devices/pic/xml/pic_xml_to_data.cpp +++ b/src/devices/pic/xml/pic_xml_to_data.cpp @@ -6,6 +6,7 @@ * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * ***************************************************************************/ +#include #include #include @@ -18,6 +19,9 @@ namespace Pic { class XmlToData : public Device::XmlToData { +public: + XmlToData(const TQString &folder) : Device::XmlToData(folder) {} + private: virtual TQString namespaceName() const { return "Pic"; } @@ -673,8 +677,13 @@ void processRegistersFile(const TQString &filename, TQStringList &devices) void processRegisters() { TQStringList devices; - processRegistersFile("registers/registers.xml", devices); - processRegistersFile("registers/registers_missing.xml", devices); + TQDir xmlFilesDir; + if (!xmlFolder.isEmpty()) + { + xmlFilesDir.setPath(xmlFolder + "/registers"); + } + processRegistersFile(xmlFilesDir.absFilePath("registers.xml"), devices); + processRegistersFile(xmlFilesDir.absFilePath("registers_missing.xml"), devices); // check if we miss any register description TQMap::const_iterator it = _map.begin(); diff --git a/src/devices/pic/xml_data/Makefile.am b/src/devices/pic/xml_data/Makefile.am index e5bd5c4..97496a4 100644 --- a/src/devices/pic/xml_data/Makefile.am +++ b/src/devices/pic/xml_data/Makefile.am @@ -3,10 +3,10 @@ METASOURCES = AUTO noinst_LTLIBRARIES = libpicxml.la libpicxml_la_SOURCES = pic_data.cpp -libpicxml_la_DEPENDENCIES = $(srcdir)/pic_data.cpp +libpicxml_la_DEPENDENCIES = pic_data.cpp include deps.mak noinst_DATA += registers/registers.xml registers/registers_missing.xml -$(srcdir)/pic_data.cpp: ../xml/pic_xml_to_data $(noinst_DATA) - cd $(srcdir) && $(abs_builddir)/../xml/pic_xml_to_data +pic_data.cpp: ../xml/pic_xml_to_data $(noinst_DATA) + cd $(abs_builddir) && ./../xml/pic_xml_to_data $(srcdir) CLEANFILES = pic_data.cpp -- cgit v1.2.3