Compiling on Windows Guide - Feedback needed

Discussions about the technical aspects of graphics development, including NewGRF tools and utilities.

Moderator: Graphics Moderators

Transportman
Tycoon
Tycoon
Posts: 2781
Joined: 22 Feb 2011 18:34

Compiling on Windows Guide - Feedback needed

Post by Transportman »

Hi all,

After my recent struggles to reduce compile time and bring the compiling of my NewGRFs to the Windows platform instead of using a Linux VM, I made a short guide on how to setup the system on Windows to also work with the make command. I just finished it, and would like to have some feedback on it before I merge it in with the DevZone-wiki. I'll probably have to rewrite some parts to be consistent with the rest of the wiki, and not place stuff double, but I wanted to have some feedback before I do that.

Are the steps I take clear, do I need to clarify or expand some stuff? Are there any errors in it? All comments are welcome.
Attachments
Windows Guide.pdf
Guide
(261.96 KiB) Downloaded 275 times
Coder of the Dutch Trackset | Development support for the Dutch Trainset | Coder of the 2cc TrainsInNML
User avatar
mart3p
Tycoon
Tycoon
Posts: 1030
Joined: 31 Oct 2005 21:00
Location: UK

Re: Compiling on Windows Guide - Feedback needed

Post by mart3p »

I've had a quick read through and it looks very good. :)

There is a better way of setting the Path variable though. The method you describe will work fine but it means you permanently have all the additions in your system path. It is better to set the path only for your compile environment. This also avoids the possibility of an error breaking the Windows system path.

The way I do this is with a batch file. Here is an example from an NML project that I have been experimenting with:

Code: Select all

@echo off
PATH=C:\NML;C:\TortoiseHg;C:\Python27;C:\MinGW\msys\1.0\bin;C:\MinGW\bin;%Path%
cmd
The second line adds all the necessary paths to the existing system path. The final line starts the command interpreter cmd.exe. After this batch file is run, commands such as 'make', 'make clean', 'make install', etc. can be run from the command line as normal.
Image
Eddi
Tycoon
Tycoon
Posts: 8271
Joined: 17 Jan 2007 00:14

Re: Compiling on Windows Guide - Feedback needed

Post by Eddi »

not sure why that would be "better"... it'd rather be confusing to me to have different paths depending on how you opened the shell...
User avatar
mart3p
Tycoon
Tycoon
Posts: 1030
Joined: 31 Oct 2005 21:00
Location: UK

Re: Compiling on Windows Guide - Feedback needed

Post by mart3p »

Eddi wrote:not sure why that would be "better"... it'd rather be confusing to me to have different paths depending on how you opened the shell...
As I said:
mart3p wrote:This also avoids the possibility of an error breaking the Windows system path.
Some Windows users are reluctant to make changes to their environmental variables, see here. :wink:
Image
User avatar
FooBar
Tycoon
Tycoon
Posts: 6553
Joined: 21 May 2007 11:47
Location: The Netherlands
Contact:

Re: Compiling on Windows Guide - Feedback needed

Post by FooBar »

Looks simple enough. I shall try this next time I'll be working on NewGRF stuff.
From the looks of it not much can be wrong, so you might as well add it to the Devzone wiki now. If something needs to be changed later, it will only be minor edits I think.
User avatar
mart3p
Tycoon
Tycoon
Posts: 1030
Joined: 31 Oct 2005 21:00
Location: UK

Re: Compiling on Windows Guide - Feedback needed

Post by mart3p »

There's a typo in the Python section:
Choose the installer that matches your system, or stick with the x86-version if you are unsure fo which version to use.
Image
User avatar
FooBar
Tycoon
Tycoon
Posts: 6553
Joined: 21 May 2007 11:47
Location: The Netherlands
Contact:

Re: Compiling on Windows Guide - Feedback needed

Post by FooBar »

I tried setting up an environment following the guide. Here's what I came across:

