Skip to content

Commit 6a2fdb9

Browse files
Michael GrierEmJayGee
authored andcommitted
Synchronize pugixml port with ADO client's
1 parent 7f0edc5 commit 6a2fdb9

File tree

6 files changed

+79
-17
lines changed

6 files changed

+79
-17
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
diff --git a/CMakeLists.txt b/CMakeLists.txt
2+
index d403f31..aeb0af5 100644
3+
--- a/CMakeLists.txt
4+
+++ b/CMakeLists.txt
5+
@@ -43,6 +43,7 @@ cmake_dependent_option(PUGIXML_BUILD_SHARED_AND_STATIC_LIBS
6+
option(PUGIXML_WCHAR_MODE "Enable wchar_t mode" OFF)
7+
option(PUGIXML_COMPACT "Enable compact mode" OFF)
8+
option(PUGIXML_INSTALL "Enable installation rules" ON)
9+
+option(PUGIXML_HEADER_ONLY "Enable header only compilation" OFF)
10+
11+
# Advanced options from pugiconfig.hpp
12+
option(PUGIXML_NO_XPATH "Disable XPath" OFF)
13+
@@ -269,6 +270,14 @@ if(PUGIXML_INSTALL)
14+
"${PROJECT_SOURCE_DIR}/src/pugixml.hpp"
15+
DESTINATION
16+
${CMAKE_INSTALL_INCLUDEDIR}${versioned-dir} COMPONENT ${PUGIXML_DEVELOPMENT_COMPONENT})
17+
+
18+
+ if (PUGIXML_HEADER_ONLY)
19+
+ install(
20+
+ FILES
21+
+ "${PROJECT_SOURCE_DIR}/src/pugixml.cpp"
22+
+ DESTINATION
23+
+ ${CMAKE_INSTALL_INCLUDEDIR}${versioned-dir} COMPONENT ${PUGIXML_DEVELOPMENT_COMPONENT})
24+
+ endif()
25+
endif()
26+
27+
if (PUGIXML_BUILD_TESTS)
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
diff --git a/src/pugixml.cpp b/src/pugixml.cpp
2+
index 53a0526..6a58eb8 100644
3+
--- a/src/pugixml.cpp
4+
+++ b/src/pugixml.cpp
5+
@@ -3681,6 +3681,7 @@ PUGI_IMPL_NS_BEGIN
6+
if (length < 1) return 0;
7+
8+
// discard last character if it's the lead of a surrogate pair
9+
+#pragma warning(suppress: 6239)
10+
return (sizeof(wchar_t) == 2 && static_cast<unsigned int>(static_cast<uint16_t>(data[length - 1]) - 0xD800) < 0x400) ? length - 1 : length;
11+
}
12+
13+
@@ -6744,6 +6745,7 @@ namespace pugi
14+
15+
PUGI_IMPL_FN xml_node xml_node::first_element_by_path(const char_t* path_, char_t delimiter) const
16+
{
17+
+#pragma warning(suppress: 25101)
18+
xml_node context = path_[0] == delimiter ? root() : *this;
19+
20+
if (!context._root) return xml_node();

build/vcpkg/ports/pugixml/portfile.cmake

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,22 @@ vcpkg_from_github(
44
REF "v${VERSION}"
55
SHA512 b8a70f1f230b0902b719346ce0a551eafe534f81262280dceeb92d5ad90ea4e635173e08e225bf66eb5f4724ac4568bd40dc923f184571f02502dac49bc0b7f5
66
HEAD_REF master
7+
PATCHES
8+
0001-cmakelists-txt-publish-pugixml-cpp.patch
9+
0002-oacr-warning-pugixml-cpp.patch
10+
)
11+
12+
vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
13+
FEATURES
14+
header-only PUGIXML_HEADER_ONLY
715
)
816

917
vcpkg_cmake_configure(
1018
SOURCE_PATH "${SOURCE_PATH}"
1119
OPTIONS
1220
-DPUGIXML_BUILD_TESTS=OFF
1321
-DPUGIXML_WCHAR_MODE=ON
22+
${FEATURE_OPTIONS}
1423
)
1524

1625
vcpkg_cmake_install()

build/vcpkg/ports/pugixml/vcpkg.json

Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,22 @@
1-
{
2-
"name": "pugixml",
3-
"version": "1.15",
4-
"description": "Light-weight, simple and fast XML parser for C++ with XPath support",
5-
"homepage": "https://github.com/zeux/pugixml",
6-
"license": "MIT",
7-
"dependencies": [
8-
{
9-
"name": "vcpkg-cmake",
10-
"host": true
11-
},
12-
{
13-
"name": "vcpkg-cmake-config",
14-
"host": true
15-
}
16-
]
1+
{
2+
"name": "pugixml",
3+
"version": "1.15",
4+
"port-version": 1,
5+
"description": "Light-weight, simple and fast XML parser for C++ with XPath support",
6+
"homepage": "https://github.com/zeux/pugixml",
7+
"license": "MIT",
8+
"dependencies": [
9+
{
10+
"name": "vcpkg-cmake",
11+
"host": true
12+
},
13+
{
14+
"name": "vcpkg-cmake-config",
15+
"host": true
16+
}
17+
],
18+
"features": {
19+
"header-only": { "description": "Enables building source code against pugixml.hpp with PUGIXML_HEADER_ONLY"
20+
}
21+
}
1722
}

src/libraries/pil/src/buffered/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
cmake_minimum_required(VERSION 3.23)
22

3-
find_package(pugixml REQUIRED)
3+
find_package(pugixml CONFIG REQUIRED)
44

55
target_sources(m_pil PRIVATE
66
platform.cpp

vcpkg.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
"ms-gsl",
99
{
1010
"name": "pugixml",
11+
"features": [ "header-only" ],
1112
"version>=": "1.15"
1213
},
1314
"wil"

0 commit comments

Comments
 (0)