This setcion describes the procedure to follow when building Molekel on Linux (gcc), Windows (MinGW) and Mac OS X (gcc).
Molekel is built with CMake and Make and some libraries need to be installed before you can build the executable.
Some shell scripts found in the build and install directories are available to automate the build process, these are useful to build redistributable archives but can also be used to e.g. check out the required components from the source code repository and invoke CMake with the proper configuration parameters.
If you need to build Molekel on Windows you might want to check out the mingw scripts since they will take care of checking out the code, downloading all the dependencies except Qt and build everything, provided you have the following tools/toolkits already installed:
It is recommended that you get the libraries from the following sites:
We do have pre-built and source distributions of the above libraries on our ftp site at this address: ftp://ftp.cscs.ch/out/molekel/molekel_5.3/dep.
Building the above lbraries (when needed) on Mac OS, and Linux is straightforward, it takes some time but you should not encounter any issues; building everything except OpenBabel with MinGW is fairly easy too.
ON
VTK_USE_GUISUPPORT
VTK_USE_QVTK
VTK_USE_GL2PS
PATH the directory where coin-config resides. In case Coin3D is installed as a framework on Mac OS this is not required.
export OIV_DIR=/usr/local You do not need to do this on Mac OS X if you installe Coin3D as a framework (which is the default).
On MinGW you need to make sure that the gettimeofday function is available (check in include/sys/time.h); in case it's not then download the latest mingw-runtime environment or have a look at the OpenBabel build page.
cd to the top level distribution dir and create a cmakebuild folder:
mkdir cmakebuild
PATH variable so that the correct binary Qt dir is found: Cmake finds Qt looking for the qmake executable so you need to have the right qmake executable as the first one in the path.
version_info.cmake in the build directory; this file is included by the main CMakeLists.txt file to set version information. Open version_info.cmake and add something like (use whatever version numbers you want).SET( MOLEKEL_VERSION_MAJOR 5 ) SET( MOLEKEL_VERSION_MINOR 0 ) SET( MOLEKEL_VERSION_PATCH 0 ) SET( MOLEKEL_VERSION_BUILD 0 ) SET( MOLEKEL_VERSION_TYPE "development" )
ccmake ../src
OPENBABEL_INCLUDE_DIR: OpenBabel include dir; where the openbabel include dir is e.g. /usr/local/include/openbabel-2.0
OPENBABEL_LINK_DIR: OpenBabel library dir; where the libopenbabel file is.
IV_INCLUDE_DIR: OpenInventor(Coin3D) include dir; where the Inventor include dir resides. Not required on Mac if Coin installed as a framework.
IV_LINK_DIR: OpenInventor(Coin3D) lib dir. Not required on Mac if Coin installed as a framework.
MOIV_INCLUDE_DIR: Molecular Inventor include dir; where the ChemKit2 include directory is.
MOIV_LINK_DIR: Molecular Inventor lib dir;
VTK_DIR: VTK dir e.g. /usr/local/lib/vtk-5.0
[c](Mac, Linux) or Configure(Windows) to configure then [g](Mac, Linux) or Ok(Windows) to generate the makefiles.
make.
The build process will generate the following tree in the build dir:
dist - release notes, license, readme
bin OR bundle - binary or Mac bundle
resources - images, configuration files...
toolbar - toolbar icons
doc - user documentation
Note: with MinGW 3.4.5 compilation of MolekelData.cpp can be very slow; to speed up build time during development #define MOLEKEL_USE_COMMON_FILE_FORMATS
In order to launch Molekel you need to make sure that all the required dynamic libraries are accessible from the executable.
Windows
PATH environment variable or in the same directory as the executable.
Linux
LD_LIBRARY_PATH environment variable. To find the list of used dlls run: ldd dist/bin/Molekel from the build directory.
MacOS
DYLD_LIBRARY_PATH environment variable. To find the list of dynamic libraries and frameworks used run otool -L dist/bundle/Molekel.app/Contents/MacOS/Molekel from the build directory.
resource directory (including the toolbar dir) must be copied into Molekel.app/Contents/Resources.
Molekel versions 5.3 or above use some advanced multi-pass rendering techniques to enhance visual quality; these techniques may generate visual artifacts on transparent surfaces on some specific graphic cards. We have experienced problems on SuSE 10.3 x86-32/NVIDIA 8800 Ultra and Windows XP 32bit/NVIDIA 8800 Ultra system; on Windows problems can be fixed by selecting Let the 3D application decide (which should be the default) in the Image Settings page of the NVIDIA Control Panel.
In general, in case you have rendering problems, get messages about errors in Coin or the program crashes when loading files without reporting any error, you can set the value of two environment variables as follows:
COIN_FULL_INDIRECT_RENDERING=0
COIN_FORCE_GL1_0_ONLY=1
before launching Molekel to disable the use of advanced OpenGL features.
To set the environment variables permanently on Windows XP right-click on My Computer then select the Advanced tab and click on the Environment Variables button.
You can also set the COIN_DEBUG_GLGLUE environment variable to 1 before starting Molekel in a console window to print OpenGL debug information.
To enable printing on standard output on Mac you'll have to invoke the actual executable in the Molekel.app folder i.e. Molekel.app/Contents/MacOS/Molekel.