Skip to content
This repository was archived by the owner on Oct 20, 2022. It is now read-only.

Commit 81bdef5

Browse files
committed
Fix tinyxml2 by removing it from vcpkg and adding it manually via source files to fix shared dependency problem on Windows
1 parent e9fdbec commit 81bdef5

File tree

6 files changed

+5344
-15
lines changed

6 files changed

+5344
-15
lines changed

src/Doxybook/CMakeLists.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ project(Doxybook2)
55
find_package(inja CONFIG REQUIRED)
66
find_package(fmt CONFIG REQUIRED)
77
find_package(nlohmann_json CONFIG REQUIRED)
8-
find_package(tinyxml2 CONFIG REQUIRED)
98
find_package(Rang REQUIRED)
109
if (MSVC)
1110
find_package(Dirent REQUIRED)
@@ -34,7 +33,7 @@ install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/../../include
3433
)
3534

3635
# Libraries
37-
target_link_libraries(${PROJECT_NAME} PUBLIC fmt::fmt fmt::fmt-header-only tinyxml2::tinyxml2 pantor::inja Rang nlohmann_json nlohmann_json::nlohmann_json)
36+
target_link_libraries(${PROJECT_NAME} PUBLIC fmt::fmt fmt::fmt-header-only pantor::inja Rang nlohmann_json nlohmann_json::nlohmann_json)
3837
if(MSVC)
3938
target_link_libraries(${PROJECT_NAME} PRIVATE Dirent)
4039
endif()

src/Doxybook/Doxygen.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#include "ExceptionUtils.hpp"
2+
#include "tinyxml2/tinyxml2.h"
23
#include <Doxybook/Config.hpp>
34
#include <Doxybook/Doxygen.hpp>
45
#include <Doxybook/Exception.hpp>
@@ -7,7 +8,6 @@
78
#include <Doxybook/Xml.hpp>
89
#include <cassert>
910
#include <set>
10-
#include <tinyxml2.h>
1111

1212
#define ASSERT_FIRST_CHILD_ELEMENT(PARENT, NAME) \
1313
const auto NAME = PARENT->FirstChildElement(##NAME); \

src/Doxybook/Xml.cpp

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
1-
#include <tinyxml2.h>
2-
#include <Doxybook/Xml.hpp>
3-
#include <Doxybook/Exception.hpp>
41
#include "ExceptionUtils.hpp"
2+
#include "tinyxml2/tinyxml2.h"
3+
#include <Doxybook/Exception.hpp>
4+
#include <Doxybook/Xml.hpp>
55

6-
Doxybook2::Xml::Node::Node(tinyxml2::XMLNode* ptr)
7-
: ptr(ptr) {
8-
6+
Doxybook2::Xml::Node::Node(tinyxml2::XMLNode* ptr) : ptr(ptr) {
97
}
108

119
Doxybook2::Xml::Node Doxybook2::Xml::Node::nextSibling() const {
@@ -32,13 +30,12 @@ Doxybook2::Xml::Element Doxybook2::Xml::Node::asElement() const {
3230
return Element(ptr->ToElement());
3331
}
3432

35-
Doxybook2::Xml::Element::Element(tinyxml2::XMLElement* ptr)
36-
: ptr(ptr) {
33+
Doxybook2::Xml::Element::Element(tinyxml2::XMLElement* ptr) : ptr(ptr) {
3734
}
3835

3936
void Doxybook2::Xml::Element::allChildElements(const std::string& name, const ElementCallback& callback) const {
4037
auto found = firstChildElement(name);
41-
while(found) {
38+
while (found) {
4239
callback(found);
4340
found = found.nextSiblingElement(name);
4441
}
@@ -70,13 +67,15 @@ Doxybook2::Xml::Element Doxybook2::Xml::Element::firstChildElement(const std::st
7067

7168
std::string Doxybook2::Xml::Element::getAttr(const std::string& name) const {
7269
const auto str = ptr->Attribute(name.c_str());
73-
if (str == nullptr) throw EXCEPTION("Attribute {} does not exist in element {}", name, ptr->Name());
70+
if (str == nullptr)
71+
throw EXCEPTION("Attribute {} does not exist in element {}", name, ptr->Name());
7472
return str;
7573
}
7674

7775
std::string Doxybook2::Xml::Element::getAttr(const std::string& name, const std::string& defaultValue) const {
7876
const auto str = ptr->Attribute(name.c_str());
79-
if (str == nullptr) return defaultValue;
77+
if (str == nullptr)
78+
return defaultValue;
8079
return str;
8180
}
8281

0 commit comments

Comments
 (0)