Compiling Maverik-6.1 using Borland C++ Builder

It is fairly straightforward getting Maverik working fully using Borland, but a few files will need moving around.

Getting the source files

Unzip Maverik, and create a directory for a borland project. You will need to copy all the .c and .h files from: src/SMS, src/callbacks, src/kernel, src/navigation, src/objects and src/windows (you can optionally add files from src/extras/* if you need them). You also need some gfx files from src/gfx. For opengl copy mav_gfxOpenGL.c, mav_gfxWMOpenGLWin32.c and mavlib_gfx.h, and for direct-3d copy mav_gfxDirect3D.c, mav_gfxWMDirect3D.c, mavlib_d3d.h and mavlib_gfx.h - make sure you only use one or other set of graphics files.

Copying the files is a slight pain, and you should be able to add the files from their original directories, but Borland can't cope with the number of directories involved and it mucks up the compiler include and libary flags. This is with version 3.0 (admittedly off a coverdisk), and you might have more luck with a different version. You may be able to include the Visual C++ projects in the vc++ directory directly.

Include files schminclude files

You may have up to date include files for direct-3d and opengl already with Borland. In which case you won't need to worry about them. But if you haven't, or you are getting errors from them, you can download Borland compatible d3d include files and unzip them either in your Maverik directory or in the main Borland Include directory. These are only the d3d include files (not opengl, and not any of the other directx components). If you need opengl include files, you're going to have to find them on the net somewhere.

Create a project

Start Borland, and create a new application. Remove any files that have been automatically created with it. Now "add file" all the .c files in the directory you created for the project. Edit the "project.cpp" file: before WinMain(...) add

extern "C" {
int mav_main(int, char*[]);
}
Edit WinMain to be just:
{
  mav_main(0, NULL);

  return 0;
}
(you could try parsing the LPSTR that is passed into WinMain and generating a proper (argc,argv) pair to pass to Maverik if you needed to).

Select Project->Options->Directories/conditionals and add WIN32 to the conditional defines, and ../incl (or wherever the Maverik include directory is) to the Include path

Save this project - this is your template for all Maverik applications.

Compiling an application

Open the maverik project. Save it as a different (meaningful for the application) project name (probably in a different directory e.g. the application source directory). Add the .c files for the application. Edit the application file containing main and change it to mav_main. Build the application. Be amazed when it compiles with only a bunch of warnings... hopefully. You should now be able to run it ok.

If the application reads in data files (e.g. textures example) it will need to be run from the original application source directory (or the data files will need to be copied to the .exe directory).

And there you have it. It's a bit of a pain, but once you've got your Maverik template project it's fairly easy compiling new applications. All the D3D apps I've tried work 100% (fullscreen, windowed, and with multiple windows).

Personally I'm going to stick with Cygwin...