MXADataModel Documentation
APIs for the Programmer
 

Basics

Download and install CMake first. Then proceed to build all the third party libraries that are needed. See this page for more information regarding the necessary libraries. The easiest way to build the libraries is in the following order:
  1. Tiff
  2. Expat
  3. Zlib and/or szip (These are optional)
  4. HDF5 Version 1.6.9
  5. Boost
  6. VTK - Only if you need to use VTK from the MXA Data Model
  7. Qt - Only if you need to Build the GUI applications
  8. MXADataModel

Tiff, Expat and HDF5 Support Libraries

Download each of the libraries to your local machine.
  1. Tiff
  2. Expat
  3. HDF5-1.6.9
Uncompress each archive using whatever utility is appropriate for your system. Launch CMake-Gui.exe(app) and set the "Where is the source code" field to point to the directory where the source code is located. Now set the "Where to build the binaries" field to a different directory. Some folks recommend to create a "Build" directory just inside the actual source directory, as shown in the Screen Shot. After you have set the build directory click the "Configure" button and wait while cmake interrogates your system for needed information. After a successful configuration step you should end up with something that looks similar to this. Some options that you may want to set for each library are the following:
CMAKE_BUILD_TYPE = Debug or Release
CMAKE_INSTALL_PREFIX = Where on your hard drive to install the library and associated files.
BUILD_SHARED_LIBS = ON | OFF
On OS X I recommend Dynamic Libraries.
On Linux and Windows I recommend Static Libraries.
CMAKE_OSX_ARCHITECTURES = Any semi-colon separated list of i386, ppc, x86_64, ppc64
The defaults for the rest of the values should be correct for each system.
Depending on what system you are running will dictate how you will now build the library.
Windows Users with Visual Studio
If you told CMake to generate Visual Studio Projects then inside the build directory you will find a project-name.sln file. Double click on that file to launch Visual Studio and then "Build" the INSTALL project. Also select either a "Debug" or "Release" configuation before building.
Unix Users including OS X
If you told CMake to generate "Makefiles" then open a terminal and navigate to the build directory that was created for you by CMake. Once inside that folder you can issue the "make install" command.
[fred@Ferb:Build] $ make install
This will compile and install the libraries onto your system.
OS X Users with Xcode
If you told CMake to generate Visual Studio Projects then inside the build directory you will find a project-name.xcodeproj file. Double click on that file to launch Xcode and then "Build" the INSTALL project. Also select either a "Debug" or "Release" configuation before building. For each library you will want to set an environment variable that points to the installation location. On a Unix machine using bash this would be something like: export BQ_INSTALL_ROOT="/Users/Shared/Toolkits" export HDF5_INSTALL="$BQ_INSTALL_ROOT/hdf5-169" export EXPAT_INSTALL="$BQ_INSTALL_ROOT/expat" export TIFF_INSTALL="$BQ_INSTALL_ROOT/tiff" export MXADATAMODEL_INSTALL="$BQ_INSTALL_ROOT/MXADataModel" export BOOST_ROOT="$BQ_INSTALL_ROOT/boost-1_39"

Boost Compile and Installation

Boost version 1.39.0 is the earliest version supported by the MXADataModel library. For windows users the easiest way to get these libraryes are to download the precompiled binaries from BoostPro.com. Using their installer you can select from most of the variations available with the Boost libraries. If you choose or need to compile your own Boost libraries this is the command that I use to create the libraries and install them.
bjam.exe toolset=msvc --with-test --with-program_options --with-threads
--prefix=C:\Developer\VS9\boost_1_39 variant=release,debug
threading=multi link=static runtime-link=shared install
For Unix and OS X users, I use the following command to build boost:
[fred@Ferb:Build] $ bjam toolset=darwin --with-test
--with-program_options --with-thread variant=release,debug
threading=multi link=static runtime-link=shared
--prefix=/Users/Shared/Toolkits/boost-1_39/ architecture=combined
address-model=32_64 install
Let this go for a looong time after which Boost will be installed into C:\Developer\VS9\Boost. If you would like Boost installed somewhere else then add --prefix=C:\Path\To\Install to the above configuration line. It is helpful to set the "Boost_ROOT" environment variable. This will let CMake find Boost easier. It should be set to the same path as the "install" path from above.

Compiling MXADataModel and Unit Tests

     After you have compiled all the support libraries you are now ready to compile the main MXADataModel library code. In much the same way that you compiled the Tiff, Expat and HDF5 libraries, you can now compile and install the MXADataModel. Download the MXADataModel source archive from the website. After the download has completed, launch CMake to configure the project for your environment and generate the IDE project files or Makefiles. Open the generated project files in the IDE or open a terminal and compile the code. If you want to run the unit tests, the during the CMake configuration, select the "MXA_BUILD_TESTS" and re-configure the project. Then build the tests and run the tests using the IDE or use "make test" if you are compiling from the command line. All tests should pass on the major platforms.

Compiling MXATools

    After MXADataModel has been compiled and installed there is another project that creates GUI applications to inspect .mxa files. The MXATools project can be download from the source codes pages or from this direct link. The only prerequisite is that you will need to have an installation of Qt version 4.5 from QtSoftware. Again, use CMake to configure the project and then your preferred build method to compile and install the libraries.