1. Introduction
  2. General Build Notes
  3. Building on Mac OSX using frameworks and cmake
  4. Building on GNU/Linux (apt based distro)
  5. Building under windows using MSYS
  6. Building under Windows using MSVC Express
  7. Authors and Acknowledgments

1. Introduction

This document is the original installation guide of the described software openModeller. The software and hardware descriptions named in this document are in most cases registered trademarks and are therefore subject to the legal requirements. openModeller is subject to the GNU General Public License. Find more information on the openModeller Homepage: http://openmodeller.sf.net/

The details, that are given in this document have been written and verified to the best of knowledge and responsibility of the editors. Nevertheless, mistakes concerning the content are possible. Therefore, all data are not liable to any duties or guarantees. The editors and publishers do not take any responsibility or liability for failures and their consequences. You are always welcome for indicating possible mistakes.

Please visit http://openmodeller.sf.net for information on joining our mailing lists and getting involved in the project further.

/!\ *Note:* This is a 'cut and paste' tutorial - in most cases you can simply copy the commands listed in codeblocks that look like this:

somecommand to be pasted 

2. General Build Notes

At version 0.5.2 openModeller no longer uses the autotools for building. openModeller, like a number of major projects (eg. KDE 4.0), now uses cmake for building from source. The configure script in this directory simply checks for the existence of cmake and provides some clues to build openModeller.

2.1. An overview of the dependencies required for building

Required build deps:

3. Building on Mac OSX using frameworks and cmake

In this approach I will try to avoid as much as possible building dependencies from source and rather use frameworks wherever possible.

3.1. Install XCODE

I recommend to get the latest xcode dmg from the Apple XDC Web site. Install XCODE after the ~941mb download is complete.

3.2. Install development frameworks for openModeller dependencies

Download William Kyngesburye's excellent all in one framework that includes proj, gdal, sqlite3 etc

http://www.kyngchaos.com/files/software/unixport/AllFrameworks.dmg 

Once downloaded, open and install the frameworks.

William provides an additional installer package for Postgresql/PostGIS. Its available here:

http://www.kyngchaos.com/software/unixport/postgres 

There are some additional dependencies that at the time of writing are not provided as frameworks so we will need to build these from source.

3.2.1. Additional Dependencies : GSL

Retrieve the Gnu Scientific Library from

curl -O ftp://ftp.gnu.org/gnu/gsl/gsl-1.8.tar.gz 

Then extract it and build it to a prefix of /usr/local:

tar xvfz gsl-1.8.tar.gz 
cd gsl-1.8 
./configure --prefix=/usr/local 
make
sudo make install
cd ..  

3.2.2. Additional Dependencies : Expat

Get the expat sources:

http://sourceforge.net/project/showfiles.php?group_id=10127 
tar xvfz expat-2.0.0.tar.gz 
cd expat-2.0.0 
./configure --prefix=/usr/local
make 
sudo make install 
cd ..  

3.3. Install CMAKE for OSX

Get the latest release from here:

http://www.cmake.org/HTML/Download.html 

At the time of writing the file I grabbed was:

curl -O http://www.cmake.org/files/v2.6/cmake-2.6.4-Darwin-universal.dmg

Once downloaded open the dmg and run the installer

3.4. Install subversion for OSX

The http://sourceforge.net/projects/macsvn/ project has a downloadable build of svn. If you are a GUI inclined person you may want to grab their gui client too. Get the command line client here:

curl -O http://ufpr.dl.sourceforge.net/sourceforge/macsvn/Subversion_1.4.2.zip 

Once downloaded open the zip file and run the installer.

You also need to install BerkleyDB available from the same http://sourceforge.net/projects/macsvn/. At the time of writing the file was here:

curl -O http://ufpr.dl.sourceforge.net/sourceforge/macsvn/Berkeley_DB_4.5.20.zip 

Once again unzip this and run the installer therein.

Lastly we need to ensure that the svn commandline executeable is in the path. Add the following line to the end of /etc/bashrc using sudo:

