cpgf library documentation

Building and use cpgf library

Using the library

  1. In the project setting, add an include path pointing to “cpgf/include”.
  2. Link the source code or link the library in your project.
  3. All classes, functions and APIs are in the namespace “cpgf”.

To use the library, the easiest way is to link all .cpp source code under the src and sub folders.
However, a build script is also provided to build the code as static library.

Build the library

The library uses CMake as the build system.
A makefile is provided to wrap the CMake build.
To build the library, open command line terminal, go to folder “build”,

make PLATFORM

PLATFORM can be one of
nmake mingw linux vc05 vc08 vc10 cb_mingw cb_nmake cb_linux

For detailed PLATFORM information, run “make” without parameter to see the help.

If you are using MSVC, run “nmake” instead of “make”.

To build with Lua binding, you must change the variable LUA_DIR in build.config.txt to point to the source code of Lua.
To build with Google V8 Javascript binding, you must change the variable V8_DIR in build.config.txt to point to the source code of V8.
To build the unit test and sample code, feed a second parameter
make PLATFORM TARGET=TheTarget
TheTarget can be,

  • lib – Build the library. This is the default if TARGET is omitted.
  • test – Build the unit test.
  • samplereflection – Build the reflection sample application.
  • samplelua – Build the Lua binding sample application.