Building third party libraries for the COLLADA DOM

From COLLADA Public Wiki
Revision as of 18:46, 20 November 2007 by SteveT (talk | contribs) (New page: The 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...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

The 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. Since 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 themselves.

Libxml

Windows

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 the latest 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.

Build

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.

PS3

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.