sudo vim /etc/bashrc 

And add this line to the bottom before saving and quiting:

export PATH=/usr/local/bin:$PATH:/usr/local/pgsql/bin 

/usr/local/bin needs to be first in the path so that the newer bison (that will be built from source further down) is found before the bison (which is very old) that is installed by MacOSX

Now close and reopen your shell to get the updated vars.

3.5. Check out openModeller from SVN

Now we are going to check out the sources for openModeller. First we will create a directory for working in:

mkdir -p ~/dev/cpp 
cd ~/dev/cpp 

Now we check out the sources:

Trunk:

svn co https://openmodeller.svn.sourceforge.net/svnroot/openmodeller/trunk/openmodeller

The first time you check out openModeller sources you will probably get a message like this:

 Error validating server certificate for 'https://openmodeller.svn.sourceforge.net:443':
 - The certificate is not issued by a trusted authority. Use the fingerprint to
   validate the certificate manually!  Certificate information:
 - Hostname: openmodeller.svn.sourceforge.net
 - Valid: from Apr  1 00:30:47 2006 GMT until Mar 21 00:30:47 2008 GMT
 - Issuer: Developer Team, openModeller, Anchorage, Alaska, US
 - Fingerprint: 2f:cd:f1:5a:c7:64:da:2b:d1:34:a5:20:c6:15:67:28:33:ea:7a:9b
   (R)eject, accept (t)emporarily or accept (p)ermanently?  

I suggest you press 'p' to accept the key permanently.

3.6. Configure the build

CMake supports out of source build so we will create a 'build' dir for the build process. By convention I build the software into /usr/local in my home directory.

cd openmodeller 
mkdir build 
cd build 
cmake -D CMAKE_BUILD_TYPE=Release ..

Now compile ...

make 

If all built without errors you can then install it:

sudo make install 

Ensure that /usr/local/bin is in your path and then you can use the openModeller command line tools as per normal.

4. Building on GNU/Linux (apt based distro)

*Requires:* Ubuntu Edgy / Debian derived distro

These notes are for if you want to build openModeller from source. One of the major aims here is to show how this can be done using binary packages for *all* dependencies - building only the core openModeller stuff from source. I prefer this approach because it means we can leave the business of managing system packages to apt and only concern ourselves with coding openModeller!

This document assumes you have made a fresh install and have a 'clean' system. These instructions should work fine if this is a system that has already been in use for a while, you may need to just skip those steps which are irrelevant to you.

4.1. Prepare apt

The packages openmodeller depends on to build are available in the "universe" component of Ubuntu. This is not activated by default, so you need to activate it:

  1. Edit your /etc/apt/sources.list file.
  2. Uncomment the all the lines starting with "deb"

    Also you will need to be running Ubuntu 'Lucid' or Linux Mint 9 (or higher) in order for all dependencies to be met.

    Now update your local sources database:

    sudo apt-get update 
    

4.2. Install software dependencies required by openModeller

sudo apt-get install gdal-bin libgdal1-dev proj \
libgsl0-dev libexpat1-dev subversion libsqlite3-dev sqlite3 \
libhdf4-alt-dev libjasper-dev libtiff4-dev \
g++ make cmake cmake-curses-gui txt2tags

4.3. Prepare your development environment

As a convention I do all my development work in $HOME/dev/<language>, so in this case we will create a work environment for C++ development work like this:

mkdir -p ${HOME}/dev/cpp 
cd ${HOME}/dev/cpp 

This directory path will be assumed for all instructions that follow.

4.4. Check out the openModeller Source Code

cd ${HOME}/dev/cpp 
svn co https://openmodeller.svn.sourceforge.net/svnroot/openmodeller/trunk/openmodeller

The first time you check out the source you will be prompted to accept the openmodeller.svn.sourceforge.net certificate. Press 'p' to accept it permanently:

