In order to build Molekel from source you need the following tools
- Subversion client - to get the code from the repository, optional if you download the source code archive
- CMake ( http://www.cmake.org ) - makefile generation tool
- A C++ compiler such as gcc (MacOS X, Unix), MinGW (Windows) or Visual C++ (Windows, recommended, free version available at http://www.microsoft.com/express/vc)
wget(optional but useful to automate the build process as done in the Molekel build scripts)unix2dosanddos2unix(both optional) to convertEOLseparators
and libraries:
- Qt: http://www.trolltech.com/products/qt
- Qwt: http://qwt.sourceforge.net
- VTK 5.x: http://www.vtk.org
- Coin3D: http://www.coin3d.org
- OpenMOIV: http://www.tecn.upf.es/openMOIV
- OpenBabel: http://openbabel.sourceforge.net
After all the dependencies are installed and you have downloaded the source code you need to generate the makefiles with CMake; three options available:
- (RECOMMENDED) get one of the
run_<environment>_cmake.sh/batfiles from thebuilddirectory of the source distribution and change the paths to suit your environment then execute the script OR - run
ccmake(Unix/Mac OS X) orCMakeSetup.exe(Windows) and specify the include and library path through an interactive interface then executemake/nmakeOR - run
cmakeon the command line specifying the path to theCMakeLists.txtconfiguration file and the include/library paths on the command line then executemake/nmake
Detailed instructions
I Dependencies
- Install Qt (http://www.trolltech.com/products/qt); Qt has to be installed before VTK because VTK needs some Qt libraries.
- Install VTK 5.x (http://www.vtk.org)
- build VTK from source and make sure the following parameters are set to
ONVTK_USE_GUISUPPORTVTK_USE_QVTKVTK_USE_GL2PS
- Check out OS specific information below.
- build VTK from source and make sure the following parameters are set to
- Install OpenBabel 2.x libraries (http://openbabel.sourceforge.net)
- If you are building on Windows with MinGW check out the OpenBabel OS specific issues below.
- Install OpenInventor and Molecular Inventor
- Any implementation of OpenInventor 2.x will work; you can get an open source version here (Coin3D): http://www.coin3d.org
- Note that in case you want to build OpenMOIV (or any program requiring Coin3D) you also have to have in the
PATHthe directory where thecoin-configfile resides. In case Coin3D is installed as a framework on Mac OS this is not required.
- Note that in case you want to build OpenMOIV (or any program requiring Coin3D) you also have to have in the
- An open source implementation of Molecular Inventor (OpenMOIV) can be downloaded here: http://www.tecn.upf.es/openMOIV
- When building OpenMOIV on Linux/MinGW/VC++ make sure you set the
OIV_DIRenvironment variable to the installation directory of Coin3D (where the include and lib dirs are) e.g.export OIV_DIR=/usr/localYou do not need to do this on Mac OS X if you installed Coin3D as a framework (which is the default). - Make sure you read the build information for OpenMOIV to undestand how to deal with fonts on different platforms.
When building with MinGW you need to make sure that the gettimeofday function is available (check in include/sys/time.h); in case it is not then download the latest mingw-runtime environment or have a look at the OpenBabel build page.
II Build
These build instruction are useful only if you want to run CMake yourself instead of using one of the scripts available in the build directory.
- Uncompress the Molekel source archive,
cdto the top level distribution dir and create acmakebuildfolder:mkdir cmakebuild- cd to the cmakebuild folder
- Modify the
PATHvariable so that the correct binary Qt dir is found: CMake finds Qt looking for theqmakeexecutable so you need to have the rightqmakeexecutable as the first one in the path. - Create a text file
version_info.cmakein the build directory; this file is included by the mainCMakeLists.txtfile to set version information. Openversion_info.cmakeand 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" )
- Run
ccmake(Linux, Mac OS) orCMakeSetup.exe(Windows) and make sure that all the parameters are correct.ccmake ../srcIV_DYNAMICandMOIV_DYNAMICshould be set toONin case dynamic libraries are used; toOFFotherwise. Note that this only seems to be required onMinGW.- The following parameters need to be set (make sure you also read the OS specific section) from within
ccmake(Linux, Mac) orCMakeSetup.exe(Windows):OPENBABEL_INCLUDE_DIR: OpenBabel include dir; where theopenbabelinclude dir is e.g./usr/local/include/openbabel-2.0OPENBABEL_LINK_DIR: OpenBabel library dir; where thelibopenbabel.<dll|so>file is.IV_INCLUDE_DIR: OpenInventor (Coin3D) include dir; where theInventorinclude dir resides. Not required on Mac if Coin is installed as a framework.IV_LINK_DIR: OpenInventor (Coin3D) lib dir. Not required on Mac if Coin is installed as a framework.MOIV_INCLUDE_DIR: Molecular Inventor include dir; where theChemKit2include directory is.MOIV_LINK_DIR: Molecular Inventor lib dir;VTK_DIR: VTK dir e.g./usr/local/lib/vtk-5.0
- Generate the makefiles with
ccmakeorCMakeSetup.exe(configure then generate):- Check that all the parameters are set to the proper values.
- Press
[c](Mac, Linux) or Configure(Windows) to configure then[g](Mac, Linux) or Ok(Windows) to generate the makefiles.
- Whenever you change one or more parameter values in
ccmakeorCMakeSetupyou'll have to configure before you can generate.
- Run
makeornmake.
The build process will generate the following tree in the build directory:
dist- release notes, license, readmebinORbundle- binary or Mac bundleresources- 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
III Run
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 within 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.
Rendering issues
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=0COIN_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.