Game Development Community

Compiling Torque with Eclipse

by mm · in Torque Game Engine · 01/02/2004 (9:05 am) · 82 replies

I have been compiling my TGE project with MSYS and minGW. After I saw the dev shot that Ron posted I took a further look at Eclipse. I must say that running through Eclipse when compiling is far more reliable and much less frustrating.

I would really like to see Eclipse used more since it really is a valuable tool for the community. While looking into Eclipse I really didn't see any tutorials on how to get it set up. And while a large portion of the community should be able to get it set up without any problems I thought I would write a step-by-step tutorial for those who might have trouble compiling.

The method I used to set up may not be the most efficient method but it hasn't given me any trouble thus far and the TGE compiles every time. Below I have laid out the steps that I used when setting up Eclipse. Thanks Ron and all those that got this resource up and running!
Page «Previous 1 2 3 4 5 Last »
#1
01/02/2004 (9:06 am)
Step 1:
Download and install MSYS from www.mingw.org. Download the .exe from the minGW download area. The current release at this date is MSYS-1.0.9.exe. Install MSYS into a directory of your choice. Example: C:\Program Files\MSYS\

Step 2:
Download a release of minGW from the minGW download area. The current release is MinGW-3.1.0-1.exe. If you have a look into the root directory of MSYS (Step 1) you should find a folder called "mingw". Now you must install minGW into this directory! So for example your installation directory should look like: C:\Program Files\MSYS\mingw\

Step 3:
Download a release of Eclipse from www.eclipse.org. The latest release is at this time 2.1.2. Extract the files into a directory of your choice, for example: C:\Program Files\eclipse\

Step 4:
Download the CDT plugin for Eclipse from www.eclipse.org/cdt/. The latest release is 1.2.0. Extract the .zip archive into the directory where you installed the eclipse root folder into, for example: C:\Program Files\

(Note: The zip archive already has an Eclipse folder located in it, so you need to unzip the archive into the parent directory of Eclipse. Not directly into the Eclipse directory.)

Step 5:
In order to run Eclipse you will need a Java Runtime Environment. Download a release from java.sun.com/j2se/1.4.2/download.html. Now install Java into the Eclipse root directory. You will need to make a folder called "jre". This should look like: C:\Program Files\eclipse\jre\

(Note: This is where somebody may have a better method of getting Eclipse up and running. I already had a Java environment running but Eclipse was unable to find it. After trying a few times to get Eclipse to recognize the JRE I took and made the folder "jre" inside the Eclipse root folder. Eclipse was searching for the "javaw.exe" in the "bin" subdirectory of "jre".)

Step 6:
Download the files by Ron Yacketta from this Resource. Extract the archive and place:
- the .cdtproject and .project files into your torque root directory. Example: C:\torque
- the conf.GCC* files into the torque\mk directory. Example: C:\torque\mk
- targets.map2dif.mk into the torque\tools directory. Example: C:\torque\tools

Step 7:
Start MSYS. Go to your torque root directory, for example type:
cd /c/torque
Then type:
make -f mk/configure.mk OS=WIN32 BUILD=RELEASE COMPILER=GCC3

You should get something like:
Current Configuration: this config is VALID 
OS: WIN32
COMPILER: GCC3
BUILD: RELEASE
DIR.OBJ: out

To change the current configuration type:

make -f mk/configure.mk {arguments, ...}

required arguments:
  OS={WIN32 BEOS LINUX OpenBSD FreeBSD Solaris}
  COMPILER={CW6 VC6 GCC2 GCC3}
  BUILD={DEBUG RELEASE}

optional arguments:
  DIR.OBJ={path to store intermediate obj files}

Note: all arguments are case sensitive.
Step 8:
Now change to the directory where you installed Eclipse, for example type:
cd /c/Program Files/eclipse

Next start Eclipse by typing:
./eclipse &

Step 9:
Run the update feature via Help->Software Updates->New Updates

Step 10:
Import a new workspace via File -> import -> Existing project into workspace
Click Next and browse to your torque root directory, then click Finish.

Step 11:
Build the engine via Project -> Rebuild All

[EDIT]
Fixed hyperlink ;)
#2
01/03/2004 (3:10 am)
Great work , thanks alot, I followed your instructions and everyting worked fine.
But Im new to this and am not sure of a few details.

After the rebuild I get a tasks list pop up,,Do you know what this is?

Also i note that the .exe file is over 4000 KB when the Realm Wars one was only 2000 and the prebuilt demo is only 900KB . Do you know why this is?
#3
01/03/2004 (3:46 am)
Brian,

If you want a smaller exe size, make sure your making a RELEASE build.

Also, you may want to alter the optimization settings :
(in conf.GCC2.WIN32.mk or conf.UNIX.mk if your using linux)

CFLAGS.RELEASE    =-O2 -finline-functions -fomit-frame-pointer \
				  # -malign-double -ffast-math  # these haven't been tested
CFLAGS.DEBUG      =-g -DTORQUE_DEBUG