Error validating server certificate for 'https://openmodeller.svn.sourceforge.net:443':
   - The certificate is not issued by a trusted authority. Use the
     fingerprint to validate the certificate manually!  Certificate
     information:
   - Hostname: openmodeller.svn.sourceforge.net
   - Valid: from Apr  1 00:30:47 2006 GMT until Mar 21 00:30:47 2008 GMT
   - Issuer: Developer Team, openModeller, Anchorage, Alaska, US
   - Fingerprint:
     2f:cd:f1:5a:c7:64:da:2b:d1:34:a5:20:c6:15:67:28:33:ea:7a:9b (R)eject,
     accept (t)emporarily or accept (p)ermanently?  

4.5. Starting the compile

I compile my development version of openModeller into the default /usrl/local directory to avoid conflicts with Ubuntu packages that may be under /usr.

Now we create a build directory and run ccmake:

cd openmodeller
mkdir build
cd build
ccmake ..

When you run ccmake (note the .. is required!), a menu will appear where you can configure various aspects of the build. If you do not have root access or do not want to overwrite existing openModeller installs (by your packagemanager for example), set the CMAKE_BUILD_PREFIX to somewhere you have write access to (I usually use /home/timlinux/apps). Now press 'c' to configure, 'e' to dismiss any error messages that may appear. and 'g' to generate the make files. Note that sometimes 'c' needs to be pressed several times before the 'g' option becomes available. After the 'g' generation is complete, press 'q' to exit the ccmake interactive dialog.

Now on with the build:

make
make install

It may take a little while to build depending on your platform.

4.6. Running openModeller

Now you can try to run openModeller:

om_console

If all has worked properly the openModeller application should start with a message giving useage instructions.

5. Building under windows using MSYS

5.1. MSYS:

IMPORTANT: This section is here for historical reasons, because in ancient times there was an attempt to use this approach to generate the Windows version of openModeller. Until now, no official version of openModeller was ever released for Windows using MSYS. All official versions were generated with MSVC (see next section).

MSYS provides a unix style build environment under windows. We have created a zip archive that contains just about all dependencies.

Get this:

http://qgis.org/uploadfiles/msys/msys.zip

and unpack to c:\msys

/!\ Note: If you wish to build the dependencies yourself, detailed notes are available in the QGIS source tree INSTALL document.

5.2. Subversion:

In order to check out openModeller sources from the repository, you need Subversion client. This installer should work fine:

http://subversion.tigris.org/files/documents/15/36797/svn-1.4.3-setup.exe

/!\ Note: You must use a command line svn client because its used by cmake during the build process.

5.3. CMake:

CMake is build system used by openModeller. Download it from here:

http://www.cmake.org/files/v2.6/cmake-2.6.4-win32-x86.exe

/!\ Note: Get the most recent version.

5.4. openModeller:

Start a cmd.exe window ( Start -> Run -> cmd.exe ) Create development directory and move into it

md c:\dev\cpp 
cd c:\dev\cpp 

Check out sources from SVN trunk:

svn co https://openmodeller.svn.sourceforge.net/svnroot/openmodeller/trunk/openmodeller

5.5. Compiling:

Start a cmd.exe window ( Start -> Run -> cmd.exe ) if you don't have one already. Add paths to compiler and our MSYS environment:

cd c:\dev\cpp\openmodeller 
md build 
cd build 

5.6. Configuration

cmakesetup ..  

/!\ NOTE: You must include the '..' above.

Click 'Configure' button. When asked, you should choose 'MinGW Makefiles' as generator.

There's a problem with MinGW Makefiles on Win2K. If you're compiling on this platform, use 'MSYS Makefiles' generator instead.

All dependencies should be picked up automatically, if you have set up the Paths correctly. The only thing you need to change is the installation destination (CMAKE_INSTALL_PREFIX) and/or set 'Debug'.

For compatibility with NSIS packaging scripts I recommend to leave the install prefix to its default.

When configuration is done, click 'OK' to exit the setup utility.

5.7. Compilation and installation

 make
 make install 

