![]() # cmake -DOpenBabel2_DIR=/home/me/some/path/lib/openbabel. # cmake -DBUILD_SHARED=OFF -DCMAKE_INSTALL_PREFIX=/home/me/some/path. # This script requires OpenBabel to be build and installed. # This script can be used to create static executables linking to the static In most cases, only 3 lines in the CMakeLists.txt file have to be changed: There are only two files:ĭoc/examples/static_executable/CMakeLists/txt In the openbabel-2.3.0/doc/examples/static_executable/ directory there is an example CMakeLists.txt file to build custom static binraries. An example is provided to make it easy to do this when developing executables that link to openbabel statically. These symbols are the mangled names for the plugin classes. However, almost all compilers allow for symbols to be undefined at link time which is equivalent to using the symbol from inside the executable source. A simple approach that works for all compilers is to add the plugin source files to the executable sources. The plugin classes are never referenced directly and the linker removes all unreferenced symbols from the final executable. #Cmake linux archive#The static libopenbabel.a archive contains all plugins but these are not automatically included in an executable linked against libopenbabel.a. This static library archive contains all plugins The static libopenbabel.a is now in the build/src directory. to enable the tests.Ī static OpenBabel library can be build by setting BUILD_SHARED to OFF when running cmake. bat files called default_build with additional options, e.g. There is a batch file, default_build.bat, in the windows-vc2008 folder that runs cmake. The GUI build can be explicitly disabled using -DBUILD_GUI=OFF. On Windows, the WXWIN environment variable should be defined. The OpenBabel GUI is built by default if the wxWidgets development libraries are available (on Ubuntu 9.04, libwxgtk2.8-dev Fedora, wxGTK-devel). This option just compiles the Smiles and SDF formats, and of the tools just babel. On occasion, developers may find it useful to use the option -DMINIMAL_BUILD=ON.You can build in debug mode with "-DCMAKE_BUILD_TYPE=Debug". #Cmake linux code#To see the actual commands used to compile the code (on Linux), run 'make VERBOSE=1'.Any of these target names can be used as shown above to rebuild specific parts, this can save a lot of time when working on one specific aspect of Open Babel. ![]() The executable targets are named after the corresponding executable, e.g. The openbabel library target is named openbabel (currently openbabel-2 on Windows). This can be used for all targets by appending '/fast' to the target name.įormats are named after their source files, e.g. CMake adds an additional target that has no dependency tracking, and can be used if working on the CML format for example, The dependency tracking can also take time when building plugins. Make openbabel # Rebuild the openbabel libary By making individual parts of the project these relinks can be avoided. This can lead to excessive amounts of time spent waiting for everything to relink, when the ABI has in fact not changed. As such anytime that the openbabel library is rebuilt all of the plugins/executables that link to it are relinked. Notes for developers Make Individual TargetsĬMake has good dependency tracking, but it uses timestamps (as most build systems do) to indicate a file has changed. Finally, if CMAKE_INSTALL_PREFIX is specified but PYTHON_PREFIX is not, then PYTHON_PREFIX is set to CMAKE_INSTALL_PREFIX. #Cmake linux install#If PYTHON_PREFIX is specified, then this will be used to install the bindings. The installation directory will be the global site-packages if neither PYTHON_PREFIX nor CMAKE_INSTALL_PREFIX is specified (i.e. If you are compiling from the subversion repository, you will also need to specify "-DRUN_SWIG=ON" to generate the bindings (note: this requires SWIG 1.3.40, which should either be on the PATH or specified with "-DSWIG_EXECUTABLE=/my/path"). To build the Python bindings you need to specify "-DPYTHON_BINDINGS=ON". To run the tests, first set BABEL_DATADIR=~/src/openbabel/data and BABEL_LIBDIR=~/build/openbabel/lib. The CMakeCache.txt file contains most stored settings, erasing that will allow you to configure again. This would configure OpenBabel in the build directory, make all files and install them to the specified prefix. So, if you want to build the source code directly from our subversion repository, you would first check out the code as follows:Ĭmake -DCMAKE_INSTALL_PREFIX=/usr/local/openbabel ~/src/openbabel You can use whatever directory structure you prefer, one possible directory layout is: This ensures good separation between source and build files. This means that no generated files are placed in the source directory. The preferred method of building Open Babel with CMake is to use "out of source" builds. ![]() ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |