Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Building and installing
The easiest way to get BamTools is to clone the git repository straight from GitHub:
$ git clone git://github.com/pezmaster31/bamtools.git
Developers who would like to modify (and we hope, contribute to) BamTools directly, may fork the project using the 'Fork' button at the top of the BamTools homepage, then pull down their own version of BamTools.
BamTools has been migrated to a CMake-based build system. We believe that this should simplify the build process across all platforms, especially with the BamTools API now available primarily as a static or shared library (that you link to instead of compiling lots of source files directly into your application). CMake is available on all major platforms, and indeed comes out-of-the-box with many Linux distributions.
To see if you have CMake (and if so, which version) try this command:
$ cmake --version
BamTools requires CMake (version >= 3.0). If you are missing CMake or have an older version, check your OS package manager (for Linux users) or download it here: http://www.cmake.org/cmake/resources/software.html .
BamTools also makes use of JsonCpp for certain serialization tasks. For users of macOS, Linux and other BSD based operating systems, it is strongly recommended that you install JsonCpp >= 1.8.0 from your operating system's standard repository (apt-get, emerge, macports, homebrew, ports etc.). BamTools tries to follow upstream JsonCpp activity and bundles the latest version in order to maximize compatibility, yet using the package from your OS provides the best integration experience.
On Windows, not using the bundled copy of JsonCpp is generally not tractable. You can try using
pkg-config on Windows for JsonCpp too, but this is rather involved and only recommended for advanced users.
Ok, now that you have CMake ready to go, let's build BamTools. A good practice in building applications is to do an out-of-source build, meaning that we're going to set up an isolated place to hold all the intermediate installation steps.
In the top-level directory of BamTools, type the following commands:
$ mkdir build $ cd build $ cmake -DCMAKE_INSTALL_PREFIX=/my/install/dir ..
CMAKE_INSTALL_PREFIX is the root of your final installation directory.
Microsoft Visual Studio users: This step creates a VS solution file (.sln), which can then be built to create the toolkit executable and API DLL's.
Everybody else: After running cmake, just run:
You should never copy stuff out of the temporary build dir. Instead, stage and/or install your compiled copy by running
$ make DESTDIR=/my/stage/dir install
such that the root of the installed files will be
/my/stage/dir/my/install/dir. You can omit passing
DESTDIR if you're installing into the final persistent directory.
The final directories within
CMAKE_INSTALL_PREFIX can be adjusted by changing
CMAKE_INSTALL_INCLUDEDIR in order to change the binary, library respectively include header dir.
Currently, BamTools is built as a static library, as this makes bundling and consuming from other applications easier. If you prefer dynamically linking to BamTools, just pass