Change the -O2 to -Os (you could also add this to the DEBUG build, but who needs optimization in debug builds?), and it should optimize for size and produce a smaller exe. Though i am unsure of how much performance is lost.
#4
01/03/2004 (3:58 am)
That was fast,, thanks,,ill give it a go.
#5
01/03/2004 (4:29 am)
Hey Brian I am happy that this could help you get the TGE compiled. Have fun! :)
#6
01/03/2004 (4:57 am)
I think im in Release mode.
and i changed -O2 to -Os
the size went from 4131 KB to 3823 KB

Is this normal?
#7
01/03/2004 (5:05 am)
Thanks Matt im haveing heeps of fun here, ive compiled 1.2 and head allready , and it didnt cost me a cent.
#8
01/03/2004 (5:13 am)
Yeah, we've got to thank Ron for this, it is a really great resource. :)
#9
01/03/2004 (6:08 am)
Glad to see the resource was useful :) sorry it took so long to get it posted, I initialy started to work on it when I got back from IGC'03 in mind October.

Currently I am working on getting cygwin to work correctly, seems as though their is an issue with the latest release of bintools. ln and objdump are not likeing each other and thus creates an executable that is not recognized by the OS. There is a work around; just objcopy the executable, but that can be a pain to maintain.

-Ron
#10
01/05/2004 (4:13 pm)
In the finding the jre issue, the eclipse readme says to put -vn c:/directory/ect... in the command line (in a shortcut) pointing toward the jre's directory. The only problem is that it doesnt support spaces so the default directory of Program Files/jwhatever is concatinated to just Program.
#11
01/05/2004 (4:31 pm)
Odd, I have never had an issue with the JRE. I have installed java.sun.com/j2se/1.4.2/download.html, Eclipse, MinGW and MSYS on all 3 of my wintel machines. The only issue I have ever run into was installing MSYS before MinGW, which can cause some errors seeing the MSYS will be clueless as to where the compiler (GCC) is

-Ron
#12
01/05/2004 (6:16 pm)
Anyhow, I didnt seem to have any problems compiling. Being a total newbie, can someone point me to what I am supposed to do next? There doesnt seem to be any executable files in the file structure -- how do I execute the example project?
#13
01/05/2004 (9:17 pm)
Curved , write program files like this program_files and it should work , or like this maybe progra~1

But its ezier to just install to root so you dont have to go through directorys.

when you compile all it puts the exe file into the torque/example directory.
#14
01/06/2004 (2:48 am)
Eclipse is supposed to compile it (and create an .exe) right?
#15
01/06/2004 (3:11 am)
Brian,

A reduction in executable size is common when using the -Os option ;) (Optimize for Size)
#16
01/06/2004 (3:27 am)
@Curved: Yes, and it does. :) If it compiled all right then there should be an EXE in C:\torque\example or however your file structure looks like Brian pointed out.

About the JRE, the only way I could get it to work was to do what I explained in the instructions above.

If you find the EXE then you can either double click on it to bring up the starter.fps mod. Or if you want to access the others go from the command line using the -game name and -mod name command line arguments. Torque Docs-Games & Mods

@Brian: Yeah you are right and I only put Program Files in the instructions since I figured most of the community is using an English version of Windows and that would be the default. I am running a German machine and my Program Files is only on word. ;)
Hey I wasn't sure what you were looking for on the Dev Shot, did you find any help on your question?
#17
01/06/2004 (3:36 am)
Grr in that case -- It didnt work. Ill have to do it all over again and make sure I follow your instructions to the letter.

And also, make a shortcut to eclipse and in the target of the shortcut after the quotes put -vm "c:\Program Files\whatever the default directory of the JRE is" and it should work.
#18
01/06/2004 (4:09 am)
Makeing a shortcut to eclipse will not work either, you need to run eclipse from within MSYS.

I usualy ...

- dbl click the MSYS icon on my desktop
- cd /c/Program\ Files/eclipse
- ./eclipse &

-Ron

The instructions Matt outlined are the ones I wrote up and posted in a resource, I took the defaults when installing MinGW, MSYS and Eclipse. You can install Eclipse to c:\eclipse and thus eliminate the "Program Files" issue.

-Ron
#19
01/06/2004 (4:11 am)
Also, just noticed an issue with the install instructions.
You need to swap #1 and #2; that is, install MinGW before you install MSYS

MSYS will ask you if you have MinGW installed, if you do not it could become a pain in the a$$
to get MSYS to find the compilers etc. I will post an update to the resource as well

-Ron
#20
01/06/2004 (4:31 am)
Don't you install minGW into minGW folder within MSYS? That is the way I have always done it. :)
Okay I just installed them again on another partition and everything seems to be working without trouble.

[EDIT]
I was poking around on the minGW site and this is what I found in the FAQ. I always found it easier installing minGW into MSYS. But that isn't the only way it can be done. ;)

Quote:
Simply decompress the contents of each archive into directories of your choosing, and add the MinGW "/bin" subdirectory to your PATH (either within MSYS's " /etc/profile" or in your overall system PATH). There is no need to add MSYS's "/bin" to your system PATH.

You may install the MinGW and MSYS packages anywhere on your filesystem, even nesting one within the other (creating a " mingw" subdirectory beneath your "msys" directory, for instance).
Page «Previous 1 2 3 4 5 Last »