Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migration of unmigrated content due to installation of a new plugin

...

The document describes how to generate OpenMI dlls and executables on a Linux machine. This is done by using Mono, a .NET Open Source software for different platforms. Most of the OpenMI functionality has been ported:

  • the definitions of the OpenMI Standard,
  • the source development kit SDK,
  • running OpenMI from command line or in the ConfigurationEditor (GUI),
  • some LinkableComponents of the examples.

2. Technical prerequisites

2.1. Machine and OS of the test system

  • workstation with an Intel Xeon processor
  • 64bit openSUSE 11.0

2.2. Mono

  • Mono v. 1.9.1. for openSUSE 11.0 in 64 bit mode. V. 1.9.1. is also referred to as Mono 2.0.
  • The standard and the sdk sources should be compilable with previous versions. But the GUIs require Windows.Forms, which has been shipped with v. 1.9.1. in Oct. 2008.
  • Mono includes NUnit version 2.2.0 for UnitTests

3. The Mono compiler gmcs

...

{color:green}{*}

gmcs

{*}{color} \

-target:library

\

-out:<target>.dll

{color:red}\

-r<linkedLib_1>.dll,<linkedLib_k>.dll

{color} {color:blue}\

-pkg:<package_1>.pc,<package_m>.pc

{color}

<source_1>.cs

<source_n>.cs

{color:red}\

-r:<linkedLib_?>.dll

{color}

:

reference

to

linked

shared

libraries

(path

and

name)

{color:blue}\

-pkg:<package_?>.pc

{color}

:

ASCII

files

(path

and

name),

that

refer

to

linked

shared

libraries

<linkedlib_?>.dll.

They

contain

the

path

and

the

version

of

the

dll.


Example

for

the

Windows.Forms:

prefix=/usr/lib/mono/2.0


exec_prefix=${prefix}


libdir=${exec_prefix}

Name:

WindowsForms


Description:

Windows

Forms


Version:

2.0


Libs:

\

-r:${libdir}/System.Windows.Forms.dll

Panel
bgColor#F7D6C1
borderStyledashed
Wiki Markup

Command for generating an exe file:

Panel
bgColor#F7D6C1
borderStyledashed

gmcs -out:<target>.exe -r<linkedLib_1>.dll,<linkedLib_k>.dll -pkg:<package_1>.pc,<package_m>.pc <source_1>.cs <source_n>.cs

...

Panel
bgColor#F7D6C1
borderStyledashed

Example for ElementSetViewer
namespace:                Oatc.OpenMI.Gui.Controls
Linux source name:    Oatc.OpenMI.Gui.Controls.ElementSetViewer.cs
Linux resource name: Oatc.OpenMI.Gui.Controls.ElementSetViewer.resources

...

After the first step you should have a copy of the OpenMI sources on your machine with the directory structure displayed in Fig. 1. OpenMI-Version-1-Trunk is in this examples the name for the starting directory $OPENMI_DIR. There are two new subdirectories:

  • ./Oatc/src/csharp/bin: linux dlls / exe files
  • ./Oatc/src/csharp/Linux: shell scripts for building dlls / exe files and running UnitTests; *.pc files

Use Subversion (svn) for download of the C# sources:

...

4.2.1. ... with shell scripts

  • Go to $OPENMI_DIR/Oatc/src/csharp/Linux/
  • Edit the package files *.pc:
  • drawing.pc: replace the path for System.Drawing.dll
  • nunit-framework.pc: replace the path for nunit.framework.dll
  • windows-forms.pc: replace the path for System.Windows.Forms.dll
  • Run build.Standard.sh
  • Run build.Sdk.sh and the Sdk including UnitTest will be built.
  • Run build.Gui.sh and the Gui including UnitTest will be built.
  • Run build.Examples.ModelComponents.SpatialModels.sh will generate test models.

The dlls and exe files will be copied to $OPENMI_DIR/Oatc/src/csharp/bin/.

...

  • mono Oatc.OpenMI.Gui.ConfigurationEditor.exe
  • mono Oatc.OpenMI.Gui.CommandLine.exe

4.5. UnitTests

  • Go to $OPENMI_DIR/Oatc/src/csharp/Linux/
  • runNunit.Sdk.sh for all Sdk dlls
  • runNunit.Gui.sh for Oatc.OpenMI.Gui.Core.dll
  • runNunit.Examples.ModelComponents.SpatialModels.sh e.g. for a RiverModel and a GroundWaterModel

You have done it.(smile)

5. Miscellaneous

...

Yes, you can generate a set of dlls and exe files for Linux and a set for Windows with the same sources. The method Gui/Core/Utils.IsRunningOnMono decides during runtime, whether it runs on Mono or not. The build.*.sh scripts are tailored for Linux, for Windows you can use the Visual Studio projects.

5.3. Todo list

  • portation of OpenMI Tools
  • portation of SimpleRiver example
  • ConfigurationEditor: Help page
  • ConfigurationEditor ConnectionProperties dialogue: Buttons "Use Element Type Filter" and "Use Dimension Filter" do not work -> there is no filtering in the current version
  • ConfigurationEditor: RegisterFileExtensions can not work on Linux.
  • test on further platforms supported by Mono
  • merging OpenMI-Version-1-Trunk (Linux) and OpenMI-Version-1-4-Trunk
  • download of compiled dlls and exe files