From 0d16a245a7bc751ecacb0622a7c0dfe5d8a10d4d Mon Sep 17 00:00:00 2001 From: Robert Patterson Date: Fri, 26 Jun 2026 13:55:43 -0500 Subject: [PATCH 1/3] Allow clients to provide their own pugixml --- CMakeLists.txt | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6f6f116e7..0f23b6557 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -36,8 +36,11 @@ set(PUBLIC_DIR "${CMAKE_CURRENT_SOURCE_DIR}/src/include") # pugixml: the XML layer the generated mx::core consumes directly (plan ยง2.1). # Vendored at src/private/pugixml (upstream 1.15, stock pugiconfig). -add_library(pugixml STATIC ${PRIVATE_DIR}/pugixml/pugixml.cpp) -target_include_directories(pugixml PUBLIC ${PRIVATE_DIR}) +# Client projects may provide a compatible pugixml target before adding mx. +if(NOT TARGET pugixml) + add_library(pugixml STATIC ${PRIVATE_DIR}/pugixml/pugixml.cpp) + target_include_directories(pugixml PUBLIC ${PRIVATE_DIR}) +endif() # mx_core: the generated C++ typed model plus its hand-written runtime # (Decimal, Result, Error, Lexical, Token, NameToken, OneOrMore, Xml). The From b4d61886b22766bc6e4f40e86dc1ecb708fccfde Mon Sep 17 00:00:00 2001 From: Robert Patterson Date: Fri, 26 Jun 2026 14:01:13 -0500 Subject: [PATCH 2/3] Update README --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 9c9fd915e..d62b13bc8 100644 --- a/README.md +++ b/README.md @@ -513,7 +513,8 @@ recorded in `docs/ai/design/mx-core-plan.md`. `mx::core` consumes the vendored [pugixml](http://pugixml.org/) (`src/private/pugixml/`) directly, in keeping with the build tenets [above](#build-tenets). The earlier `ezxml` abstraction layer is -retired. +retired. A client project may provide a compatible version by creating the CMake `pugixml` target +before adding `mx`. ##### `mx::impl` From 8394f86d22a4ba1760dddee55157712ebb0d0f34 Mon Sep 17 00:00:00 2001 From: Matthew James Briggs Date: Sat, 27 Jun 2026 06:52:40 +0000 Subject: [PATCH 3/3] Use standard pugixml include paths for external target compatibility Change the vendored pugixml include directory from ${PRIVATE_DIR} to ${PRIVATE_DIR}/pugixml so that code includes pugixml.hpp directly (matching upstream pugixml conventions). This lets the if(NOT TARGET pugixml) guard work seamlessly with find_package(pugixml) or any other standard pugixml CMake target. --- CMakeLists.txt | 2 +- Package.swift | 6 ++++-- src/private/mx/api/DocumentManager.cpp | 2 +- src/private/mx/core/Attribution.cpp | 2 +- src/private/mx/core/Xml.h | 2 +- src/private/mxtest/api/ApiTester.cpp | 2 +- src/private/mxtest/api/CorpusRoundtripMain.cpp | 2 +- src/private/mxtest/api/PitchDataTest.cpp | 2 +- src/private/mxtest/api/SlurTest.cpp | 2 +- src/private/mxtest/core/AttributionTest.cpp | 2 +- src/private/mxtest/core/DocumentTest.cpp | 2 +- src/private/mxtest/core/ShapeTest.cpp | 2 +- src/private/mxtest/corert/Compare.h | 2 +- src/private/mxtest/corert/CoreRoundtripImpl.cpp | 2 +- src/private/mxtest/corert/Fixer.h | 2 +- src/private/mxtest/import/Normalize.h | 2 +- src/private/mxtest/validate/main.cpp | 2 +- 17 files changed, 20 insertions(+), 18 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0f23b6557..a22edd456 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -39,7 +39,7 @@ set(PUBLIC_DIR "${CMAKE_CURRENT_SOURCE_DIR}/src/include") # Client projects may provide a compatible pugixml target before adding mx. if(NOT TARGET pugixml) add_library(pugixml STATIC ${PRIVATE_DIR}/pugixml/pugixml.cpp) - target_include_directories(pugixml PUBLIC ${PRIVATE_DIR}) + target_include_directories(pugixml PUBLIC ${PRIVATE_DIR}/pugixml) endif() # mx_core: the generated C++ typed model plus its hand-written runtime diff --git a/Package.swift b/Package.swift index c3788a693..ff0263ca7 100644 --- a/Package.swift +++ b/Package.swift @@ -24,8 +24,9 @@ if useBinaryRelease { // `src/private`), minus the Catch2 runner, the test suites, and the example // programs -- the only files carrying their own main(). The public surface // is the mx::api headers under `src/include`; `src/private` is added to the - // internal header search path so the model can include `mx/core/...` and - // `pugixml/...`. + // internal header search path so the model can include `mx/core/...`; and + // `src/private/pugixml` is added so sources can use the canonical + // `#include "pugixml.hpp"` form that the CMake build also exposes. mxTarget = .target( name: "Mx", path: "src", @@ -37,6 +38,7 @@ if useBinaryRelease { publicHeadersPath: "include", cxxSettings: [ .headerSearchPath("private"), + .headerSearchPath("private/pugixml"), ] ) } diff --git a/src/private/mx/api/DocumentManager.cpp b/src/private/mx/api/DocumentManager.cpp index 70f515eb1..11255e6c9 100644 --- a/src/private/mx/api/DocumentManager.cpp +++ b/src/private/mx/api/DocumentManager.cpp @@ -11,7 +11,7 @@ #include "mx/impl/ScoreWriter.h" #include "mx/impl/WriteRefusal.h" -#include "pugixml/pugixml.hpp" +#include "pugixml.hpp" #include #include diff --git a/src/private/mx/core/Attribution.cpp b/src/private/mx/core/Attribution.cpp index 6ae92970c..0a5933b1c 100644 --- a/src/private/mx/core/Attribution.cpp +++ b/src/private/mx/core/Attribution.cpp @@ -13,7 +13,7 @@ #include "mx/core/generated/ScorePartwise.h" #include "mx/core/generated/ScoreTimewise.h" -#include "pugixml/pugixml.hpp" +#include "pugixml.hpp" #include #include diff --git a/src/private/mx/core/Xml.h b/src/private/mx/core/Xml.h index 0b142e772..3def6fbe6 100644 --- a/src/private/mx/core/Xml.h +++ b/src/private/mx/core/Xml.h @@ -6,7 +6,7 @@ #pragma once -#include "pugixml/pugixml.hpp" +#include "pugixml.hpp" #include #include diff --git a/src/private/mxtest/api/ApiTester.cpp b/src/private/mxtest/api/ApiTester.cpp index 980e2a043..91f06485a 100644 --- a/src/private/mxtest/api/ApiTester.cpp +++ b/src/private/mxtest/api/ApiTester.cpp @@ -2,7 +2,7 @@ #include "mxtest/api/ApiTester.h" #include "mx/api/DocumentManager.h" #include "mxtest/file/StupidFileFunctions.h" -#include "pugixml/pugixml.hpp" +#include "pugixml.hpp" #include diff --git a/src/private/mxtest/api/CorpusRoundtripMain.cpp b/src/private/mxtest/api/CorpusRoundtripMain.cpp index 321f9f22a..e0212e1fd 100644 --- a/src/private/mxtest/api/CorpusRoundtripMain.cpp +++ b/src/private/mxtest/api/CorpusRoundtripMain.cpp @@ -24,7 +24,7 @@ #include "mx/core/Attribution.h" #include "mxtest/corert/Compare.h" #include "mxtest/corert/Fixer.h" -#include "pugixml/pugixml.hpp" +#include "pugixml.hpp" #include #include diff --git a/src/private/mxtest/api/PitchDataTest.cpp b/src/private/mxtest/api/PitchDataTest.cpp index 676280c07..96b24e4df 100644 --- a/src/private/mxtest/api/PitchDataTest.cpp +++ b/src/private/mxtest/api/PitchDataTest.cpp @@ -7,7 +7,7 @@ #include "cpul/cpulTestHarness.h" #include "mx/api/DocumentManager.h" -#include "pugixml/pugixml.hpp" +#include "pugixml.hpp" #include #include diff --git a/src/private/mxtest/api/SlurTest.cpp b/src/private/mxtest/api/SlurTest.cpp index d197dba44..9fcf2ae43 100644 --- a/src/private/mxtest/api/SlurTest.cpp +++ b/src/private/mxtest/api/SlurTest.cpp @@ -8,7 +8,7 @@ #include "cpul/cpulTestHarness.h" #include "mxtest/api/TestHelpers.h" #include "mxtest/file/MxFileRepository.h" -#include "pugixml/pugixml.hpp" +#include "pugixml.hpp" #include diff --git a/src/private/mxtest/core/AttributionTest.cpp b/src/private/mxtest/core/AttributionTest.cpp index 472cd08ec..311596965 100644 --- a/src/private/mxtest/core/AttributionTest.cpp +++ b/src/private/mxtest/core/AttributionTest.cpp @@ -17,7 +17,7 @@ #include "mx/core/generated/ScoreHeaderGroup.h" #include "mx/core/generated/ScorePartwise.h" -#include "pugixml/pugixml.hpp" +#include "pugixml.hpp" #include #include diff --git a/src/private/mxtest/core/DocumentTest.cpp b/src/private/mxtest/core/DocumentTest.cpp index cc8484ec0..e2ad55b1f 100644 --- a/src/private/mxtest/core/DocumentTest.cpp +++ b/src/private/mxtest/core/DocumentTest.cpp @@ -15,7 +15,7 @@ #include "mx/core/generated/Document.h" #include "mx/core/generated/Version.h" -#include "pugixml/pugixml.hpp" +#include "pugixml.hpp" #include diff --git a/src/private/mxtest/core/ShapeTest.cpp b/src/private/mxtest/core/ShapeTest.cpp index 09af384af..94c911881 100644 --- a/src/private/mxtest/core/ShapeTest.cpp +++ b/src/private/mxtest/core/ShapeTest.cpp @@ -24,7 +24,7 @@ #include "mx/core/generated/Pitch.h" #include "mx/core/generated/Step.h" -#include "pugixml/pugixml.hpp" +#include "pugixml.hpp" #include diff --git a/src/private/mxtest/corert/Compare.h b/src/private/mxtest/corert/Compare.h index 44d682fbf..b67ab396a 100644 --- a/src/private/mxtest/corert/Compare.h +++ b/src/private/mxtest/corert/Compare.h @@ -4,7 +4,7 @@ #pragma once -#include "pugixml/pugixml.hpp" +#include "pugixml.hpp" #include diff --git a/src/private/mxtest/corert/CoreRoundtripImpl.cpp b/src/private/mxtest/corert/CoreRoundtripImpl.cpp index e340d002f..8290b9751 100644 --- a/src/private/mxtest/corert/CoreRoundtripImpl.cpp +++ b/src/private/mxtest/corert/CoreRoundtripImpl.cpp @@ -12,7 +12,7 @@ #include "mxtest/file/PathRoot.h" #include "mxtest/import/Normalize.h" -#include "pugixml/pugixml.hpp" +#include "pugixml.hpp" #include #include diff --git a/src/private/mxtest/corert/Fixer.h b/src/private/mxtest/corert/Fixer.h index 91fb5a39f..4bdd6adb1 100644 --- a/src/private/mxtest/corert/Fixer.h +++ b/src/private/mxtest/corert/Fixer.h @@ -4,7 +4,7 @@ #pragma once -#include "pugixml/pugixml.hpp" +#include "pugixml.hpp" #include #include diff --git a/src/private/mxtest/import/Normalize.h b/src/private/mxtest/import/Normalize.h index cfb7c3016..49d77cf85 100644 --- a/src/private/mxtest/import/Normalize.h +++ b/src/private/mxtest/import/Normalize.h @@ -4,7 +4,7 @@ #pragma once -#include "pugixml/pugixml.hpp" +#include "pugixml.hpp" namespace mxtest { diff --git a/src/private/mxtest/validate/main.cpp b/src/private/mxtest/validate/main.cpp index fe4a82c24..c1b1b7221 100644 --- a/src/private/mxtest/validate/main.cpp +++ b/src/private/mxtest/validate/main.cpp @@ -13,7 +13,7 @@ #include "mx/core/generated/Document.h" #include "mxtest/corert/CoreRoundtripImpl.h" -#include "pugixml/pugixml.hpp" +#include "pugixml.hpp" #include #include