KWWidgets can be compiled on a large number of platforms, including Windows, Mac, and many flavors of Unix/Linux systems. Here is how. KWWidgets depends on a few tools and libraries, let's review those requirements first. Fear not, the whole process should be pretty straightforward. Feel free to check the KWWidgets dashboard too, it reports how successfully KWWidgets compiled and tested on many different platforms and compilers every day.
CMake is a cross-platform, open-source make system. KWWidgets, as well as many other projects like VTK and ITK use CMake to control the software compilation process using simple platform and compiler independent configuration files.
If you are already using CMake >= 2.0, you are ready to go. Otherwise, you can download and install CMake from the "CMake download" page.
Tcl is a very powerful but easy to learn open source dynamic programming language, suitable for a very wide range of uses. Tk is a graphical user interface toolkit for Tcl, but also for many other dynamic languages. It can produce rich, native applications that run unchanged across Windows, Mac OS X, Linux and more. The Tcl/Tk libraries are used transparently by KWWidgets to provide a basis for its core widgets.
If you are already using Tcl/Tk >= 8.4, you are ready to go. Otherwise, you can download and install precompiled versions as well as source distributions of the Tcl/Tk libraries from the Tcl/Tk Software page. While ActiveState does offer binary distributions of Tcl/Tk (see ActiveTcl), note that they do not include any static libraries. You can also download Kitware's shared and static precompiled version of Tcl/Tk (and IncrTcl/Tk, an OO extension to Tcl/Tk) from our internal server; please note that you need to pick the one that applies to both your architecture (32bits by default, or 64bits when explicitly mentioned) and your compiler (msdev6 = Visual Studio 6, msdev7 = Visual Studio .NET 2003, msdev8 = Visual Studio 2005, and msdev9 = Visual Studio 2008).
If you are a Mac OS X user, we strongly recommend you download your own Tcl/Tk distribution and compile it to run in X11 mode (check "Configuring and Running X11 Applications on Mac OS X" for more information about X11). The default Tcl/Tk was built to run in Aqua/Carbon mode, and is not behaving properly.
The Visualization ToolKit (VTK) is an open source, freely available software system for 3D computer graphics, image processing, and visualization used by thousands of researchers and developers around the world. VTK consists of a C++ class library, and several interpreted interface layers including Tcl/Tk, Java, and Python. KWWidgets shares many features with VTK and rely on a few of its core classes and components to build its own framework. KWWidgets also provides sophisticated user interfaces to VTK, offering high-level 2D and 3D visualization-oriented widgets such as surface material editors, simple animation generators, transfer function editors, annotation editors, preset editors, 2D and 3D rendering widgets, etc.
You can download the VTK source distribution from the "VTK download" page. The binary distribution does *not* include development headers and libraries, but building VTK from source is definitely straightforward. We recommend using the VTK 5.2 or 5.4 CVS release (tagged VTK-5-2 or VTK-5-4 respectively) or the latest CVS version, both from the CVS tree. From the command-line, here is how (replace VTK-5-4 with HEAD to get the latest CVS development tree):
cvs -d :pserver:email@example.com:/cvsroot/VTK login (respond with password vtk) cvs -d :pserver:firstname.lastname@example.org:/cvsroot/VTK checkout -r VTK-5-4 VTK
Build VTK by following the corresponding compilation instructions. During the configuration step involving CMake, make sure that VTK_WRAP_TCL=ON and VTK_USE_TK=ON. Also make sure that the TCL_LIBRARY and TK_LIBRARY settings point to your Tcl/Tk libraries (say, for example TCL_LIBRARY=C:/Tcl/lib/tcl84.lib, TK_LIBRARY=C:/Tcl/lib/tk84.lib).
If you are a Mac OS X user, we strongly recommend you compile VTK to run in X11 mode by setting VTK_USE_X=ON and VTK_USE_CARBON=OFF. Also make sure you use a Tcl/Tk distribution that was built against X11 as well (check "Configuring and Running X11 Applications on Mac OS X" for more information about X11).
Check that VTK built successfully by looking for the vtk executable in your build directory (say, for example, C:/VTK-build/bin/Debug/vtk.exe).
If you haven't downloaded KWWidgets, head for the "download KWWidgets" page.
It is important that you use the same CMake version, Tcl/Tk version and compiler version for both VTK and KWWidgets. This is especially true if you are using a pre-compiled version of VTK or a larger project that would provide its own VTK, Tcl/Tk and CMake packages (like Slicer for example).
Build KWWidgets by running cmake or CMakeSetup.exe on the KWWidgets source tree, then set the VTK_DIR variable to the path to your VTK build directory (say, for example, C:/VTK-build) or your VTK installation directory (say, for example, C:/VTK5.2/lib/vtk-5.2). KWWidgets will import the build settings that were used for VTK automatically. Please make sure that the TCL_LIBRARY and TK_LIBRARY settings are exactly the same as the one you set when building VTK; if they are set, make sure that TCL_TCLSH, TK_WISH, and PYTHON_EXECUTABLE are consistent as well. If you are using a pre-compiled distribution, i.e. an installed VTK, those variables will likely to show up as NOTFOUND and you may have to set them to point to your Tcl/Tk libraries (say, for example TCL_LIBRARY=C:/Tcl/lib/tcl84.lib, TK_LIBRARY=C:/Tcl/lib/tk84.lib).
Check that KWWidgets built successfully by looking for some of the examples binaries in your build directory (say, for example, C:/KWWidgets-build/bin/Debug/KWWidgetsTour.exe). Try to run them! On Windows platforms, you may have to help the operating system find the Tcl/Tk, VTK and KWWidgets libraries the examples depends on. This is covered in the FAQ.
|Note: Thanks for reporting any problem or compilation issues by contacting us directly or by editing the discussion page.|
The following packages are not required to build KWWidgets, but if they are found on your system KWWidgets will provide the corresponding additional features. If you are not familiar with those packages, you can safely ignore them for the moment and enable them later on in KWWidgets.
Python is an interpreted, interactive, object-oriented programming language. It has modules, classes, exceptions, very high level dynamic data types, and dynamic typing. There are interfaces to many system calls and libraries, as well as to various windowing systems. It runs on many brands of UNIX, on Windows, OS/2, Mac, Amiga, and many other platforms. The Python libraries can be used by VTK and KWWidgets to provide Python bindings to the C++ API.
If you are already using Python >= 2.0, you are ready to go. Otherwise, you can download and install precompiled versions as well as source distributions of the Python libraries from the "Download Python Software" page.
In order to enable Python support in KWWidgets, you need only to make sure that Python support is enabled in your VTK distribution. Configure your VTK build tree using CMake and make sure that VTK_WRAP_PYTHON=ON. Also make sure that the PYTHON_LIBRARY, PYTHON_INCLUDE_PATH and PYTHON_EXECUTABLE settings point to your Python libraries, include path and executable respectively (say, for example PYTHON_LIBRARY=C:/Python/libs/python24.lib, PYTHON_INCLUDE_PATH=C:/Python/include, PYTHON_EXECUTABLE=C:/Python/python.exe). Build VTK. Configure KWWidgets using CMake so that the Python settings are imported from VTK: make sure that the PYTHON_LIBRARY, PYTHON_INCLUDE_PATH and PYTHON_EXECUTABLE settings are exactly the same as the one you set when building VTK. Build KWWidgets. Try running some of the Python examples located in the Examples/Python directory. If you experience some difficulties, check the Configuration FAQ.