Building An Executable

From NARS2000
Revision as of 22:33, 13 January 2009 by Sudleyplace (talk | contribs)
Jump to navigationJump to search

Platforms

The current version of NARS2000 runs on Windows platforms only, however the goal is to move it to Linux, Mac OS, etc. as per user requests and developer interests. As such, for the moment, the following description for building an executable is necessarily biased towards Windows.

Downloads

To build the executable you'll need the following

  • C Compiler and Linker
  • Make program
  • Resource Compiler
  • Windows SDK
  • Parser Generator
  • Zip Utility
  • PHP (Hypertext Preprocessor)
  • NARS2000 Source Code
  • NARS2000 External Libraries
  • Optionally, Source Control program
  • Optionally, a Code Merge program

All of the tools you'll need are freely available. Some of them happen to be Microsoft-specific, however there is no reason more generic tools (such as DJGPP, Cygwin or MinGW) can't be used, a task I'm hoping someone will volunteer to investigate. In particular, the tools currently used are as follows:

Install Tools

To install the Parser Generator (Bison), run the Cygwin setup.exe program and choose the Devel category, then bison. Install the rest of the tools as per their separate instructions.

Install Source Code

First create a root directory somewhere on one of your hard drives, perhaps calling it NARS2000, as in C:\NARS2000 or perhaps at some lower level. The source code and external libraries are installed below this level.

Download the source code tar ball (trunk.tar.gz) into the root directory and decompress it with tar zxvf trunk.tar.gz. The tar program is part of Cygwin and is found in C:\Cygwin\bin (or wherever you installed Cygwin). This command also creates the trunk directory and several directories below that.

Under the root directory (at the same level as the trunk directory), also make a directory called branches. The former directory holds the main body of code. The latter directory is used for developer-specific branches not as yet incorporated into the main trunk.

Download the qdebug.zip, misc.zip, and gsldir.zip files into the trunk directory and unzip them using 7z.exe as in 7z x qdebug.zip, 7z x misc.zip, and 7z x gsldir.zip.

Directories

After unzipping the above files, the directory structure under the root directory should look something like

branches\
trunk\
trunk\binaries\
trunk\binaries\COM\
trunk\Extensions\
trunk\Extensions\aplchars\
trunk\Extensions\aplchars\chrome\
trunk\Extensions\aplchars\chrome\content\
trunk\Extensions\aplchars\chrome\content\aplchars\
trunk\Extensions\aplchars\chrome\locale\
trunk\Extensions\aplchars\chrome\locale\en-US\
trunk\Extensions\aplchars\chrome\locale\en-US\aplchars\
trunk\Extensions\aplchars\chrome\skin\
trunk\Extensions\aplchars\chrome\skin\classic\
trunk\Extensions\aplchars\chrome\skin\classic\aplchars\
trunk\Extensions\aplchars\defaults\
trunk\Extensions\aplchars\defaults\preferences\
trunk\gsl\
trunk\gsl\.libs\
trunk\gsl\blas\
trunk\gsl\block\
trunk\gsl\cblas\
trunk\gsl\cblas\.libs\
trunk\gsl\complex\
trunk\gsl\eigen\
trunk\gsl\include\
trunk\gsl\include\arpa\
trunk\gsl\include\asm\
trunk\gsl\include\cygwin\
trunk\gsl\include\gsl\
trunk\gsl\include\machine\
trunk\gsl\include\mingw\
trunk\gsl\include\mingw\sys\
trunk\gsl\include\net\
trunk\gsl\include\netinet\
trunk\gsl\include\sys\
trunk\gsl\include\w32api\
trunk\gsl\include\w32api\ddk\
trunk\gsl\include\w32api\GL\
trunk\gsl\linalg\
trunk\gsl\matrix\
trunk\gsl\permutation\
trunk\gsl\sort\
trunk\gsl\specfunc\
trunk\gsl\statistics\
trunk\gsl\vector\
trunk\htdocs\
trunk\htdocs\art\
trunk\htdocs\download\
trunk\htdocs\styles\
trunk\images\
trunk\MediaWiki\
trunk\MediaWiki\art\
trunk\MediaWiki\extensions\
trunk\ReleaseNotes\
trunk\WineHQ\
trunk\WineHQ\Include\
trunk\WineHQ\Include\msvcrt\
trunk\WineHQ\Include\msvcrt\sys\
trunk\WineHQ\Include\msvcrt\Wine\

Setup VC Express

If you are using VC++ Express users, the project file will be in the trunk directory and is called NARS2000.vcproj.

The vast majority of the project settings is found in the above file with some exceptions.

Open VC++ Express and select from the menu Tools | Options.... Then select from the lefthand pane of the Options dialog Projects and Solutions.

  • From the lefthand pane, select VC++ Directories. In the righthand pane, in the Show directories for: combobox, select Include files. Append to the end of the list of include directories .\gsl\include.
  • From the lefthand pane, select VC++ Project Settings. In the righthand pane, enter in Rule File Search Paths, the root directory (e.g., C:\NARS2000\trunk).
  • Click OK to close the Options dialog.

Environment Variables

If you are building from the makefile, you'll need to set some environment variables in your autoexec.bat file:

REM Path and name of zip program (7-Zip)
Set ZIPPRG="C:\Program Files\7-Zip\7z"

REM Path and name of parser generator (bison)
Set PARGEN=C:\Cygwin\bin\bison

REM Directory of SDK ("C:\Program Files\Microsoft SDKs\Windows\v6.0A")
Set SDK=U:\

REM MSVC compiler ("C:\Program Files\Microsoft Visual Studio 9.0")    (Version 15.00.30729.01)
Set MSVC=V:\VC\

I find it convenient to use the Windows subst command to map drive letters as in the references to drives U: and V: above.

subst U: "C:\Program Files\Microsoft SDKs\Windows\v6.0A"
subst V: "C:\Program Files\Microsoft Visual Studio 9.0"

If you install the above tools in other directories, make the appropriate changes to the above lines.

You will also have to append the directories V:\Common7\IDE and V:\VC\bin to your path so the C compiler can find some of its DLLs and tools.

Building The Executable

At this point you should be ready to build the executable. To do this from VC Express (having already opened the project file), click on the menu item Build and Build Solution or press F7. To do this from a makefile, type mk32.