To build, the simplest way is to use the build.sh wrapper script provided. Unpack the tarkit, change to the directory created and type
If the script complains about missing tools are libraries, the Qt installation needs to be specified. There are basically two ways: either a Qt package was configured or installed using the environment provided by TrollTech, or the system provides a Qt4 installtion itself.
In the first case, the actual Qt installation path can be specified with the -qt option: i.e.
./build.sh -qt ~/qt
will locate the Qt include files in ~/qt/include, the Qt library in ~/qt/lib. The installation path is the prefix that was specified on Qt's configure command line.
On LSB (Linux Standard Base) systems, the Qt4 library can be optionally installed. It is common to have different installation directories for include and library files. On Ubuntu 6.10 with Qt4 for example, the libraries are located in "/usr/lib", the development tools like "uic" are installed in "/usr/bin" and the include files reside in "/usr/include/qt4". In this case, use:
./build.sh -qtbin /usr/bin -qtlib /usr/lib -qtinc /usr/include/qt4
Since the above settings are the default, this is equivalent to specifying nothing as shown above.
The build script does not determine the platform to build upon. By default, 32 bit Linux and "gcc" is configured as the build platform. To build for an other platform, use
./build.sh -platform <platform>
The platforms and build variants available are listed with
The build script will create the final executable in
To integrate other build variants, a new file can be created in the "config" subdirectory. This is a partial Makefile that defined the variables specific for a certain build.
If the build script finds a Ruby interpreter in the path and the Ruby development packages are installed (i.e. "ruby1.9.1-dev"), Ruby script automation capabilities (RBA) are enabled. It should no longer be necessary to specify the location of the libraries and headers. Ruby 1.9.1 or later is recommended for that feature.
If the build script finds a Python interpreter in the path and the Python development packages are installed (i.e. "python-dev"), Python script automation capabilities (pya) are enabled. It should no longer be necessary to specify the location of the libraries and headers. Python 2.7 or later is required for that feature.
For more details about RBA, see Programming scripts.
Qt bindings are not enabled by default. The Qt bindings allow you to create Qt user interfaces using Ruby scripts. To enable Qt bindings, you'll need Qt 4.6.2 at least and have to use the following build script switch:
Enabling Qt bindings will significantly increase the build times and size of the final executable. For more details about the Qt binding, see The Qt Binding.
For building the executable on MacOS 10.5.7, the "mac-leopard-gcc-release" platform is provided. The build is based on the Xcode installation. This build script call was used successfully with Qt 4.5.2 from the Xcode package:
./build.sh -platform mac-leopard-gcc-release \ -qtbin /Developer/Tools/Qt \ -qtlib /usr/lib \ -rblib /usr/lib/libruby.dylib \ -rbinc /usr/lib/ruby/1.8/universal-darwin9.0
On MacOS 10.6 this build script call was used successfully (Qt library is qt-mac-cocoa-opensource-4.6.2.dmg):
./build.sh -platform mac-leopard-gcc-release \ -qtbin /Developer/Tools/Qt \ -qtlib /usr/lib \ -rblib /usr/lib/libruby.dylib \ -rbinc /usr/lib/ruby/1.8/universal-darwin10.0
Apparently, both 32 and 64 bit versions of Qt must be installed.
Note: to enable Qt binding for RBA, add the "-with-qtbinding" switch:
./build.sh -with-qtbinding ...
For compiling the Qt bindings, at least Qt 4.6.2 is required. Enabling Qt bindings will significantly increase the build times and size of the final executable. For more details about the Qt binding, see The Qt Binding.
Please note: severe issues have been observed with MinGW's gcc 4.4.0 distribution. Specifically, broken support for exceptions in threads may make the application crash. Possibly a new distribution may solve that issue. Until then, although basically functional, the use of the MinGW build is discouraged.
Starting with version 0.21, a build setup is provided for MinGW with the gcc. A good starting point for the MinGW build is the Qt SDK which comes with a Qt reaily built for MinGW and the gcc compiler suite.
To enable Ruby support, the Ruby interpreter, preferably version 1.9 is required. A strange fact with building Ruby 1.9 is that one needs a Ruby interpreter to build it. One possible solution is first to build a 1.8 version, put the executable into the path and then run the Ruby build from the MinGW console.
To build KLayout on MinGW, simply open the MinGW shell (MSYS), unpack the KLayout source package and cd to the destination folder. Then use build.sh as on Linux. For example, if the Qt SDK was installed in "c:\Qt\2010.04", the build script call is
build.sh -qt /c/Qt/2010.04/qt
For ruby support use the -rblib and -rbinc options accordingly to specify the ruby installation path.
Starting with version 0.21, a Visual Studio solution is included in the source branch of KLayout's source tarkit ("klayout.sln"). The solution is provided for Visual Studio 2010.
Version 0.24 is based on:
A Visual Studio solution is provided (klayout.sln). The release mode configuration is "Release (STLPort)" which is the one used for creating the prebuild packages.
The build requires the following environment variables to be set:
For further details see the next section.
To build KLayout with Visual Studio, the following requirements must be fulfilled:
Before building KLayout, it is required to set the following environment variables:
After this preparation, KLayout can be build from Visual Studio using the "Win32" platform for 32 bit and "x64" platform for 64 bit. The recommended configurations are: