Building Horde3D

From Horde3D Wiki
Jump to: navigation, search
This page is out-of-date! Don't trust it...


This article contains instructions for building Horde3D from source on all supported platforms. Since Horde3D is very lightweight and has a minimal amount of external dependencies, getting it to compile and run is usually quite straightforward.

Contents

Obtaining the SDK

Besides the official release packages, there is also a subversion repository hosted at SourceForge which is usually more up-to-date than the stable point releases.

The repository has the common SVN structure branches, tags and trunk. The latest development snapshot can be found in the trunk folder, while the official releases are tagged in the tags folder. If you check out the trunk folder, you will get the SDK along with all official extensions.

See SVN Source Instructions for instructions on how to obtain code from Subversion.

Building on Windows

The preferred way of building Horde3D on Windows is using Visual Studio. The SDK comes with a solution file for Visual Studio 2005 that can be opened with the Visual C++ Express Edition as well. If you have Visual Studio 2008 (Standard/Professional or Express), you can simply use the VS Conversion Wizard to update the solution and project files. The solution contains the samples that can be started directly from Visual Studio. Just set the desired sample as startup project.

It is also possible to use CMake to create the Visual Studio solution files. The process is similar to what you do on Linux then. However, if you want to use Visual Studio's nmake, you usually have to use the Visual Studio Command Prompt instead of the standard cmd shell. Sample batch files for creating VS 2005 and 2008 projects can be found in the CMake folder located in the Horde3D repository.

Building on Linux

The Horde3D SDK is compatible with gcc and ships with CMake configuration files. To build Horde3D, just switch to the Horde3D root directory. Create a new directory which will contain the makefiles created by CMake, for example CMake and change into it. After that, type

 cmake ..

which will create the makefiles. Once they are created, you can type make to build the code or make clean to remove all generated files.

Linkage order for your application

You must link Horde3D library to your final executable before GL one.

WRONG:

 g++ -o app main.cpp -lGL -lHorde3D

RIGHT:

 g++ -o app main.cpp -lHorde3D -lGL

This is required for GCC 3.x and 4.x series on Linux. If you don't follow the linkage order, you will get glCreateShader error within h3dInit call.

Building on Max OS X

Mac OS X is an advanced graphical system layered over a traditional Unix core. Because of this, you can either use Apple's graphical Xcode IDE to develop Horde3D based applications, or you can go the traditional Unix way using gcc and makefiles.

The Mac Way Using Xcode

To create the Xcode project files, you have to install CMake first. After installing the CMake command line tools (so choose NOT to skip the installation when asked during the CMake installation), you should be able to run CMake from the console. Switch to Horde3D root directory and create a new directory in which the CMake output will be stored, for example CMake. Change the current directory to that newly created one and type

 cmake -G "Xcode" ..

You should now be able to open the newly created project in Xcode in order to build Horde3D.

The Unix Way Using the Command Line

To create the Makefiles, you have to install CMake first. After installing the CMake command line tools (so choose NOT to skip the installation when asked during the CMake installation), you should be able to run CMake from the console. Switch to Horde3D root directory and create a new directory in which the CMake output will be stored, for example CMake. Change the current directory to that newly created one and type

 cmake -G "Unix Makefiles" ..

The current directory should now contain a set of Makefiles, and you can build Horde3D by typing

 make

be warned that this makefile method generates an incorrect directory structure, and you may have to move the Content directory up one level before the samples will find their data.

}}

A minimal app to test your include\linker settings

 #include "glfw.h"
 #include "Horde3D.h"
 #include "Horde3DUtils.h"
 int main()
 {
   glfwInit();
   if(!glfwOpenWindow(640,480,8,8,8,8,24,8,GLFW_WINDOW))
   {
       glfwTerminate();
       return 1;
   }
   h3dInit();
   h3dRelease();
   glfwCloseWindow();
   glfwTerminate();
 }
Personal tools