Commit 0ec541f2 authored by Kiste's avatar Kiste
Browse files

Change build system

parent 084935cc
project('libbulletml', 'c', 'cpp')
incdir = include_directories('d_cpp')
library('libbulletml', 'src/bulletml_d.cpp', 'src/bulletmlparser.cpp', 'src/bulletmlparser-tinyxml.cpp', 'src/bulletmlrunnerimpl.cpp', 'src/bulletmlrunner.cpp', 'src/bulletmltree.cpp', 'src/calc.cpp', 'src/formula-variables.cpp', 'src/tinyxml/tinyxml.cpp', 'src/tinyxml/tinyxmlerror.cpp', 'src/tinyxml/tinyxmlparser.cpp', include_directories : incdir)
#****************************************************************************
#
# Makefil for TinyXml test.
# Lee Thomason
# www.grinninglizard.com
#
# This is a GNU make (gmake) makefile
#****************************************************************************
# DEBUG can be set to YES to include debugging info, or NO otherwise
DEBUG := NO
# PROFILE can be set to YES to include profiling info, or NO otherwise
PROFILE := NO
#****************************************************************************
CC := gcc
CXX := g++
LD := g++
AR := ar rc
RANLIB := ranlib
DEBUG_CFLAGS := -Wall -Wno-unknown-pragmas -Wno-format -g -DDEBUG -fPIC
RELEASE_CFLAGS := -Wall -Wno-unknown-pragmas -Wno-format -O2 -fPIC
LIBS :=
DEBUG_CXXFLAGS := ${DEBUG_CFLAGS}
RELEASE_CXXFLAGS := ${RELEASE_CFLAGS}
DEBUG_LDFLAGS := -g
RELEASE_LDFLAGS :=
ifeq (YES, ${DEBUG})
CFLAGS += ${DEBUG_CFLAGS}
CXXFLAGS += ${DEBUG_CXXFLAGS}
LDFLAGS += ${DEBUG_LDFLAGS}
else
CFLAGS += ${RELEASE_CFLAGS}
CXXFLAGS += ${RELEASE_CXXFLAGS}
LDFLAGS += ${RELEASE_LDFLAGS}
endif
ifeq (YES, ${PROFILE})
CFLAGS := ${CFLAGS} -pg
CXXFLAGS := ${CXXFLAGS} -pg
LDFLAGS := ${LDFLAGS} -pg
endif
#****************************************************************************
# Preprocessor directives
#****************************************************************************
ifeq (YES, ${PROFILE})
DEFS :=
else
DEFS :=
endif
#****************************************************************************
# Include paths
#****************************************************************************
#INCS := -I/usr/include/g++-2 -I/usr/local/include
INCS :=
#****************************************************************************
# Makefile code common to all platforms
#****************************************************************************
CFLAGS := ${CFLAGS} ${DEFS}
CXXFLAGS := ${CXXFLAGS} ${DEFS}
#****************************************************************************
# Targets of the build
#****************************************************************************
OUTPUT := xmltest
all: ${OUTPUT}
#****************************************************************************
# Source files
#****************************************************************************
SRCS := tinyxml.cpp tinyxmlparser.cpp xmltest.cpp tinyxmlerror.cpp
# Add on the sources for libraries
SRCS := ${SRCS}
OBJS := $(addsuffix .o,$(basename ${SRCS}))
#****************************************************************************
# Output
#****************************************************************************
${OUTPUT}: ${OBJS}
${LD} -o $@ ${LDFLAGS} ${OBJS} ${LIBS} ${EXTRA_LIBS}
#****************************************************************************
# common rules
#****************************************************************************
# Rules for compiling source files to object files
%.o : %.cpp
${CXX} -c ${CXXFLAGS} ${INCS} $< -o $@
%.o : %.c
${CC} -c ${CFLAGS} ${INCS} $< -o $@
clean:
-rm -f core ${OBJS} ${OUTPUT}
depend:
makedepend ${INCS} ${SRCS}
distdir:
--- in English ---
This TinyXML is NOT original version of TinyXML.
This is hacked by me.
You should not use this TinyXML,
and if you want to get original version, go
http://www.sourceforge.net/projects/tinyxml
I hacked it with "Crystal Space 3D"'s source code
for addition of CDATA support.
http://crystal.sourceforge.net/drupal/
--- in japanese ---
この TinyXML はオリジナルのバージョンではなくて、
私がいじったものです。
普通、この TinyXML を使うべきじゃなくて、以下のを使うべきです。
http://www.sourceforge.net/projects/tinyxml
私は "Crystal Space 3D" のソースコードを参考に
CDATA セクション対応を行いました。
http://crystal.sourceforge.net/drupal/
Changes in version 1.0.1:
- Fixed comment tags which were outputing as '<?--' instead of
the correct '<!--'.
- Implemented the Next and Prev methods of the TiXmlAttribute class.
- Renamed 'LastAttribtute' to 'LastAttribute'
- Fixed bad pointer to 'isspace' that could occur while parsing text.
- Errors finding beginning and end of tags no longer throw it into an
infinite loop. (Hopefully.)
Changes in version 1.0.2
- Minor documentation fixes.
Changes in version 1.0.3
- After nodes are added to a document, they return a pointer
to the new node instead of a bool for success.
- Elements can be constructed with a value, which is the
element name. Every element must have a value or it will be
invalid, but the code changes to enforce this are not fully
in place.
Changes in version 1.1.0
- Added the TiXmlAttributeSet class to pull the attributes into
a seperate container.
- Moved the doubly liked list out of XmlBase. Now XmlBase only
requires the Print() function and defines some utility functions.
- Moved errors into a seperate file. (With the idea of internationalization
to the other latin-1 languages.)
- Added the "NodeType"
- Fixed white space parsing in text to conform with the standard.
Basically, all white space becomes just one space.
- Added the TiXmlDeclaration class to read xml declarations.
Changes in version 1.2.0
- Removed the factory. The factory was not really in the spirit
of small and simple, confused the code, and was of limited value.
- Added FirstChildElement and NextSiblingElement, because they
are such common functions.
- Re-wrote the example to test and demonstrate more functionality.
Changes in version 1.2.1
- Fixed a bug where comments couldn't be inside elements.
- Loading now clears out existing XML rather than appending.
- Added the "Clear" method on a node to delete all its children.
Changes in version 1.2.2
- Fixed TiXmlAttribute::Previous actually returning "next." Thanks
to Rickard Troedsson for the bug fix.
Changes in version 1.2.3
- Added the TIXML prefix to the error strings to resolve conflicts
with #defines in OS headers. Thanks to Steve Lhomme.
- Fixed a delete buf that should be a delete [] buf.
Thanks to Ephi Sinowitz.
Changes in version 1.2.4
- ReplaceChild() was almost guarenteed to fail. Should be fixed,
thanks to Joe Smith. Joe also pointed out that the Print() functions
should take stream references: I agree, and would like to overload
the Print() method to take either format, but Idon't want to do
this in a dot release.
- Some compilers seem to need an extra <ctype.h> include. Thanks
to Steve Lhomme for that.
\ No newline at end of file
<?xml version="1.0" standalone="no" ?>
<!-- Our to do list data -->
<ToDo>
<Item priority="1" distance="close">Go to the
<bold>Toy store!
</bold>
</Item>
<Item priority="2" distance="none"> Do bills
</Item>
<Item priority="2" distance="far">Look for Evil Dinosaurs!
</Item>
</ToDo>
/** @mainpage
<b> TinyXml </b>
TinyXml is a simple, small, C++ XML parser that can be easily
integrating into other programs.
<b> What it does. </b>
In brief, TinyXml parses an XML document, and builds from that a
Document Object Model that can be read, modified, and saved.
XML stands for "eXtensible Markup Language." It allows you to create
your own document markups. Where HTML does a very good job of marking
documents for browsers, XML allows you to define any kind of document
markup, for example a document that describes a "to do" list for an
organizer application. XML is a very structured and convenient format.
All those random file formats created to store application data can
all be replaced with XML. One parser for everything.
There are different ways to access and interact with XML data.
TinyXml uses a Document Object Model, meaning the XML data is parsed
into a tree objects that can be browsed and manipulated, and then
written back to disk. You can also construct an XML document from
scratch with C++ objects and write this to disk.
TinyXml is designed to be easy and fast. It is one header and three cpp
files. Simply add these to your project and off you go. There is an
example to get you started. It is released under the ZLib license,
so you can use it in open source or commercial code.
It attempts to be a flexible parser, but with truly correct and
compliant XML output (with the exception of the character set,
below.) TinyXml should compile on any reasonably C++
system. It does not rely on exceptions or RTTI, and only uses the STL
string class.
<b> What it doesn't do. </b>
It doesn’t parse or use DTDs (Document Type Definitions) or XSL’s
(eXtensible Stylesheet Language.) It is limited to the ASCII
character set. There are other parsers out there (check out
www.sourceforge.org, search for XML) that are much more fully
featured. But they are also much bigger, take longer to set up in
your project, have a higher learning curve, and have a more
restrictive license. If you are working with browsers or have more
complete XML needs, TinyXml is not the parser for you.
<b> Code Status. </b>
Currently in use, TinyXml is looking pretty stable. If you find
bugs, send them in and we'll get them straightened out as soon as possible.
It currently does not recognize "entity references", meaning special
characters. This is a missing feature that will hopefully be
included soon. Namely:
@verbatim
&amp; &
&lt; <
&gt; >
&quot; "
&apos; ‘
@endverbatim
<b> Using and Installing </b>
To Compile and Run xmltest:
A Linux Makefile and a Windows Visual C++ .dsp file is provided.
Simply compile and run. It will write the file demotest.xml to your
disk and generate output on the screen. It also tests walking the
DOM by printing out the number of nodes found using different
techniques.
The Linux makefile is very generic and will
probably run on other systems, but is only tested on Linux. Make
sure to run 'make depend' before you make, so you don't pick
up incorrect dependencies.
To Use in an Application:
Add tinyxml.cpp, tinyxml.h, tinyxmlerror.cpp, and tinyxmlparser.cpp to your
project or make file. That's it! It should compile on any reasonably
compliant C++ system. You do not need to enable exceptions or
RTTI for TinyXml.
<b> Where it may go. </b>
At this point, I'm focusing on tightening up remaining issues.
Bug fixes (though comfortably rare) and minor interface
corrections.
On the "it would be nice if..." list is:
- More intelligent (and consistent) parsing would
be worthwhile; the parser is somewhat "organic" in its current form.
- Entities.
I'm not currently working on either; but would ethusiastically welcome
a patch!
In the future, I think it would be great if XSL and DTDs were added
in some scalable way. So TinyXml would become a stand-alone core
component of say MedXml (adding DTDs) and LargeXml( adding XSL.) :-)
<b> How TinyXml works. </b>
An example is probably the best way to go. Take:
@verbatim
<?xml version="1.0" standalone=‘no’>
<?-- Our to do list data -->
<ToDo>
<Item priority="1"> Go to the <bold>Toy store!</bold></Item>
<Item priority="2"> Do bills</Item>
</ToDo>
@endverbatim
It’s not much of a To Do list, but it will do. To read this file
(say "demo.xml") you would create a document, and parse it in:
@verbatim
TiXmlDocument doc( "demo.xml" );
doc.LoadFile();
@endverbatim
And it’s ready to go. Now let’s look at some lines and how they
relate to the DOM.
<?xml version="1.0" standalone=‘no’>
The first line is a declaration, and gets turned into the
TiXmlDeclaration class. It will be the first child of the
document node.
This is the only directive/special tag parsed by by TinyXml.
Generally directive targs are stored in TiXmlUnknown so the
commands won’t be lost when it is saved back to disk.
<?-- Our to do list data -->
A comment. Will become a TiXmlComment object.
<ToDo>
The ToDo tag defines a TiXmlElement object. This one does not have
any attributes, but will contain 2 other elements, both of which
are items.
<Item priority="1">
Creates another TiXmlElement which is a child of the "ToDo" element.
This element has 1 attribute, with the name ‘priority’ and the value
‘1’.
Go to the
A TiXmlText. This is a leaf node and cannot contain other nodes.
It is a child of the ‘Item" Element.
<bold>
Another TiXmlElement, this one a child of the "Item" element.
Etc.
Looking at the entire object tree, you end up with:
@verbatim
TiXmlDocument "demo.xml"
TiXmlDeclaration "version='1.0'" "standalone=‘no’"
TiXmlComment " Our to do list data"
TiXmlElement "ToDo"
TiXmlElement "Item" Attribtutes: priority = 1
TiXmlText "Go to the "
TiXmlElement "bold"
TiXmlText "Toy store!"
TiXmlElement "Item" Attributes: priority=2
TiXmlText "bills"
@endverbatim
<b> Contributors </b>
Thanks very much to everyone who sends suggestions, bugs, ideas, and
encouragement. It all helps.
Major contributors to the project:
<ul>
<li> Lee Thomason wrote the original code and maintains the project.</li>
<li> Ayende Rahien presented code, ideas, and changes that became
the 1.1.0 version of TinyXml.</li>
<li> Ville Nurmi provided ideas, bugs, and feedback.</li>
</ul>
<b> Documentation </b>
The documentation is build with Doxygen, using the 'dox'
configuration file.
<b> License </b>
TinyXml is released under the zlib license:
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any
damages arising from the use of this software.
Permission is granted to anyone to use this software for any
purpose, including commercial applications, and to alter it and
redistribute it freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must
not claim that you wrote the original software. If you use this
software in a product, an acknowledgment in the product documentation
would be appreciated but is not required.
2. Altered source versions must be plainly marked as such, and
must not be misrepresented as being the original software.
3. This notice may not be removed or altered from any source
distribution.
<b> References </b>
The World Wide Web Consortium is the definitive standard body for
XML, and there web pages contain huge amounts of information. I also
recommend "XML Pocket Reference" by Robert Eckstein and published by
O’Reilly.
<b> Contact Me: </b>
I’d appreciates your suggestions, and would love to know if you
use TinyXml. I hope you enjoy it and find it useful.
Lee Thomason
leethomason@mindspring.com
*/
# Microsoft Developer Studio Project File - Name="tinyxml" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Console Application" 0x0103
CFG=tinyxml - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "tinyxml.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "tinyxml.mak" CFG="tinyxml - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "tinyxml - Win32 Release" (based on "Win32 (x86) Console Application")
!MESSAGE "tinyxml - Win32 Debug" (based on "Win32 (x86) Console Application")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
RSC=rc.exe
!IF "$(CFG)" == "tinyxml - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
!ELSEIF "$(CFG)" == "tinyxml - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FR /YX /FD /GZ /c
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
!ENDIF
# Begin Target
# Name "tinyxml - Win32 Release"
# Name "tinyxml - Win32 Debug"
# Begin Source File
SOURCE=.\changes.txt
# End Source File
# Begin Source File
SOURCE=.\readme.txt
# End Source File
# Begin Source File
SOURCE=.\tinyxml.cpp
# End Source File
# Begin Source File
SOURCE=.\tinyxml.h
# End Source File
# Begin Source File
SOURCE=.\tinyxmlerror.cpp
# End Source File
# Begin Source File
SOURCE=.\tinyxmlparser.cpp
# End Source File
# Begin Source File
SOURCE=.\xmltest.cpp
# End Source File
# End Target
# End Project
#include "tinyxml.h"
//
// This file demonstrates some basic functionality of TinyXml.
// Note that the example is very contrived. It presumes you know
// what is in the XML file. But it does test the basic operations,
// and show how to add and remove nodes.
//
int main()
{
//
// We start with the 'demoStart' todo list. Process it. And
// should hopefully end up with the todo list as illustrated.
//
const char* demoStart =
"<?xml version=\"1.0\" standalone='no' >\n"
"<!-- Our to do list \n data -->"
"<ToDo>\n"
"<Item priority=\"1\" distance='close'> Go to the <bold>Toy store!</bold></Item>"
"<Item priority=\"2\" distance='none'><![CDATA[ Do bills ]]></Item>"
"<Item priority=\"2\" distance='far'> Look for Evil Dinosaurs! </Item>"
"</ToDo>";
/* What the todo list should look like after processing.
<?xml version="1.0" standalone="no" ?>
<!-- Our to do list data -->
<ToDo>
<Item priority="2" distance="close"> Go to the
<bold>Toy store!
</bold>
</Item>
<Item priority="1" distance="far"> Talk to:
<Meeting where="School">
<Attendee name="Marple" position="teacher" />
<Attendee name="Voo" position="counselor" />
</Meeting>
<Meeting where="Lunch" />
</Item>
<Item priority="2" distance="here"> Do bills
</Item>
</ToDo>
*/
// The example parses from the character string (above):
{
// Write to a file and read it back, to check file I/O.
TiXmlDocument doc( "demotest.xml" );
doc.Parse( demoStart );
if ( doc.Error() )
{
printf( "Error in %s: %s\n", doc.Value().c_str(), doc.ErrorDesc().c_str() );
exit( 1 );
}
doc.SaveFile();
}
TiXmlDocument doc( "demotest.xml" );
doc.LoadFile();
printf( "** Demo doc read from disk: ** \n\n" );
doc.Print( stdout );
TiXmlNode* node = 0;
TiXmlElement* todoElement = 0;
TiXmlElement*