Building third party libraries for the COLLADA DOM
The COLLADA DOM uses several third-party libraries. This document explains how to rebuild these libraries for each of the supported platforms. This is intended more for the COLLADA DOM maintainers than DOM users. Because all the third party libraries necessary to build the DOM on a particular platform are provided in the external-libs folder, most users shouldn't need to rebuild these libraries.
The instructions for building PS3 libs assumes that you're using Linux as the host system. They might not work properly if using Windows as the host system.
Why do our own build of libxml?
On Windows, we maintain a custom build of libxml to avoid dependency on iconv, which is licensed under the LGPL. Linking against iconv statically isn't an option, since any application would then be covered by the LGPL. Linking dynamically is fine, and that's what Igor Zlatkovic does in his prebuilt Windows libxml binaries, which we've used in the past. This means that iconv.dll has to be in the users's PATH though, or in the same directory as every executable that wants to use libxml. This is cumbersome, and we don't even need iconv, so we do our own build of libxml without it on Windows.
Get the source files
First, download the libxml source. We're currently using version 2.6.29, which was released June 12th 2007. We also build with zlib support, so you'll need to download that too. We don't need the source, just the headers and libs, and Igor Zlatkovic provides the appropriate files for Windows.
Pick a compiler
Next, you need to decide which compiler to use to build the library. Typically you'll use some version of Visual Studio. Fortunately, a libxml library file built with VS 2003 also works with VS 2005, and hopefully future versions of VS also. Since we support VS 2003 and up in the DOM, we should build libxml with VS 2003.
Libxml doesn't use .vcproj and .sln files; it's built from the command line. Open a command prompt, and then enable usage of VS2003 from the command line by running
"C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\bin\vcvars32.bat"
Now navigate to the win32 folder in libxml. Run "cscript configure.js help" to get a listing of all the build options. For our build, we want to disable iconv and enable zlib. Enabling zlib support in libxml allows the DOM to transparently load zlib or gzip compressed files. Execute these commands:
cscript configure.js iconv=no zlib=yes include=c:\misc\zlib-1.2.3\include lib=c:\misc\zlib-1.2.3\lib prefix=c:\misc\libxmlBuildOutput nmake /f Makefile.msvc nmake /f Makefile.msvc install
The "include" and "lib" options tell libxml where to find third-party libraries, specifically zlib in our case. Adjust the paths to point to wherever you installed zlib. Once you run those commands, you'll have both static lib and DLL versions of libxml in c:\misc\libxmlBuildOutput. Adjust the "prefix" option to control where libxml installs its files.
Linux and Mac
On Linux and Mac, we just use the stock libxml that comes with the system, so we don't need to worry about building it ourselves.
On PS3 we use TinyXml for XML parsing instead of libxml. It's possible to get libxml building on PS3, but we don't need it for now.
The DOM has been tested with TinyXml version 2.5.3, released on May 6th 2007. The only platform that actually requires TinyXml usage is the PS3.
In the DOM TinyXml plugin we don't use any of the STL features of TinyXml, so you don't need to include STL support in the TinyXml build.
Download TinyXml. It comes with Visual Studio .sln files for building.
Download TinyXml and copy the makefile from <dom-path>/external-libs/tinyxml/build to the TinyXml folder you downloaded. Then open a shell and go to the TinyXml path and run "make". The output lib file is linux/libtinyxml.a.
The makefile for Linux and PS3 could be trivially adapted to build a Mac universal binary lib, but that hasn't been necessary, so currently the TinyXml DOM plugin isn't supported on Mac.
Same as Linux, except run "make platform=ps3". The output lib file is ps3/libtinyxml.a.
The DOM has been tested against PCRE version 7.4. All platforms require PCRE.
PCRE comes with CMake files so you can generate the appropriate build files for Visual Studio. You need to build separate libs for VS 2003 and VS 2005, as they're not compatible.
On Linux it's expected that your distro will provide PCRE development files. If not, the PCRE documentation explains how to build PCRE for a Linux system.
On Mac we want to build a universal binary, so the default build for Unix systems needs to be tweaked a bit. Open a terminal and run this command:
env CXXFLAGS="-arch i386 -arch ppc -isysroot /Developer/SDKs/MacOSX10.4u.sdk" \ CFLAGS="-arch i386 -arch ppc -isysroot /Developer/SDKs/MacOSX10.4u.sdk" \ LDFLAGS="-arch i386 -arch ppc -isysroot /Developer/SDKs/MacOSX10.4u.sdk" \ ./configure --disable-dependency-tracking
The -isysroot specifications seem to only be necessary on PowerPC systems building universal binaries. This information was taken from here.
Download and extract PCRE. Copy the entire "ps3" directory from external-libs-source/pcre to the pcre folder you downloaded. Open a shell and go to the pcre/ps3 directory and run "make".
The Boost filesystem library is used in the DOM unit tests, and may be used directly by the DOM in the future. The DOM has been tested with Boost 1.34.1.
Use the Windows installer to install Boost on your system, and pick out the filesystem .lib files. We use the static boost filesystem libs that link against the multi-threaded DLL version of the C++ runtime. We need both VS 2003 and VS 2005 libs, as VS 2005 can't use the 2003 libs.
It's expected that your distro will provide suitable boost filesystem development files. Otherwise, Boost comes with documentation that explains how to build on Linux.
On Mac we need a universal binary, so the Boost build system has to be tweaked somewhat. Download and extract Boost 1.34.1 on your system. Copy the makefile from external-libs-source/boost/filesystem to BOOST_ROOT/libs/filesystem/build, where BOOST_ROOT is the location you extracted boost to. Then go to BOOST_ROOT/libs/filesystem/build in a terminal and run "make".
Same as Mac, except you need to copy operations.cpp from external-libs-source/boost/filesystem to BOOST_ROOT/libs/filesystem/src. Then run "make platform=ps3".