• Register

OpenTomb is a cross-platform reimplementation of classic Tomb Raider 1—5 engines.

Post tutorial Report RSS How to compile OpenTomb in Windows using Code::Blocks IDE

This article describes the process of making OpenTomb sources work within Code::Blocks development environment.

Posted by on - Intermediate Client Side Coding

This article describes the process of making OpenTomb source code work within Code::Blocks development environment. It can be useful for those who want to contribute, but have problems with setting all up properly.

Basically, there are two ways to do it.

First way

1. Make sure you have installed Code::Blocks version that comes with MinGW32 compiler. It's completely free and open-source, you don't have to pay for it.

2. After installation is complete, open Code::Blocks and create new empty project. Then, in the left part of Code::Blocks window (Management), right-click project icon and select "Add files recursively". Then, select a folder with OpenTomb sources (better way to do it is to clone SF repository using TortoiseHg workbench, but you can just download latest snapshot here and unpack it somewhere).



Code::Blocks should then scan it and offer you to add all *.cpp/*.h files with subfolders. Just click OK in "multiple selection" window. Then you must have tree view of all source files in Management part, including bullet, freetype, gltt and vt subfolders.

3. So, now you have all needed files in project, but you also need to write paths for compiler and linker to find them. To do it, go to Project->Build options.... Then, in Linker settings tab, you should manually add libraries to "Link libraries" list. Here is it:


Note that there may not be liblua.a, libSDL.a, libSDLmain.a and libz.a libraries - you must add them manually by downloading corresponding packages from Lua, SDL and zlib websites. Also note that you must have corresponding header files in MinGW\include\ directory.

4. Cobe::Blocks by default divides project to Debug and Release branches. You can note it in screenshot above, left part of window has "OpenTomb" and two branches - Debug and Release. If you have similar project structure, make sure that after completing link libraries list, you select them all in the list, then press "Copy selected to..." button at the bottom part of the list and copy this list to both Debug and Release branches.

5. Now go to Search directories tab in same options window. There, you also manually populate directory list that compiler may refer to. It depends on your project folder structure, but in my case I have "OpenTomb" folder with "prj" subdirectory for project files and "src" subdirectory for source files. So in my case, list looks like this:


As with linker library list, you must copy directory list to Debug and Release branches, if you have them. Select all folders in the list, press "Copy to..." button at the bottom and copy it to both Debug and Release branches.

6. Now exit "Build options" window (don't forget to save changes by pressing OK), and enter Project->Properties... menu. There, immediately go to "Build targets" tab. Make sure that you have similar setup:


Note that "Execution working dir" must point to a folder where you have all necessary files for OpenTomb (i. e. /data folder with TR levels, config file, font file, etc.). Also, "Output filename" should point at the same folder with executable name itself added to the end. As for "Objects output dir" field, it specifies a folder where object files (pre-compiled modules) are placed. You may create additional folder (in my case, it is /obj folder), because this way it looks cleaner than placing it at the same folder as sources or binaries.

Second way

This method is much easier and requires less steps to set everything up. It is offered by TeslaRus, the original author of OpenTomb.

As in the first way, you need to add all OpenTomb source files with "Add files recursively..." feature. Then, you only need to set up two fields in project build options. Here are the screenshots:



So, if everything is done correctly (either first or second way), you now must be able to build and debug OpenTomb right inside Code::Blocks environment, without additional cryptic compiler set-up or Makefile mayhem!

Post comment Comments
Guest
Guest - - 689,427 comments

This comment is currently awaiting admin approval, join now to view.

Guest
Guest - - 689,427 comments

This comment is currently awaiting admin approval, join now to view.

Post a comment

Your comment will be anonymous unless you join the community. Or sign in with your social account: