From SCIRun Documentation Wiki
Jump to navigation Jump to search

Creating A Windows Binary


1) Visual Studio or Visual Studio Express (free version) 2008 (version 9.x).

Important: if you install the Visual Studio Express edition and later want to install the full edition, we strongly recommend that you unistall the Express edition completely before installing Visual Studio. If Visual Studio is installed on top of the Express edition, it becomes very difficult to remove the Express edition from your system, and the Express version is chosen automatically by the OS and CMake. The fix is a manual uninstall of the Express binary files & directories and a reinstall of Visual Studio.

We are no longer supporting Visual Studio 2005 builds.

2) CMake for Windows (

3) Subversion (Tortoise svn

4) ITK Insight Toolkit (

5) wxWidgets 2.8.x for Windows

The Seg3D executable installer can be built using an Inno setup script automatically generated by the CMake build.

Building SCIRun

1) Create a new folder something like C:\SCIRun.

2) Download the source code from the Subversion repository by pressing the left mouse button when within the SCIRun directory. A list of options appears and select svn checkout, which causes a GUI to appear. in this GUI insert the location of the svn repository, for example, and click on the OK button. The SCIRun code will begin downloading from the repository to your local machine.

3) Start CMake and in the source code window, insert the location of the SCIRun source files, for example, C:\SCIRun\src. In the build binaries window add the location of where you want to build SCIRun, for example, C:\SCIRun\bin and then press the configure button.

4) At some point during the configuration process CMake will ask for the build environment shown in a list. Select what version of the build environment you want from the drop down list and press the configure button. At this point it is a good idea to set the build type to either Debug or Release.

5) To build Seg3D, make sure that the BUILD_SEG3D and WITH_WXWIDGETS advanced options are selected. If you see an error about missing the Insight package, add ",Insight" (without the quotes) to the LOAD_PACKAGE variable. Set the wxWidgets_LIB_DIR to point to x/lib/vc_dll to use the DLL version of wxwidgets. Press the configure button again until all errors have disappeared and the Generate button is activated.

6) Once the configuration process has completed successfully press the ok or Generate button, which generates the file SCIRUN_CORE.sln in the directory C:\SCIRun\bin.

7) Open SCIRUN_CORE.sln and go to the menu, choose the build solution and start the build process.

Environment Settings


1) Add the following directories to your path:

1.1) Path/to/directory/of/seg3d/libraries. For example, C:\Seg3D_Trunk\bin\lib\debug.

1.2) Path/to/directory/of/seg3d.exe. For example, C:\Seg3D_Trunk\bin\Debug;

1.3) Path/to/directory/of/wxWidgets/dll's. For example, C:\wxWidgets-2.8.8\lib\vc_dll.

Common Pit Falls

1) Ensure that each project uses the same build configuration (i.e. Release or Debug).

2) wxWidgets: when building wxwidgets on a windows platform make sure the the configuration files setup.h have the following variable set #define wxUSE_GLCANVAS 1 Otherwise the OpenGL canvas cannot be created.

3) Building wxWidgets: First go to the x/build/msw directory and open the wx.sln solution file and build the static Release and static Debug library configuration. DO NOT BUILD THE DLL'S from wx.sln.

4) Next open the wx_dll.sln solution file and build the Release and Debug dll's. At this point, certain build errors occur regarding missing library files. For the RELEASE copy the file wxbase28_odbc.lib from the x/lib/vc to the x/lib/vc_dll directory and build the solution again. DEBUG copy the file wxbase28d_odbc.lib from the x/lib/vc to the x/lib/vc_dll directory and build the solution again. DO NOT REBUILD or COPY ANY OF THE OTHER LIB FILES FROM the lib/vc to lib/vc_dll.

5) Make sure that the wxWidgets_LIB_DIR CMake variable is set to point to the lib/vc_dll area, not the lib/vc_lib directory.

6) When building the debug version set the working directory in visual studio to the location of seg3d.exe. To accomplish this open the visual studio solution file and using the mouse right click on the Seg3D project and select properties, then select the Configuration Properties tab in the side panel, select Debugging and set the Working Directory to the location of Seg3d.exe. For example, C:\SCIRun\bin_debug\Debug.

7) Make sure that the data directory has been copied to the location of seg3d.exe, which is usually done by a post build event. However, sometimes this step fails and the directory needs to be copied by hand. Also if you are doing any development on the Seg3D GUI it is important to copy these changes into the data directory where the executable is located, which typically involves performing a manual file/directory copy.

8) GUI development can produce inconsistencies if the modified files are not exported and copied to the correct location. It is very important to export the Seg3D.xrc file to the data directory within the source directory structure x/Applications/Seg3D/data. This data directory is copied during the build process to where the executable is located. However, this doesn't always occur and manual copying is typically required and differences between the 2 files causes errors when Seg3D executes.

NOTE: The problem of maintaining consistency of the GUI files can cause significant problems when more than one person is editing the GUI.

8) When building ITK ensure that it is correctly configured via CMake. One issue that is known to cause the release version of Seg3D to crash on a Windows platform with a segmentation fault. Is when ITK is built as a debug and installed into the release version of thirdparty. To avoid this problem remove any reference to Debug in the CMake txt file and replace with Release. This bug is tricky to track down, but is relatively easy to fix. One way of quickly determining if you have accidentally built and installed the Debug version of ITK is to go to the ITK build directory and see if it contains a directory name "Debug". To fix this, reconfigure ITK using CMake and rebuild and install the executables and dll's.

9) As Seg3D relies heavily on external thirdparty software, which is not located within the code repository and not part of the build system for Windows (for Linux and Mac OS X platforms the external software components are included in the file). The result of this means that any change to any of the external software components must be managed by the user and the entire system must be rebuilt. Currently, this hasn't caused any problems, but could pose a problem in the future if new functions are incorporated into Seg3D that are only available in certain versions of the external software. So it is important to maintain the same versions of the external software components on all platforms supported.