5.8. Run openmodeller.exe from the directory where it's installed (CMAKE_INSTALL_PREFIX)

Make sure to copy all .dll:s needed to the same directory as the openmodeller.exe binary is installed to, if not already done so, otherwise openModeller will complain about missing libraries when started.

The best way to do this is to download both the openModeller current release installer package from http://openmodeller.sf.net and install it (make sure to get the mingw build). Now copy the installation dir from C:\Program Files\openModeller into c:\Program Files\openmodeller-0.5.2 (or whatever the current version is. The name should strictly match the version no.) After making this copy you can uninstall the release version of openModeller from your c:\Program Files directory using the provided uninstaller. Double check that the openModeller dir is completely gone under program files afterwards.

Another possibility is to run openmodeller.exe when your path contains c:\msys\local\bin and c:\msys\local\lib directories, so the DLLs will be used from that place.

5.9. Create the installation package: (optional)

Downlad and install NSIS from (http://nsis.sourceforge.net/Main_Page)

Now using windows explorer, enter the install_win directory in your openModeller source tree. Read the README file there and follow the instructions. Next right click on openmodeller.nsi and choose the option 'Compile NSIS Script'.

6. Building under Windows using MSVC Express

Tim Sutton, 2007

6.1. System preparation

I started with a clean XP install with Service Pack 2 and all patches applied. I have already compiled all the dependencies you need for gdal, expat etc, so this tutorial won't cover compiling those from source too. Since compiling these dependencies was a somewhat painful task I hope my precompiled libs will be adequate. If not I suggest you consult the individual projects for specific build documentation and support. Lets go over the process in a nutshell before we begin:

6.2. Install the libraries archive

Half of the point of this section of the MSVC setup procedure is to make things as simple as possible for you. To that end I have prepared an archive that includes all dependencies needed to build openModeller. Fetch the archive from:

http://openmodeller.cria.org.br/download/extlibs/msvc/omlibs-release.zip

/!\ Note: If you wish to build the dependencies yourself, detailed notes are available in the QGIS source tree INSTALL document.

Create the following directory structure:

c:\dev\cpp\

And then extract the libraries archive into a subdirectory of the above directory so that you end up with:

c:\dev\cpp\omlibs-release

/!\ Note that you are not obliged to use this directory layout, but you should adjust any instructions that follow if you plan to do things differently.

6.3. Install Visual Studio Express 2005

First thing we need to get is MSVC Express from here:

http://www.microsoft.com/express/2005/

Click on "Download Now" under the Visual C++ 2005 image. The next page is a bit confusing so don't feel bad if you cant actually find the download at first! There are six coloured blocks on the page for the various studio family members (vb / c# / j# etc). Simply choose your language under the 'select your language' combo under the yellow C++ block, and your download will begin. Under internet explorer I had to disable popup blocking for the download to be able to commence.

Once the setup commences you will be prompted with various options. Here is what I chose :

6.4. Install Microsoft Platform SDK2

Go to this page:

http://msdn2.microsoft.com/en-us/express/aa700755.aspx

Start by using the link provided on the above page to download and install the platform SDK2.

The actual SDK download page is once again a bit confusing since the links for downloading are hidden amongst a bunch of other links. Basically look for these three links with their associated 'Download' buttons and choose the correct link for your platform:

PSDK-amd64.exe  1.2 MB  Download 
PSDK-ia64.exe   1.3 MB  Download 
PSDK-x86.exe    1.2 MB  Download

When you install make sure to choose 'custom install'. These instructions assume you are installing into the default path of:

C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\

We will go for the minimal install that will give us a working environment, so on the custom installation screen I made the following choices:

Configuration Options
  + Register Environmental Variables            (Yes)
Microsoft Windows Core SDK
  + Tools                                       (Yes)
    + Tools (AMD 64 Bit)                        (No unless this applies)
    + Tools (Intel 64 Bit)                      (No unless this applies)
  + Build Environment
    + Build Environment (AMD 64 Bit)            (No unless this applies)
    + Build Environment (Intel 64 Bit)          (No unless this applies)
    + Build Environment (x86 32 Bit)            (Yes)
  + Documentation                               (No)
  + Redistributable Components                  (Yes)
  + Sample Code                                 (No)
  + Source Code                                 (No)
    + AMD 64 Source                             (No)
    + Intel 64 Source                           (No)
Microsoft Web Workshop                          (Yes) (needed for shlwapi.h)
  + Build Environment                           (Yes)
  + Documentation                               (No)
  + Sample Code                                 (No)
  + Tools                                       (No)
Microsoft Internet Information Server (IIS) SDK (No)
Microsoft Data Access Services (MDAC) SDK       (Yes) (needed by GDAL for odbc)
  + Tools
    + Tools (AMD 64 Bit)                        (No)
    + Tools (AMD 64 Bit)                        (No)
    + Tools (x86 32 Bit)                        (Yes)
  + Build Environment
    + Tools (AMD 64 Bit)                        (No)
    + Tools (AMD 64 Bit)                        (No)
    + Tools (x86 32 Bit)                        (Yes)
  + Documentation                               (No)
  + Sample Code                                 (No)
Microsodt Installer SDK                         (No)
Microsoft Table PC SDK                          (No)
Microsoft Windows Management Instrumentation    (No)
Microsoft DirectShow SDK                        (No)
Microsoft Media Services SDK                    (No)
Debuggin Tools for Windows                      (Yes)

/!\ Note that you can always come back later to add extra bits if you like.

/!\ Note that installing the SDK requires validation with the Microsoft Genuine Advantage application. Some people have a philosophical objection to installing this software on their computers. If you are one of them you should probably consider using the MINGW build instructions described elsewhere in this document.

The SDK installs a directory called

C:\Office10

Which you can safely remove.

After the SDK is installed, follow the remaining notes on the page link above to get your MSVC Express environment configured correctly. For your convenience, these are summarised again below, and I have added a couple more paths that I discovered were needed:

1) open Visual Studio Express IDE