- Python download URL was unavailable, because a new version is released since. Maybe link to https://www.python.org/downloads/ and state that the 2.x version should be downloaded (not 3.x due to findversion.sh).
- I would not just ploink everything into the C-root, but rather in a subdirectory to avoid cluttering.
- In the Path section, TortoiseHg will add itself to the Path, so that doesn't have to be duplicated. I would also just let Python add itself through the install option.
- In the Path section, it is not tested if the MinGW\bin directory is added to the Path variable correctly. This can be done for instance with gcc --version command.
- Maybe add the suggestion that Shift+rightclick in a folder adds the option to the context menu to open a command window there.
- Add a note about the UNIX2DOS issue (viewtopic.php?p=1123126#p1123126)


Apart from that it all works. Way easier than a virtual linux.
Eddi
Tycoon
Tycoon
Posts: 8271
Joined: 17 Jan 2007 00:14

Re: Compiling on Windows Guide - Feedback needed

Post by Eddi »

FooBar wrote:I would also just let Python add itself through the install option.
that must be a new option, i don't remember it from the last time i installed python on windows
Transportman
Tycoon
Tycoon
Posts: 2781
Joined: 22 Feb 2011 18:34

Re: Compiling on Windows Guide - Feedback needed

Post by Transportman »

I added it to the wiki as a single page, incorporating most feedback, what do you all think of it?
Coder of the Dutch Trackset | Development support for the Dutch Trainset | Coder of the 2cc TrainsInNML
User avatar
FooBar
Tycoon
Tycoon
Posts: 6553
Joined: 21 May 2007 11:47
Location: The Netherlands
Contact:

Re: Compiling on Windows Guide - Feedback needed

Post by FooBar »

Very good! I think you should link to it from here: http://dev.openttdcoop.org/projects/home/wiki
Also on the subject of links: some links to external websites aren't working, while I think you meant to do that though.
Transportman
Tycoon
Tycoon
Posts: 2781
Joined: 22 Feb 2011 18:34

Re: Compiling on Windows Guide - Feedback needed

Post by Transportman »

FooBar wrote:Very good! I think you should link to it from here: http://dev.openttdcoop.org/projects/home/wiki
I did not add it yet to get some feedback and I did not yet figure out where to place the link (and which parts can be made obsolete).
Also on the subject of links: some links to external websites aren't working, while I think you meant to do that though.
Thanks for spotting, missed the : that is needed to make a link out of something.
Coder of the Dutch Trackset | Development support for the Dutch Trainset | Coder of the 2cc TrainsInNML
User avatar
planetmaker
OpenTTD Developer
OpenTTD Developer
Posts: 9432
Joined: 07 Nov 2007 22:44
Location: Sol d

Re: Compiling on Windows Guide - Feedback needed

Post by planetmaker »

I think it might be a good time now, after some time to think about it, to add it to the wiki after all? :)
Transportman
Tycoon
Tycoon
Posts: 2781
Joined: 22 Feb 2011 18:34

Re: Compiling on Windows Guide - Feedback needed

Post by Transportman »

planetmaker wrote:I think it might be a good time now, after some time to think about it, to add it to the wiki after all? :)
I added the link to the Welcome page, near the very top, which I think is the best place to put the link.
Coder of the Dutch Trackset | Development support for the Dutch Trainset | Coder of the 2cc TrainsInNML
User avatar
planetmaker
OpenTTD Developer
OpenTTD Developer
Posts: 9432
Joined: 07 Nov 2007 22:44
Location: Sol d

Re: Compiling on Windows Guide - Feedback needed

Post by planetmaker »

Transportman wrote:
planetmaker wrote:I think it might be a good time now, after some time to think about it, to add it to the wiki after all? :)
I added the link to the Welcome page, near the very top, which I think is the best place to put the link.
Perfect, thank you :)
Yoshi
Transport Coordinator
Transport Coordinator
Posts: 278
Joined: 21 Dec 2010 17:24

Re: Compiling on Windows Guide - Feedback needed

Post by Yoshi »

I tried your Guide...and failed :(

Code: Select all

./findversion.sh: line 80: dirname: command not found
./findversion.sh: line 80: cd: HOME not set
/bin/bash: cut: command not found
All programs are installed and the test commands worked:
nmlc --version
hg
python
exit()
gcc --version
bash
exit
...
User avatar
planetmaker
OpenTTD Developer
OpenTTD Developer
Posts: 9432
Joined: 07 Nov 2007 22:44
Location: Sol d

Re: Compiling on Windows Guide - Feedback needed

Post by planetmaker »

well... seems the version detection also needs the common tools dirname and cut. They should also be available for standard mingw indstalls.
The HOME variable could be set in your .bashrc:

Code: Select all

export HOME=PATH/TO/HOMEDIR
Yoshi
Transport Coordinator
Transport Coordinator
Posts: 278
Joined: 21 Dec 2010 17:24

Re: Compiling on Windows Guide - Feedback needed

Post by Yoshi »

solved these Problems....
but i get a new error :(

Code: Select all

4 "dach 2 make.bat"
[GIMP] gfx/terrain.png
/bin/bash: : command not found
make: *** [gfx/terrain.png] Error 127
./dach 2 make.bat: line 3: Pause: command not found
To say the truth: I hate command line things and environmental variables....
Transportman
Tycoon
Tycoon
Posts: 2781
Joined: 22 Feb 2011 18:34

Re: Compiling on Windows Guide - Feedback needed

Post by Transportman »

Is bash available on your system? What happens when you just type "bash" in cmd? Does it load bash or does it give an error? If it loads properly, I guess you are using GIMP and bash doesn't know where it is located. Maybe you need to add GIMP to your path (as I described for the other programs here.
Coder of the Dutch Trackset | Development support for the Dutch Trainset | Coder of the 2cc TrainsInNML
Yoshi
Transport Coordinator
Transport Coordinator
Posts: 278
Joined: 21 Dec 2010 17:24

Re: Compiling on Windows Guide - Feedback needed

Post by Yoshi »

bash:

Code: Select all

bash-3.1$
I added
"C:\Program Files\GIMP 2\bin"
to the environmental variable PATH. But still the same error..

The project, which i'd like to compile is the "example project" from the Dev Zone.
User avatar
planetmaker
OpenTTD Developer
OpenTTD Developer
Posts: 9432
Joined: 07 Nov 2007 22:44
Location: Sol d

Re: Compiling on Windows Guide - Feedback needed

Post by planetmaker »

If you have any paths or filenames with spaces, the scripts will break hard. That includes the paths to required binaries like nml or gimp or whatever.
Post Reply

Return to “NewGRF Technical Discussions”

Who is online

Users browsing this forum: No registered users and 12 guests