Obtaining a working development tree from scratch
The Apsim source is stored in a version control system called
subversion . You can find a quick tutorial on its use
here .
The current APSIM repository URL is
http://apsrunet.apsim.info/svn/apsim/trunk, pre 7.0 versions of apsim use
http://apsrunet.apsim.info/svn/development/trunk.
You will need to install the
CollabNet Subversion Command-Line Client v1.6.17 (for Windows). The APSIM development team also recommend
TortoiseSVN. Once installed, create a directory on your hard disk to contain the development tree (e.g. c:\Apsim), right click on it and select SVN Checkout. Enter http://apsrunet.apsim.info/svn/apsim/trunk as the URL of repository and click OK.
Updating a development tree to the latest revision
To update a development tree to the most recent revision, right click on it and select
SVN Update. This will bring down all changes made by the APSIM development team to your development tree. Where you've made changes, SVN will try and merge your changes into what it brings down from the repository. If you don't want to keep your changes, then right click on the development tree and select
Tortoise SVN|Revert following an update.
Once you have done an update and optionally a revert, you need to either build the entire tree, or download the appropriate binaries from the APSIM Build System.
Obtaining binaries from the APSIM Build System
Determine the
Revision Number of your development tree by right clicking on it and selection
TortoiseSVN|Show log. The entry in bold (at the top if you've just done a checkout) will tell you your revision number.
Once you know your revision number, you can obtain all binaries for your development tree by going to the
APSIM Build System and clicking the binaries link for your revision. This will download a binaries zip file which you can unzip to your Model (e.g. c:\Apsim\Model) directory.
Obtaining third party tools and support libraries¶
You will need to install a range of
open source build libraries (117Mb) (boost, libxml2, and iconv precompiled win32 binaries). Unzip this file
alongside the apsim source tree, not underneath (e.g. c:\BuildLibraries).
Microsoft Visual Studio 2010 is required for the infrastructure, .NET and C++ modules.
Lahey Fortran 95 version 5.6 is required to build the fortran modules.
To build the GUI, you will need:
You'll also need a good text editor. The APSIM development team recommend
NotePad++. You can then configure the text editor to compile the module by following the instructions
here.
If you want to build everything
After you've installed compilers and support libraries, a set of batch files (or shell scripts on unix systems) build part or all of apsim. They are in
Apsim/Model/Build.
-
CleanAll.bat deletes all binary files in the source tree.
-
BuildAll.bat cleans and builds everything from scratch. The compiler output from each module is in Model/Build/BuildAllOutput.xml
-
RunAll.bat runs every simulation in the example and test directories. This can take some time.
These scripts can be run by double clicking them in Windows Explorer, or running them within the Visual Studio Command Prompt DOS window.
The build and run system operates in parallel - an xml description of individual tasks describes their order. It will use all available processors, and your system may become unresponsive for a few minutes.
Individual apsim modules (eg SoilWat.dll) can be built with the script Model/Build/RunMake2.bat. A description of its use with a text editor is here. The output of the compilation appears on stdout.
By default, apsim is built in "Release Mode" with no debugging information. The switch to build a debuggable version is in Model/Build/Win32VSCPP.make.
If you want to compile a FORTRAN module on Windows
To compile an APSIM FORTRAN module, you'll need to have LF95 installed. Open the module's source file in your text editor, and use
Model/Build/RunMake2.bat to build the module (details
here).
If you want to compile a C++ or .NET module on Windows
Building C++ or .NET modules requires Microsoft Visual Studio 2010. You can use a
text editor to edit and compile the source file, or open the projects solution file in the VS2010 IDE.
If you want to compile the APSIM user interface
The APSIM user interface uses many third party components that will need to be purchased. If you're interested in doing this then post a message to the
APSIM Forum.
Compiling under LINUX
The linux build process is identical to the windows build; though the build scripts have
.sh extensions.
Non-GUI .NET components build under
mono 2.10 or later. Currently, there are no pre-built packages for Ubuntu installs, so the package must be
built from source, the mono interpreter added to
binfmt_misc, and the mono shared library path added to
ld.so.conf.d.
You will need the following packages installed:
gcc
gfortran
libboost1.40-all-dev
libxml2-dev
tcl8.5-dev
tcllib
Currently, no GUI components can be built under linux.
Running under LINUX
Apsim is a mix of native and .NET applications, each runtime has a few peculiarities that must be addressed.
The native applications are linked against several shared libraries (eg
libApsimShared.so) which are not installed in a standard shared library path, forcing the use of the LD_LIBRARY_PATH environment variable. If you are working in a login session (eg a console on your desktop) you can add this to your
.profile (not
/etc/environment - see
Launchpad bug#366728). Alternatively, follow the logic in
Model/ApsimRun.sh to convert .apsim/.con files and run apsim.
.NET applications require a working mono installation using binfmt_misc as described in the previous section.