Compiling in Windows

Generate a project with CMake

The CMake gui

Once you've installed CMake, run it and you'll see a screen something like the image below. You'll learn to be pretty familiar with this screen!

The two boxes at the top let you specify the location of your source code and the location to put build files. You should fill them in - the source location is just your regular T3D directory, and the binaries location is where you want your Visual Studio solutions to go. This should probably be something like the image below.

Configuration

Once you've set your paths, you're ready to configure your project! Hit the 'configure' button in the bottom left, and you'll be asked to choose the generator for this project. CMake lets you create project files for many different compilers. Most Windows users will be using some form of Visual Studio, so go ahead and select the version appropriate to you, like in the image below.

Once you've chosen that, you'll be presented with an error message! This is CMake prompting you to enter a name for your project, though unfortunately the only way we have to implement this is by throwing an error!

Don't panic - just hit OK, and expand the 'uncategorized entries' section and edit the value of TORQUE_APP_NAME to match the project name you're working on. At this point you can also specify whether the generated projects should use relative paths. We always recommend doing this.

Once you've filled on those values, hit 'configure' again, and you should be presented with teo more categories - TORQUE and CMAKE. Go ahead and expand TORQUE and browse the options available. You shouldn't need to touch most of these unless you have special needs - for example, PhysX, Bullet, Recast navigation or Oculus Rift support.

Once you're happy with your choices, click 'generate' and CMake will output project files to the directory you chose.

The generated files

If you browse to the location you asked CMake to put your binaries, you'll see something like the image below - a bunch of VS projects and a solution named after your project.

Compiling

To compile your project, open up the solution, right-click the INSTALL project, and click 'build'. You only need to do this the first time.

The engine executable will be generated in the project's game folder (i.e. My Projects/<project name>/game/<project name>.exe).

To run the project from within Visual Studio you will need to right click the project name and select 'set as startup project'

Using the command-line

cd "C:\Torque3D\My Projects\Game\buildFiles\CMake"

cmake ^
  -G "Visual Studio 12" ^
  -T "v120_xp" ^
  -DTORQUE_APP_NAME="Game" ^
  -DTORQUE_SFX_VORBIS=On ^
  -DTORQUE_THEORA=On ^
  -DCMAKE_BUILD_TYPE=Release ^
  C:\Torque3D

msbuild "Game.sln" /p:PlatformToolset=v120_xp /p:Configuration=Release

Change "Visual Studio 12" to the appropriate generator for your system and 32/64-git requirements.

Targeting Windows XP

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License