-
Notifications
You must be signed in to change notification settings - Fork 0
How to Build
Note: By <homedir> is meant the directory where the ZgeBox2D sources are extracted on your computer.
Before compiling the ZgeBox2D, you must extract (checkout) the Box2D sources to <homedir>\Box2D directory (it further contains Box2D and Contributions subdirectories).
The latest version of ZgeBox2D Library has been compiled with Box2D v2.3.1.
The ZgeBox2D DLL can be compiled with Microsoft Visual C++ 2010 (MSVC) or higher. The latest build is compiled with Microsoft Visual Studio Express 2013 for Windows Desktop (MSVS).
-
Compile the Box2D library: In the Box2D directory use either the MSVC solution file \Box2D\Build\vs2013\Box2D.sln or use Make. If using MSVC 2010 for building, the Platform Toolset property should be changed to v100. Also the C/C++ / Runtime Library property should be changed to Multi-threaded (/MT) to get rid of dependency on MSVCR*.dll. Build for Win32/Release configuration. The result is placed to the \Box2D\Build\vs2013\bin\x32\Release\Box2D.lib file.
-
Open <homedir>\vs2010\ZgeBox2D.sln or ZgeBox2D.vcxproj in MSVC or <homedir>\vs2013\ZgeBox2D.sln in MSVS.
-
Build the solution/project resulting in <homedir>\lib\ZgeBox2D.dll file.
The ZgeBox2D DLL can also be compiled with Code::Blocks, which results in smaller, better optimized, library.
- Compile the Box2D library. The simplest way is to import the MSVC solution file <homedir>\Box2D\Box2D\Build\vs2012\Box2D.sln to Code::Blocks and run the building process. If want more optimized result, use the following options:
- Compiler Flags: -ffunction-sections -fdata-sections -s -Os (or -O3)
- Other linker options: -Wl -gc-sections
The resulting library is placed to \Box2D\Build\vs2012\libBox2D.a file.
-
Open <homedir>\cb\ZgeBox2D.cbp project file in Code::Blocks.
-
Build the solution/project resulting in <homedir>\lib\ZgeBox2D.dll file.
The ZgeBox2D shared library (.so) is compiled with Android NDK which must be installed on your computer; see http://developer.android.com/tools/sdk/ndk/ for details.
-
Before compilation, go to the source files of Box2D and add #include <string.h> to each file which already contains #include <memory.h>; namely: b2DynamicTree.cpp, b2ChainShape.cpp, b2BlockAllocator.cpp, b2GrowableStack.h.
-
Move to the <homedir>/android/ folder.
-
Run the ndk-build command of the Android NDK. The result is(are) placed to the <homedir>/android/libs//libZGEBox2D.so file(s).
By default, the Library is compiled for the ARM architecture (ARMv7-A). To change it or add other target architectures, modify Android.mk and/or Application.mk files. See the Android NDK documentation for details.