On this page is described the procedures to follow if you want to download the Train Director 3 sources to modify them and build them for your own system.

First is described the procedure for Microsoft Windows systems, then the procedure to build on Linux systems.

In either case it's necessary to download the program's sources.

However, before one can build the sources, it's necessary to download and build the wxWidgets run-time libraries.
wxWidgets is a very versatile collection of C++ classes that makes very easy to create multi-platform applications that look very nice and that have advanced functionalities.

Thanks to these libraries, the same code can be compiled on both Windows and Linux systems without any change.


Building on Windows

To build on Windows using the project file included in the source package is necessary to have the Microsoft Visual Studio 6 environment. Follow this procedure:

  • Download the wxWidgets 2.8.0 library fron this site: http://www.wxwidgets.org/downloads. Install the sources in any directory. Personally I use the following directory: C:\cg\projects\wxWidgets-2.8.0.
  • In Visual Studio, open the file wxWidgets-2.8.0\build\msw\wx_dll.dsw.
  • In the project window (Alt+0) the "adv" project should be automatically selected as the active project. If it is not selected, click with the right mouse button on the "adv" project, and select "Set as active project".
  • Make sure of the selected configuration using the "Build + Set active configuration" menu. The suggested configuration for a developer is "adv - Win32 DLL Debug".
  • Press F7 to start the build. Depending on the power of your computer, the build should finish within 10 minutes.
  • At the end of the build, it is necessary to manually build a few more projects, such as "html". To do this, click with the right mouse button on the "html" project and select "Set as archive project", then build with F7.

    After you have built the run-time libraries, quit Visual Studio.

  • At this point you need to download the Train Director 3 sources and unzip them in a directory parallel to where you downloaded wxWidgets. Personally, I keep the Train Director 3 sources in the directory C:\cg\projects\traindir3.
  • Start Visual Studio again, and open the Workspace file traindir3\traindir3.dsw.
  • Make sure that the active configuration matches the configuration you used when you built the wxWidget libraries. Use the "Build" + "Set active configuration" and select "traindir3 - Win32 Debug".
  • If you downloaded all the files in the correct directories, it should be sufficient to press F7 to build the traindir3.exe file.


Building on Linux

Building on Linux is a bit more complex, due to the great variety of distributions and compiler versions available. The executable binaries and the libraries available on this site were compiled on a Red Hat Enterprise Linux 3 system, using the gcc 3.2.6 compiler and the Gnome environment.

Unfortunately such configuration may not be compatible with more recent systems, such as Fedora Core 6.

Specific instructions to compile on Ubuntu 7 are available.

If you need to re-build the binaries, follow this procedure:

  • Download the wxWidgets 2.8.0 library from the site http://www.wxwidgets.org/downloads. Install the sources in any directory. Personally I use the directory /home/gcaprino/wxWidgets-2.8.0.
  • In that directory, run the following commands:
        $ ./configure --with-libpng --with-libjpeg --with-libxpm \
             --with-gnomeprint --with-regex --with-zlib
        $ make
    

    This will build the dynamic libraries that will be linked by Train Director 3.

  • Download the Train Director 3 sources, and unzip them in any directory. Personally, I put the Train Director 3 sources in the directory ~/traindir3. For example:
        $ mkdir ~/traindir3
        $ cd ~/traindir3
        $ unzip -a tdir39src.zip
        $ mkdir objs
    
  • At this point, you need to modify the Makefile.lnx and specify where you compiled the wxWidgets libraries. Change the following lines in the Train Director Makefile.lnx:

        top_srcdir = /home/gcaprino/wxWidgets-2.8.0
        top_builddir = /home/gcaprino/wxWidgets-2.8.0
        ...
        CXXFLAGS = -O2 -pthread -Wall -Wundef Wno-ctor-dtor-privacy
        ...
        WX_RELEASE = 2.8
    

  • It is now possible to compile Train Director 3 by simply typing:
        $ make -f Makefile.lnx
    

    Note that the build will produce many "warnings". The main reason for this is that the major part ot Train Director sources are still written in C (like the versions before 3), and several sources were simply renamed with the .cpp extension.

  • At the end of the build you should get a traindir3 executable file. Run the executable file to start Train Director 3.

As already mentioned, I cannot guarantee that this procedure will work with all distributions and compiler combinations.

If you have any additions or corrections, send me the updated files and I will update the site.

Compiling for Mac OS X

The instructions to compile for Mac OS X are basically the same as the instructions to compile for Linux systems. The only difference is that you should modify the file Makefile.mac. The structure of this file is the same as that of the corresponding Makefile.lnx, so you can just follow the instructions in the previous chapter to modify and compile.

Compiling on Linux Ubuntu 7

The Train Director use ASCII strings, while many distributions, including Ubuntu, install by default the wxWidget libraries compiled in Unicode mode. In this case it's probable that upon execution of Train Director, the program will crash immediately.

It is therefore indispensible to download the appropriate wxWidgets libraries with ASCII support.

Perform the following steps:

  • Log in as "root".
  • Add the following line to the /etc/apt/sources.listfile:
    http://apt.wxwidgets.org/ gutsy-wx main
    
  • Run the "synaptic" program.
  • Click on "Reload" and then on "Search".
  • In the "Search" dialog, enter libwx, followed by "OK".
  • In the list show, select libwx2.8-ansi-dev, and select to download and install the dependent packages.
  • After closing the dialog, click on "Apply" to install the packages.
  • After the installation, exit from "synaptic".
  • Download the Train Director sources in a directory, and execute the following command:
       g++ `wx-config --unicode=no --cppdefs` -o traindir3 \
               *.cpp `wx-config --unicode=no --libs`
    
  • After this command, it should be possible to execute the ./traindir3 program.


This page is maintained by g_caprino@gmail.com
(Remove the '_' before sending your message.)
Created on: January 4, 2007