Skip to content
huangminghuang edited this page Jan 29, 2014 · 14 revisions

Prerequisite

mFAST is dependent on the following tools/libraries:

  • BOOST 1.53 or higher [http://www.boost.org]
  • CMake 2.8.8 or higher [http://cmake.org]
  • tinyXML2 [http://www.grinninglizard.com/tinyxml2] (setup as a submodule in the git repository)

Download the code

$ git clone https://github.com/objectcomputing/mFAST.git
$ cd mFAST
$ git submodule init
$ git submodule update

Building the code

mFAST uses CMake as its build system. On Unix systems, you can simply following the instruction below to compile the code.

$ mkdir build
$ cd build
$ cmake ..
$ make

This uses the CMake out-of-source building approach to compile the code. You can also use make install to install the built library and tool into the system predefined path (/usr/local). For convenience, we will refer the build directory as $MFAST_BUILD_DIR.

The build system can be configured via -DOption=Value syntax when invoking cmake. Here are a list of commonly used configuration options applicable to mFAST.

  • CMAKE_BUILD_TYPE : Specify the building mode such as debug or release. Valid values are
    • None (default)
    • Debug
    • Relase
    • RelWithDebInfo
    • MinSizeRel
  • BUILD_SHARED_LIBS : whether to build mFAST as shared/dynamic linked library. Valid values are ON and OFF with default OFF. If the value is ON, both static and shared library would be built. Notice that for application to link against mFAST shared libraries, the preprocessor macro MAST_DYN_LINK must be defined for the application sources.
  • BOOST_ROOT : specify the root directory for your BOOST installation. If you have a problem with the build system finding your BOOST installation after specifying BOOST_ROOT, use cmake --help-module FindBoost in the command line to get further information.
  • CMAKE_INSTALL_PREFIX : specify the installation prefix for mFAST libraries and code generation tool.

To make sure mFAST will work correctly on your platform, you can run the unit test program $MFAST_BUILD_DIR/tests/mfast_test.

On a Microsoft Windows system with MSVC, you can download the CMake GUI tool to generate MSVC project files. The building process and unit test program require the boost DLLs; therefore make sure the BOOST DLL path is in your PATH environment variable before compiling mFAST.

Developing applications to link mFAST

Once installed, mFAST provides CMake find module to make develop mFAST application with CMake easier. Here is a basic example of CMakLists.txt for an mFAST application.

cmake_minimum_required(VERSION 2.8)
FIND_PACKAGE(mFAST REQUIRED COMPONENTS
             coder ## needed only for FAST encoder/decoder
             json) ## needed only for JSON encoder/decoder

INCLUDE_DIRECTORIES(${MFAST_INCLUDE_DIR})
LINK_DIRECTORIES(${MFAST_LIBRARY_DIRS})

FASTTYPEGEN_TARGET(model model.xml) ## generate model.{h,inl,cpp} files from model.xml
add_executable (test ${FASTTYPEGEN_model_OUTPUTS} main.cpp)
target_link_libraries (test ${MFAST_LIBRARIES} )

If you installed the mFAST package in default system search paths, you may invoke cmake to generate Makefiles directly. If it's not in your default search paths, remember to set CMAKE_PREFIX_PATH variable correctly. Like,

$ cmake .. -DCMAKE_PREFIX_PATH=/opt
Clone this wiki locally