2) Tools -> Options -> Projects and Solutions -> VC++ Directories

3) Add:

Executable files: 
  C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Bin

Include files: 
  C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Include
  C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Include\atl
  C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Include\mfc
Library files: C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Lib

4) Close MSVC Express IDE

5) Open the following file with notepad:

C:\Program Files\Microsoft Visual Studio 8\VC\VCProjectDefaults\corewin_express.vsprops

and change the property:

AdditionalDependencies="kernel32.lib"

To read:

AdditionalDependencies="kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib 
                        advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib"

The notes go on to show how to build a mswin32 application which you can try if you like - I'm not going to recover that here.

6.5. Edit your vsvars

Backup your vsvars32.bat file in

C:\Program Files\Microsoft Visual Studio 8\Common7\Tools

and replace it with this one:

@SET VSINSTALLDIR=C:\Program Files\Microsoft Visual Studio 8
@SET VCINSTALLDIR=C:\Program Files\Microsoft Visual Studio 8\VC
@SET FrameworkDir=C:\WINDOWS\Microsoft.NET\Framework
@SET FrameworkVersion=v2.0.50727
@SET FrameworkSDKDir=C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0
@if "%VSINSTALLDIR%"=="" goto error_no_VSINSTALLDIR
@if "%VCINSTALLDIR%"=="" goto error_no_VCINSTALLDIR

@echo Setting environment for using Microsoft Visual Studio 2005 x86 tools.

@rem
@rem Root of Visual Studio IDE installed files.
@rem
@set DevEnvDir=C:\Program Files\Microsoft Visual Studio 8\Common7\IDE

