top bar

Building MM on Windows

Revision as of 16:05, 11 May 2013 by Mark Tsuchida (Talk | contribs)

Preparation

First make sure you have enough hard disk space. 5 GB is probably enough.

Directory structure for the source code

Create a directory named projects. The projects directory may reside anywhere you like and will contain the subdirectories micro-manager1.4, 3rdpartypublic, and 3rdparty.

Downloading the source code

Obtain a Subversion client. From projects/, run:

svn co https://valelab.ucsf.edu/svn/micromanager2/trunk/ micro-manager1.4
svn co https://valelab.ucsf.edu/svn/3rdpartypublic/

Required tools and applications

To build the entire application from the source code, you will need to install the following tools:

To build device adapters:

  1. Microsoft Developer Studio 2008 or Visual Studio 2010 (Express is fine, and doesn't cost anything.)
  2. the newest Microsoft Windows Desktop SDK, if you are using Visual Studio 2010 Express

Additionally, to build the entire Micro-Manager package:

  1. JDK Standard Edition 6 or later
  2. A recent version of ImageJ
  3. Beanshell 2.0.4 or later. Download the .jar and and place in <root>/projects/3rdparty/Beanshell and copy to the plugins folder of the ImageJ instance you installed above.
  4. Apache Ant

Tell the build tools where to find Java and Ant by opening the System control panel / Advanced system settings / Environment Variables / System variables and addding the following new entries:

ANT_HOME=C:\ant (or path to Ant)
JAVA_HOME=C:\Program Files\Java\jdk1.6.0_20 (or path to Java)
PATH=%PATH%;%ANT_HOME%\bin

Device libraries and SDKs

Some device adapter require the installation of manufacturer's SDKs in order to build. All SDKs should be installed in the <root>/projects/3rdparty directory. The actual names of SDK directories should match the paths in the corresponding header files in the Micro-manager source code for device adapters.

If you don't want to build one or more device adapters (because you don't have the SDK), you should remove corresponding projects from the master solution: MMCoreJ_wrap.sln.

To add a device adapter to the automated build, use Visual Studio 2008 to add the device adapter project (a .vcproj file) to the MMCoreJ_wrap.sln or MMCoreJ_wrap_x64.sln. Under the device adapter's project properties, make sure the device adapter has this command under Build Events > Post-build Event:

copy "$(TargetPath)" ..\..\bin_$(PlatformName)

and a Linker > General > Output File of

$(OutDir)/mmgr_dal_YourDeviceName.dll

Setting up library paths

The project files in the repository should have the correct path settings.

To deal with the flood of text in the Output window, in the Solution Explorer right-click and build one project at a time.

If in Visual Studio you get an error:

       Target(FOO) does not match the Linker's OutputFile property value (BAR) ...

You could right-click on the project > properties > Configuration Properties > General > Target Name and add the leading "mmgr_dal_" to the beginning of $(ProjectName) to satisfy it.

Setting up 64-bit support on Visual C++ Express

Visual Studio Express does not include 64-bit compiler support out of the box. To compile x64 libraries in addition to Win32, you need to install the Windows SDK: http://msdn.microsoft.com/en-us/windows/bb980924

After installation you should find the x64 specific libraries at a path similar to:

       C:\Program Files\Microsoft SDKs\Windows\v7.1\Lib\x64

To build your x64 project you would need to make sure this is in the 'Additional Library Directories' setting in your project, specifically in Project > Properties > Configuration Properties > Linker > Additional Library Directories. If you do not do this you will get linker errors similar to:

       LINK: fatal error LNK1181: cannot open input file FOO.lib

Building the C++ layer: MMCore and device adapters

You can build C++ part of the project by opening MMCoreJ_wrap.sln in MSDEV and running the full build. This will build the MMCore, Java wrappers and all device adapters. You can remove any device adapter project from the solution if you don't have the corresponding SDK or if you don't need to build it.

Building the Java layer: Micro-Manager Studio

Java layer of the Micro-Manager can be build using the standard ANT utility with build.xml project file, located in the <root>/projects/micro-manager-1.4/mmstudio directory. Before running the build the project file build.xml must be modified to specify paths for external libraries: ImageJ and BeanShell.

<!-- EDIT PATHS BELOW TO MATCH YOUR SYSTEM -->

<!-- Specify the system path to the ImageJ root directory -->
<property name="ImageJPath" value="C:/Program Files/ImageJ"/>

<!-- Specify the system path to the beanshell jar -->
<property name="beanshell" value="C:/projects/3rdparty/BeanShell/bsh-2.0b4.jar"/>

<!-- DO NOT MODIFY FROM THIS POINT ON -->

In the mmstudio directory from the commandline, run:

     ant -buildfile build.xml cleanMMStudio compileMMStudio buildMMStudio

Building the full source in one step

To build the entire Micro-Manager project for Windows with a single command, µManager 1.4 provides a batch file in the source repository in buildscripts. You need to have the installed tools and libraries described above: ant, Java JDK, boost, zlib and some java jar stuff.

From the C++ source, you can build the 32 bit version with the free 'Express' version of Visual Studio, though per my understanding, you need at least the 'Professional' version to build the 64 bit binaries. As of this writing, we are using the 2008 version of Visual studio. It's been built and tested preliminarily with Visual Studio 2010 also.

To build the 32 bit binary, open a command prompt and type

 cd \projects\micromanager
 buildscripts\Build 

The 64 bit binary is built as follows:

 buildscripts\Buildx64

If you've got all the tools and libraries installed correctly, these scripts will build everything and automatically install µManager onto your system. By default, the builds are incremental, if you want to clean the binaries (don't know why this is ever necessary, except perhaps in the case of virus infections) specify FULL, e.g.

 buildscripts\Buildx64 FULL

The final step of the build makes the installer using InnoSetup, the current builds scripts assume it's installed in:

 \projects\3rdparty\Inno_Setup_5\iscc.exe
© Micro-Manager : Vale Lab, UCSF 2006-2011 | All Rights Reserved | Contact