Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,17 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ windows-2019, macos-latest, ubuntu-20.04 ]
os: [ windows-2019, macos-latest, ubuntu-22.04, ubuntu-24.04 ]
cmake: [ 3.15, 3.x ]
include:
- os: windows-2019
static_postfix: _static
tree: tree /F
CXX: cl

- os: ubuntu-20.04
- os: ubuntu-22.04
tree: tree
- os: ubuntu-24.04
tree: tree

- os: macos-latest
Expand Down
10 changes: 10 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,16 @@ if (tinyxml2_BUILD_TESTING)
)

set_tests_properties(xmltest PROPERTIES PASS_REGULAR_EXPRESSION ", Fail 0")

add_executable(xmltest2 xmltest2.cpp)

add_test(
NAME xmltest2
COMMAND xmltest2
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
)

set_tests_properties(xmltest2 PROPERTIES PASS_REGULAR_EXPRESSION ", Fail 0")
endif ()

##
Expand Down
64 changes: 43 additions & 21 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ RM = rm -f
RANLIB = ranlib
MKDIR = mkdir -p
CXXFLAGS = -D_FILE_OFFSET_BITS=64 -fPIC
CXXFLAGS_EFFC = -Werror -Wall -Wextra -Wshadow -Wpedantic -Wformat-nonliteral \
-Wformat-security -Wswitch-default -Wuninitialized -Wundef \
-Wpointer-arith -Woverloaded-virtual -Wctor-dtor-privacy \
-Wnon-virtual-dtor -Woverloaded-virtual -Wsign-promo \
-Wno-unused-parameter -Weffc++

INSTALL = install
INSTALL_PROGRAM = $(INSTALL)
Expand All @@ -21,32 +26,27 @@ bindir = $(prefix)/bin
libdir = $(prefix)/lib
includedir = $(prefix)/include

all: xmltest staticlib
all: xmltest xmltest2 staticlib

rebuild: clean all

xmltest: xmltest.cpp libtinyxml2.a

effc:
gcc -Werror -Wall -Wextra -Wshadow -Wpedantic -Wformat-nonliteral \
-Wformat-security -Wswitch-default -Wuninitialized -Wundef \
-Wpointer-arith -Woverloaded-virtual -Wctor-dtor-privacy \
-Wnon-virtual-dtor -Woverloaded-virtual -Wsign-promo \
-Wno-unused-parameter -Weffc++ xmltest.cpp tinyxml2.cpp -o xmltest
gcc $(CXXFLAGS_EFFC) xmltest.cpp tinyxml2.cpp -o xmltest

clean:
-$(RM) *.o xmltest libtinyxml2.a
effc2:
gcc $(CXXFLAGS_EFFC) xmltest2.cpp -o xmltest2

# Standard GNU target
distclean:
-$(RM) *.o xmltest libtinyxml2.a
# ----------------- Build Original xmltest -----------------

test: xmltest
./xmltest
xmltest: xmltest.cpp libtinyxml2.a
$(CXX) $(CXXFLAGS) xmltest.cpp tinyxml2.cpp -o xmltest

# Standard GNU target
check: xmltest
./xmltest
# ----------------- Build New xmltest2 -----------------

xmltest2: xmltest2.cpp
$(CXX) $(CXXFLAGS) xmltest2.cpp -o xmltest2

# ----------------- Static Library -----------------

staticlib: libtinyxml2.a

Expand All @@ -56,20 +56,42 @@ libtinyxml2.a: tinyxml2.o

tinyxml2.o: tinyxml2.cpp tinyxml2.h

# ----------------- Cleaning -----------------

clean:
-$(RM) *.o xmltest xmltest2 libtinyxml2.a

# Standard GNU target
distclean:
-$(RM) *.o xmltest xmltest2 libtinyxml2.a


# ----------------- Testing -----------------

test: xmltest
./xmltest

test2: xmltest2
./xmltest2

# Standard GNU targets
check: test
check2: test2

# ----------------- Installation -----------------

directories:
$(MKDIR) $(DESTDIR)$(prefix)
$(MKDIR) $(DESTDIR)$(bindir)
$(MKDIR) $(DESTDIR)$(libdir)
$(MKDIR) $(DESTDIR)$(includedir)

# Standard GNU target.
install: xmltest staticlib directories
$(INSTALL_PROGRAM) xmltest $(DESTDIR)$(bindir)/xmltest
$(INSTALL_DATA) tinyxml2.h $(DESTDIR)$(includedir)/tinyxml2.h
$(INSTALL_DATA) libtinyxml2.a $(DESTDIR)$(libdir)/libtinyxml2.a

# Standard GNU target
uninstall:
$(RM) $(DESTDIR)$(bindir)/xmltest
$(RM) $(DESTDIR)$(includedir)/tinyxml2.h
$(RM) $(DESTDIR)$(libdir)/libtinyxml2.a
$(RM) $(DESTDIR)$(libdir)/libtinyxml2.a
6 changes: 5 additions & 1 deletion readme.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
TinyXML-2
=========

[![Test](https://github.com/leethomason/tinyxml2/actions/workflows/test.yml/badge.svg)](https://github.com/leethomason/tinyxml2/actions/workflows/test.yml)
[![Test](https://github.com/KalanaRatnayake/tinyxml2/actions/workflows/test.yml/badge.svg)](https://github.com/KalanaRatnayake/tinyxml2/actions/workflows/test.yml)

TinyXML-2 is a simple, small, efficient, C++ XML parser that can be
easily integrated into other programs.
Expand Down Expand Up @@ -268,6 +268,10 @@ And additionally a test file:
Generally speaking, the intent is that you simply include the tinyxml2.cpp and
tinyxml2.h files in your project and build with your other source code.

*Update:* Now the single file header "tinyxml2.hpp" can directly be included in
your project directly without worrying about the cpp file and additional integration.
This can be useful when used in robotics projects.

There is also a CMake build included. CMake is the general build for TinyXML-2.

(Additional build systems are costly to maintain, and tend to bit-rot. They are
Expand Down
Loading