Angband Forums

Angband Forums (http://angband.oook.cz/forum/index.php)
-   Vanilla (http://angband.oook.cz/forum/forumdisplay.php?f=3)
-   -   Windows Compiling and Makefiles (http://angband.oook.cz/forum/showthread.php?t=164)

APWhite July 27, 2007 19:55

Windows Compiling and Makefiles
 
So you other Windows users, what are you using for compiling and debugging?

I have used Borlands freecommandlinetools for years. It is nice that there is a makefile.bcc included in the old versions of the game. I see now that 308 is out there is no makefile for Borland. What are we to use for a compiler and / or command line makefiles?

I also have Visual Studio 2005 but I have only used for PDA applications and have never been able to get it to understand how to use the angband code (so Solution or Project files).

ctate July 27, 2007 23:09

Building Angband with MSVC 2005
 
Quote:

Originally Posted by APWhite (Post 1724)
So you other Windows users, what are you using for compiling and debugging?

I have used Borlands freecommandlinetools for years. It is nice that there is a makefile.bcc included in the old versions of the game. I see now that 308 is out there is no makefile for Borland. What are we to use for a compiler and / or command line makefiles?

I also have Visual Studio 2005 but I have only used for PDA applications and have never been able to get it to understand how to use the angband code (so Solution or Project files).

Based on recent experiences I had at work with Borland's C/C++, I would not recommend using it. Ever. For anything.

I believe the canonical Angband build system uses gcc. Directions for building under cygwin or with DevC++ are in the development wiki. It built for me pretty straightforwardly using this command line from the angband/src directory in cygwin:

MINGW=yes make -f Makefile.win

Right now, personally, I'm using VS2005 Express to take advantage of the debugging environment.

To use VS2005, you need to have the Windows SDK installed as well. Create an empty Windows Application solution, then add all of the Angband src/*.c and src/win/*.c files, as well as the .rc and .ico files. Make sure that the symbol WINDOWS is defined as a compiler command-line option. In order for the resource compiler to find the .ico file at build time, you'll have to add the .ico file location to the include path. To use sound, you will need to add Winmm.lib as an additional library as well. (To build without sound support, comment out the line #define USE_SOUND in config.h.) You can also be fancy about a post-build event in order to copy the .exe to a useable spot so you can just double-click launch it and it will find the lib/ dir properly.

--
ctate

ctate August 1, 2007 23:48

Non-cygwin Windows makefile added
 
Okay, I just added a makefile to the V trunk for building the Windows version directly with Microsoft's NMAKE and MSVC toolchain, in a regular cmd.exe shell window. You go to the src/ subdirectory and type

Code:

NMAKE /F Makefile.nmake
and it compiles a debug build of Angband.exe, and copies it up a level in the hierarchy so you can run it. To do an optimized build without debug information, use the command line

Code:

NMAKE /F Makefile.nmake RELEASE=1
Right now the flags are suitable for compiling with MSVC version 6 and up. I'll add some variants later on that tune the build for MSVC 8+ ["Visual Studio 2005" is version 8]; I only have version 6 installed on the computer I'm using right now.

Of course you'll need to have the Windows SDK installed and configured for command-line use, as well as the MSVC command-line toolchain. There's a batch file provided in the Visual Studio installation that configures the build environment for you, or you can set all the appropriate environment variables by hand.

APWhite August 3, 2007 19:11

Quote:

Originally Posted by ctate (Post 1726)
To use VS2005, you need to have the Windows SDK installed as well. Create an empty Windows Application solution, then add all of the Angband src/*.c and src/win/*.c files, as well as the .rc and .ico files. Make sure that the symbol WINDOWS is defined as a compiler command-line option. In order for the resource compiler to find the .ico file at build time, you'll have to add the .ico file location to the include path. To use sound, you will need to add Winmm.lib as an additional library as well. (To build without sound support, comment out the line #define USE_SOUND in config.h.) You can also be fancy about a post-build event in order to copy the .exe to a useable spot so you can just double-click launch it and it will find the lib/ dir properly.

--
ctate


I am pretty sure that SDK is installed. I got it most of the way with your description above:

I do not see where I can add the ICO file pathway. I added the pathway somewhere, but it did not find the file (eventhough it is present in the solution explorer). I copied the ICO file to the working directory and it found it fine.

I was not able to get it to find the winmm.lib file. It is on my drive and under the Project->Preference->Common Properties->References->Reference Search Path, I added the location of the Winmm.lib file, but it still cant find it.

As far as adding the commandline option WINDOWS, I am not sure I know where to do this. I added it toProject->Preference->Configuration Properties->Debugging->command arguments. I hope this is the right place.

If you could verify this for me, I would greatly appreciate it. I need to use VS2005 in order to debug some Borg graphics issues. The BCC compiler/debugger won't work. The symbols table is too large to load in TD32.exe. It keeps pooping out so I can't effectively debug the angband borg. I thought it might be the Lua issues in 3.0.6. Maybe when I get the borg updated for 308/309, the symbols table will be smaller and I might be able to load it up.

Andrew

ctate August 3, 2007 20:29

Quote:

Originally Posted by APWhite (Post 1831)
I am pretty sure that SDK is installed. I got it most of the way with your description above:

I do not see where I can add the ICO file pathway. I added the pathway somewhere, but it did not find the file (eventhough it is present in the solution explorer). I copied the ICO file to the working directory and it found it fine. [....]

I'd suggest that you not worry about setting up a full-blown VS solution for now, and just try to build from the command line using the Makefile.nmake that I added to the source tree a few days ago in this post. Does that work for you? If so, you can run the executable alone from within the VS debugger, and that should work to get you started with debugging the current code.

I can jot up more detailed instructions on how exactly I set up my VS2005 solution file, but that's at home so I don't have access right now.

APWhite August 6, 2007 21:13

Quote:

Originally Posted by ctate (Post 1832)
I'd suggest that you not worry about setting up a full-blown VS solution for now, and just try to build from the command line using the Makefile.nmake that I added to the source tree a few days ago in this post. Does that work for you? If so, you can run the executable alone from within the VS debugger, and that should work to get you started with debugging the current code.

I can jot up more detailed instructions on how exactly I set up my VS2005 solution file, but that's at home so I don't have access right now.

Thanks for the continued help. It will make a big difference for me later on, as I keep the Borg and screensaver updated.

I ran into a few problems though. This was my trail:
1. Download and unzip the src files.
2. Download and unzip the \lib files
3. Get you makefile.nmake
4. In a cmd shell prompt typed Nmake /F makefile.nmake

I am able to get a nice compile and and EXE file using your method above, but the file doesn't do anything. The command prompt advances to the next line so I could do something else there if I needed to, but Angband does not run. If the \lib file is renamed or deleted, I get an angband popup error to that effect. But there is no Angband window, or anything. Its like it is failing at creating the interface. So yours works ok?

[edit]
This problem only seems to exist on my laptop. If I copy the exe file to my desktop, then it seems to work, though slowly.

I must have missed a config option or something. I compiled it straight out of the box, no edits or anything.

Any thoughts?

ctate August 7, 2007 00:58

Quote:

Originally Posted by APWhite (Post 1869)
This problem only seems to exist on my laptop. If I copy the exe file to my desktop, then it seems to work, though slowly.

I must have missed a config option or something. I compiled it straight out of the box, no edits or anything.

Any thoughts?

That's... very strange. It works fine for me on two different desktop machines; one running Vista and using MSVC 8, and the other running XP and using MSVC 6.

Running slowly is because it's a debug build. If you do a release build it'll be much snappier.

Weird. What happens if you try to run it under the VS debugger on the laptop? Maybe set a bunch of init-time breakpoints and see what is happening...

--
ctate

APWhite August 8, 2007 18:56

Quote:

Originally Posted by ctate (Post 1873)
Weird. What happens if you try to run it under the VS debugger on the laptop? Maybe set a bunch of init-time breakpoints and see what is happening...

--
ctate

I have only used the VS environment to debug stuff. Is there a separate program to run for debugging a file? some sort of command line option or something?

I have compiled the file in VS in debug mode (F5) and it says its "running" but it is not going anywhere. I guess I need to stick in some breakpoints and see how far it is getting. It seems like it is failing to draw the screen.

My laptop is just a normal everyday Toshiba. Everything else on it works fine.

ctate August 8, 2007 22:35

Quote:

Originally Posted by APWhite (Post 1900)
I have only used the VS environment to debug stuff. Is there a separate program to run for debugging a file? some sort of command line option or something?

The way I run random apps under VS debugging is to drag the exe file (or a shortcut) to the VS application icon. That opens up VS with that application considered the current "project." Then you just hit F5 to start execution, and off you go.

If you open up the source files you should be able to set breakpoints etc while running this way.

Good luck!

--
ctate

APWhite August 9, 2007 01:16

Quote:

Originally Posted by ctate (Post 1902)
The way I run random apps under VS debugging is to drag the exe file (or a shortcut) to the VS application icon. That opens up VS with that application considered the current "project." Then you just hit F5 to start execution, and off you go.

If you open up the source files you should be able to set breakpoints etc while running this way.

Good luck!

--
ctate

Thanks, I got this thing debugging now. Set up Breakpoints. It seems to be failing in main-win.c at line 1511 where a SendMessage() is called. I have commented out that line for now and it works fine. I will continue to work on it.

Problems may arise with the screensaver though. That routine is called in the screensaver mode. Note that the SendMessage() works fine for my laptop in version 306.

Thanks for your help. I was opening angband.exe as a file instead of a project and it was messing me up. If you find some time, I would like to get the full solution up so that I dont need to switch back to the cmd line in order to compile. But it is not too big of a deal;for years, I have used borlands to compile, so I am in the habit of doing so.

Andrew


All times are GMT +1. The time now is 16:31.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2020, vBulletin Solutions Inc.