@set PATH=C:\Program Files\Microsoft Visual Studio 8\Common7\IDE;C:\Program Files\Microsoft Visual Studio 8\VC\BIN;C:\Program Files\Microsoft Visual Studio 8\Common7\Tools;C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\bin;C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727;C:\Program Files\Microsoft Visual Studio 8\VC\VCPackages;%PATH%
@rem added by Tim
@set PATH=C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Bin;%PATH%
@set INCLUDE=C:\Program Files\Microsoft Visual Studio 8\VC\INCLUDE;%INCLUDE%
@rem added by Tim
@set INCLUDE=C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Include;%INCLUDE%
@set INCLUDE=C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Include\mfc;%INCLUDE%
@set INCLUDE=%INCLUDE%;C:\dev\cpp\omlibs-release\include\postgresql
@set LIB=C:\Program Files\Microsoft Visual Studio 8\VC\LIB;C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\lib;%LIB%
@rem added by Tim
@set LIB=C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Lib;%LIB%
@set LIB=%LIB%;C:\dev\cpp\omlibs-release\lib
@set LIBPATH=C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727

@goto end

:error_no_VSINSTALLDIR
@echo ERROR: VSINSTALLDIR variable is not set. 
@goto end

:error_no_VCINSTALLDIR
@echo ERROR: VCINSTALLDIR variable is not set. 
@goto end

:end

6.6. Environment Variables

Right click on 'My computer' then select the 'Advanced' tab. Click environment variables and create or augment the following System variables (if they dont already exist):

Variable Name:     Value:
--------------------------------------------------------------------------
EDITOR             vim
INCLUDE            C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Include\.
LIB                C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Lib\.
LIB_DIR            C:\dev\cpp\omlibs-release
PATH               C:\Program Files\CMake 2.6.4\bin;
                   %SystemRoot%\system32;
                   %SystemRoot%;
                   %SystemRoot%\System32\Wbem;
                   C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Bin\.;
                   C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Bin\WinNT\;
                   C:\Program Files\svn\bin;C:\Program Files\Microsoft Visual Studio 8\VC\bin;
                   C:\Program Files\Microsoft Visual Studio 8\Common7\IDE;
                   "c:\Program Files\Microsoft Visual Studio 8\Common7\Tools";
                   "C:\Program Files\PuTTY"
SVN_SSH            "C:\\Program Files\\PuTTY\\plink.exe"
                   (Note the double slashes above are not a mistake!)

6.7. Install CMake

Download and install cmake 2.6.4 or better, making sure to enable the option

Update path for all users

6.8. Install Subversion

You must install the command line version if you want the CMake svn scripts to work. Its a bit tricky to find the correct version on the subversion download site as they have som misleadingly named similar downloads. Easiest is to just get this file:

http://subversion.tigris.org/downloads/1.4.5-win32/apache-2.2/svn-win32-1.4.5.zip

Extract the zip file to

C:\Program Files\svn

And then add

C:\Program Files\svn\bin

To your path.

6.9. Initial SVN Check out

Open a cmd.exe window and do:

cd \
cd dev
cd cpp
svn co https://openmodeller.svn.sourceforge.net/svnroot/openmodeller/trunk/openmodeller

At this point you will probably get a message like this:

C:\dev\cpp>svn co https://openmodeller.svn.sourceforge.net/repos/openmodeller/trunk/openmodeller
Error validating server certificate for 'https://openmodeller.svn.sourceforge.net:443':
 - The certificate is not issued by a trusted authority. Use the
   fingerprint to validate the certificate manually!
Certificate information:
 - Hostname: openmodeller.svn.sourceforge.net
 - Valid: from Sat, 01 Apr 2006 03:30:47 GMT until Fri, 21 Mar 2008 03:30:47 GMT
 - Issuer: Developer Team, openModeller, Anchorage, Alaska, US
 - Fingerprint: 2f:cd:f1:5a:c7:64:da:2b:d1:34:a5:20:c6:15:67:28:33:ea:7a:9b
(R)eject, accept (t)emporarily or accept (p)ermanently?

Press 'p' to accept and the svn checkout will commence.

6.10. Create Makefiles using cmakesetup.exe

