Skip to content

v0.3 Build instructions

Hugues Delorme edited this page Mar 30, 2017 · 1 revision

Using CMake

gmio build system is CMake (>= v2.8). Tested compilers are GCC, MinGW, Clang and Visual C++.

Example of cmake invokation:

    cmake -G "Unix Makefiles" \
          /opt/lib/gmio       \
          -DCMAKE_BUILD_TYPE=Release \
          -DCMAKE_INSTALL_PREFIX=/opt/build/gmio

This will configure building of gmio using default values for main options.

If you chose "makefiles" CMake generator (as in the example above), once configured, then type:

    (n)make
    (n)make install

The CMake configuration (through cmake-gui for example) has several options specific to gmio :

Option Description Default
GMIO_BUILD_SHARED_LIBS Create a shared library if ON OFF
GMIO_BUILD_STRICT_C90 Force compiler to C90 mode if ON 1 OFF
GMIO_FLOAT2STR_LIB Name of the library for float-to-string conversions 2 std
GMIO_STR2FLOAT_LIB Name of the library for string-to-float conversions 3 irrlicht_fast_atof

1 This disables features that are incompatible with ISO C90, such as C99 strtof(), snprintf(),Bool, ...
Note that Visual C++ support of strict C90 mode is rather broken (compiler option /Za)

2 Values :
std: C standard library functions(eg snprintf())
google_doubleconversion: Google's double-conversion functions, note that this implies C++
fastness: std < google_doubleconversion
robustness: google_doubleconversion <= std

3 Values :
std: C standard library functions(eg strtod())
irrlicht_fast_atof: fast_atof() function of the Irrlicht project
google_doubleconversion: Google's double-conversion functions, note that this implies C++
fastness: std < google_doubleconversion < irrlicht_fast_atof
robustness: irrlicht_fast_atof < google_doubleconversion <= std

Although use of CMake is encouraged, it can be easily replaced by other build systems. Just take care to create a config.h header within the gmio_core folder (see config.h.cmake for the definitions to be set).

Run unit tests

After having successfully built gmio, you should run unit tests to see if gmio works fine (especially if you plan to use it on not so common compilers, OS, ...).
To run unit tests, just type (n)make check
This will produce text output for each test. If everything goes fine you should see the last lines :

    100% tests passed, 0 tests failed out of X
    Total Test time (real) =   ...

Note on gmio_support

gmio_support is the bridge between gmio and other 3rd-party libraries (eg. OpenCascade, Qt, ...), allowing seamless integration. Nonetheless, to avoid the gmio library being dependent of some other binaries, compilation of gmio_support is left to the developer.
For example if Qt streams are needed then the target project must build somehow gmio_support/stream_qt.cpp
All gmio_support source files are copied with install target (ie by doing (n)make install) to PREFIX/src/gmio_support

Generate HTML reference manual

When using the "makefiles" CMake generator then the doc target is available, so just type:

    (n)make doc

and this will produce the HTML reference manual in $BUILD_DIR/doc/html.
Note that Doxygen is required for that step.