Город Джунов

Полная версия: Cursed Earth: HOWTO for programmers
Вы просматриваете упрощённую версию нашего контента. Просмотр полной версии с полным форматированием.
At first I need to say that this HOWTO for people, who didnt works with scons, git and gcc(MinGW) on Windows and want to help with Cursed Earth project.

First step. How to get source code.
Here is 2 ways:
download -src from Cursed Earth Files
Or get newer code from git. We have msysgit for this purpose. Msysgit have an GUI interface. Or you can use command line. You can find thousands of HOWTOs for command line interface, so it`s recommended.
If you will use git in command line mode – use "Run from the Windows command prompt" option. And use option “Checkout Windows-style, commit Unix-style line endings” anyway.
Let`s try – from any folder type in command line:
Код:
git --version
as result you`ll see:
Код:
git version 1.7.0.2.msysgit.0
If everything works – let`s get source code.
Код:
git clone git://cursedearth.git.sourceforge.net/gitroot/cursedearth/cursedearth
from folder created for project (for example C:dev)
If you will make commits, please don`t forget to set up contact info and exceptions.
Running in – list of exceptions without IDE will contain:
Код:
*.py[co]
.sconsign.dblite
bin
build
lib
cursedearth_local.cfg
These lines must be added to file cursedearth.gitinfoexclude where .git is a hidden folder. If any IDE used – you must add there any files, that IDE creates, such project file or else.
So, we have source code in project`s folder (for example C:devcursedearth).

Second step. Compiler installation.
Let`s install MinGW gcc 4.4 (not MinGW-5.1.6 with installer, because of gcc 3.6)
You can use my build(freeglut and -dep included) just unpack it to compiler folder (for example C:MinGW) and edit environment variable (thereinafter).
Or you can create your own build. Download last versions of packages from MinGW folder: binutils-*-mingw32-bin
gcc-c++-*-mingw32-bin
gcc-c++-*-mingw32-dll
gcc-core-*-mingw32-bin
gcc-core-*-mingw32-dll
gmp-*-mingw32-dll
make-*-mingw32-bin
mingwrt-*-mingw32-dev
mingwrt-*-mingw32-dll
mpfr-*-mingw32-dll
pthreads-w32-*-mingw32-dll
w32api-*-mingw32-dev
mingw-utils-*-mingw32-bin
Unpack it in one folder (for example C:MinGW) – merge all duplicated subdirectory.
Download and unpack freeglut to C:MinGW include and lib folders.
Move freeglut.dll to system32 inside WINDOWS folder or to C:MinGWbin folder.
Download and unpack cursedearth-dep to C:MinGW include and lib folders.
Move to system32 inside WINDOWS folder.

After that we need to add
Код:
;C:mingwbin
at the end of PATH environment variable.
For do it (for WinXP) you can press Right Mouse Button on My ComputerPropertiesAdvancedEnvironment Variables button.
When new dialog window will be opened find needed variable name in System Variables panel. Select it and press Edit. Do NOT remove or replace selected string – just add new values to the end of it without space.
Ok, everything is done. Let`s test it — type in command line:
Код:
gcc -v
and result will be
Код:
Thread model: win32
gcc version 4.4.0 (GCC)
If you have some problems with error encoding – delete your locale from C:MinGWsharelocale\.
So compiler works.

Third step. Build system.
We`ll use scons build system.
We need to install Python 2.6.4 (for example to CTongueython26)
After that install scons
Add
Код:
;C:Python26;C:Python26Scripts
to the end of PATH environment variable(thereinbefore).
Let`s try — type in command line:
Код:
python -V
and result will be
Код:
Python 2.6.4
And response on
Код:
scons -v
will be
Код:
SCons by Steven Knight et al.:
engine: v1.2.0.r3842,...
So, build system works.

Let`s test union of all this stuff. Command line.
Код:
cd C:devcursedearth
scons
Result will be compiled libs and executable files(C:devcursedearthspikes*bin*.exe). Start it from command line.
If you don`t need IDE you can use something like notepad++ and it`s the end of HOWTO for you.

Code::Blocks
Yo need to complete all steps before start.
Download and install Code::Blocks
If you want start quickly, you can use my project file and Makefile just unpack it into folder with sourcecode and open cursedearth.cbp.
Select any workspace.
Create “Empty Project”, name it cursedearth. Set “Folder to create project in” to C:dev. “Resulting filename” will be C:devcursedearthcursedearth.cbp. Next.
Create targets for release and debug of mapviewer. Name it mapviewer_debug and mapviewer_release. Finish.
We can see cursedearth project inside Management frame.

Select it and add all files Right Mouse Button → “Add files recursively...”. Select C:devcursedearth. OK. Select All. OK. Select all targets - Select All. OK. You need to do it every time you update source code from git or from -src package.
Select cursedearth. In main menu “Project” → “Properties”.
Go to “Project settings”. Set “This is a custom Makefile” flag.
Go to “Build Targets”. For mprviewer_debug set “Output filename” to
Код:
spikesmapviewerbinx86-windows-mingwdebugmapviewer.exe
. Remove “Auto-generate filename prefix” and “Auto-generate filename extension” flags. Do the same with mprviewer_release but type “release” instead of “debug” in filename.

Create file Makefile(without extension) in folder C:devcursedearth. Paste following code there:
Код:
all:
    scons

mapviewer_release:
    scons mapviewer
mapviewer_debug:
    scons RELEASE=0 mapviewer
cleanmapviewer_release:
    scons mapviewer -c
cleanmapviewer_debug:
    scons RELEASE=0 mapviewer -c

Let`s try Build and Run button.
If everything is OK after compilation you`ll see command line window with list of arguments fot this spike. Close it.
Now, arguments using for start spikes. “Project” → “Set programs' arguments...”. For debug and release targets of mprviewer to “Program Arguments” type something like
Код:
--ei-path="C:/EI" zone4
Press OK” button after paste arguments line or it won`t be saved.

You need to create targets(in Project settings), section in Makefile and set arguments for all spikes you want to compile and start. Edit them in a similar fasion as for mapviewer.
Get arguments for new spikes from command line window (when spike started without arguments).

Press Run button – spike will start with written argument line.
Save the project.

Command line window must be closed manually.
Don`t forget add exceptions for git (thereinbefore):
Код:
Makefile
*.cbp
*.layout

That`s all folks.
Thanks for a great guide. Now I will just see if there is anything I can do to help.