I wont be giving a detailed description of the build process, because the process is explained in the first section (where you manually build all dependencies) of the windows build notes in this document. Just skip past the parts where you need to build GDAL etc, since this simplified install process does all the dependency provisioning for you.

cd openmodeller
mkdir build
cd build
cmakesetup ..

Press "Configure" after the cmakesetup gui appears. Cmakesetup should find all dependencies for you automatically (it uses the LIB_DIR environment to find them all in c:\dev\cpp\omlibs-release). If you get an error saying that g77 (Fortran compiler) was not found, turn off the option "WITH_FORTRAN" in the end of the settings list. This will disable the L-BFGS training method in the Maximum Entropy algorithm, which requires a Fortran compiler. You should also find the CMAKE_INSTALL_PREFIX option in the beginning of the settings list to make sure that it contains the openModeller version (X.X.X) as part of the last directory name. If not, then manually append the version so that it becomes:

c:\Program Files\openModellerX.X.X

This is necessary for compatibility with the NSIS packaging script.

Press "Configure" again and when all the red fields are gone, and you have made any additional personalisations to the setup, press "OK" to close the cmake gui.

Now open Visual Studio Express and do:

File -> Open -> Project / Solution

Now open the cmake generated openModeller solution which should be in :

c:\dev\cpp\openmodeller\build\openmodeller.sln

Currently I have only made release built dependencies for openModeller (debug versions will follow in future), so you need to be sure to select 'Release' from the solution configurations toolbar.

Next, right click on ALL_BUILD in the solution browser, and then choose build.

Sometimes (depending on your version of the MS SDK platform) you may face the following error when compiling the openmodeller project:

Linking...
LINK : fatal error LNK1104: cannot open file 'atlthunk.lib'

In this case, you can comment (add a "//" in the beginning of) line 293 in the file C:\Program files\Microsoft Platform SDK for Windows Server 2003 R2\Include\atl\atlbase.h

The line will look like this:

//#pragma comment(lib, "atlthunk.lib")

After that, try rebuilding the whole project.

Once the build completes with no errors, right click on INSTALL in the solution browser and choose build. This will by default install openmodeller into c:\Program Files\openModellerX.X.X which will be used to create the installation package.

6.11. Packaging

To run openModeller you need to at the minimum copy the DLLs from c:\dev\cpp\omlibs-release\bin into the c:\program files\openmodellerX.X.X directory. If you are unsure about which DLL and configuration files should be copied, then download the last installation package for Windows, install it and then inspect the installation directory to check which files are needed. In other words: the option INSTALL in the solution browser does not copy all files needed to create the package. The best approach is probably to install the latest version of openModeller, make a parallel copy of the entire installation directory, rename the new directory so that it uses the same version number that you are using, and run the INSTALL option again to overwrite all files that were changed since the last release. Then it should be OK to use NSIS.

Download and install NSIS from (http://nsis.sourceforge.net/Main_Page)

Now using windows explorer, enter the install_win directory in your openModeller source tree. Read the README file there and follow the instructions. Next, right click on openmodeller.nsi and choose the option 'Compile NSIS Script'.

6.12. Testing

After creating the package, press "Test installer" to install a copy on your machine. Create a new environment variable called OM_ALG_PATH pointing to the "algs" subdirectory of the installation directory:

c:\Program Files\openModeller X.X.X\algs

Edit the environment variable "Path" to add the openModeller installation directory.

Then open the cmd window, go to the "examples" subdirectory inside the installation directory and type:

om_console request.txt

6.13. Debugging

To Debug on Windows:

1. Set om_console as startup project: right click on "om_console" project, then click on "Set as StartUp Project"

2. Set the working directory and command argument: right click on "om_console" project, click on "Properties -> Configure Properties \ Debugging". Now set "Working Directory" as C:\dev\cpp\openmodeller\examples and set "Command Arguments" as request_w.txt

7. Authors and Acknowledgments

Tim Sutton 2007. Parts of this document were adapted from QGIS build notes I and others wrote I acknowledge the follow people who contributed to that original document: