Sunday, 28 April 2013

Compiling the FBX SDK for Linux on Ubuntu


Currently working getting a cool animation system for Multi, I'll write up another post about how it works in the future. But for now, if you require the importing of FBX meshes and animations into your game engine you'll need to use the FBX SDK which is provided free by Autodesk for Windows, Mac and Linux.

They also provide Python bindings into the SDK for easier usage, but it seems that access to the animation system is currently disabled.

Once you've installed the SDK on Ubuntu, in order to compile one of the samples. First cd into the samples folder and into the sample you'd like to compile.

Make sure you have the following packages installed build-essential, libxmu-dev, libxi-dev and libx11-dev by running the following commands.
sudo apt-get install build-essential
sudo apt-get install uuid-dev
sudo apt-get install libxmu-dev libxi-dev
sudo apt-get install libx11-dev

Open up one of the makefiles you'd like to build, I went with Makefile-x64-static, and modify the reference to the gcc4 compiler to gcc.
CC = gcc
LD = gcc

Add -lX11 to LIBS
LIBS = -lfbxsdk-$(LIBFBXVERSION)$(STATIC) -lm -lrt -luuid -lc -lstdc++ -lpthread -ldl -lglut_gcc34-amd64 -lGLEW_amd64 -lGLU -lGL -lXmu -lX11

Add  -DFBXSDK_NEW_API to C_FLAGS and CXX_FLAGS
CFLAGS = -m64 -DFBXSDK_NEW_API 
CXXFLAGS = -m64 -DFBXSDK_NEW_API

Finally run Make with the makefile you've chosen, in my case Makefile-x64-static
make -f Makefile-x64-static 

It'll build and deploy the resulting executable in the ../../bin/<platform>/<config>/ folder

Job Done!