+++ /dev/null
-* Unbundle jsoncpp
-* Remove forcing C++98
-* Remove forcing CMAKE_BUILD_TYPE
-* Remove -fPIC globally
-* Fix LFS macro definitions
-* Make building static library optional
-* Use GNUInstallDirs conventions
-* Install .pc file
-See also: https://bugs.gentoo.org/show_bug.cgi?id=550144
-
-Taken from https://github.com/pezmaster31/bamtools/pull/139
-
---- a/CMakeLists.txt
-+++ b/CMakeLists.txt
-@@ -9,7 +9,14 @@
- project( BamTools )
-
- # Cmake requirements
--cmake_minimum_required( VERSION 2.6.4 )
-+cmake_minimum_required( VERSION 3.0 )
-+
-+# on macOS, MACOSX_RPATH is enabled by default on more recent versions
-+# of CMake. Disable this behaviour, and let user enable it if need be.
-+cmake_policy( SET CMP0042 OLD )
-+
-+# Adhere to GNU filesystem layout conventions
-+include( GNUInstallDirs )
-
- # Force the build directory to be different from source directory
- macro( ENSURE_OUT_OF_SOURCE_BUILD MSG )
-@@ -34,18 +41,21 @@
- set( BamTools_VERSION_MINOR 4 )
- set( BamTools_VERSION_BUILD 1 )
-
--# set our library and executable destination dirs
--set( EXECUTABLE_OUTPUT_PATH "${CMAKE_SOURCE_DIR}/bin" )
--set( LIBRARY_OUTPUT_PATH "${CMAKE_SOURCE_DIR}/lib" )
--
- # define compiler flags for all code
--set( CMAKE_BUILD_TYPE Release )
--set( CMAKE_CXX_FLAGS_RELEASE "-std=c++98 ${CMAKE_CXX_FLAGS_RELEASE}" )
--add_definitions( -Wall -D_FILE_OFFSET_BITS=64 )
-+add_definitions( -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE )
-+add_compile_options( -Wall )
-
- # -----------------------------------------------
- # handle platform-/environment-specific defines
-
-+# Make building the static library optional
-+option( BUILD_STATIC "Build static libbamtools archive" OFF )
-+if( BUILD_STATIC )
-+ set( BAMTOOLS_CMD_LDFLAGS BamTools-static )
-+else()
-+ set( BAMTOOLS_CMD_LDFLAGS BamTools )
-+endif()
-+
- # If planning to run in Node.js environment, run:
- # cmake -DEnableNodeJS=true
- if( EnableNodeJS )
-@@ -57,6 +67,11 @@
- add_definitions( -DSUN_OS )
- endif()
-
-+# find system JsonCpp
-+find_package( PkgConfig )
-+pkg_search_module( JSONCPP jsoncpp>=1 )
-+
-+
- # -------------------------------------------
-
- # add our includes root path
---- a/src/api/CMakeLists.txt
-+++ b/src/api/CMakeLists.txt
-@@ -10,7 +10,6 @@
-
- # add compiler definitions
- add_definitions( -DBAMTOOLS_API_LIBRARY ) # (for proper exporting of library symbols)
--add_definitions( -fPIC ) # (attempt to force PIC compiling on CentOS, not being set on shared libs by CMake)
-
- # fetch all internal source files
- add_subdirectory( internal )
-@@ -31,18 +30,6 @@
- ${InternalSources}
- )
-
--# create main BamTools API shared library
--add_library( BamTools SHARED ${BamToolsAPISources} )
--set_target_properties( BamTools PROPERTIES
-- SOVERSION "2.4.1"
-- OUTPUT_NAME "bamtools" )
--
--# create main BamTools API static library
--add_library( BamTools-static STATIC ${BamToolsAPISources} )
--set_target_properties( BamTools-static PROPERTIES
-- OUTPUT_NAME "bamtools"
-- PREFIX "lib" )
--
- # link libraries automatically with zlib (and Winsock2, if applicable)
- if( WIN32 )
- set( APILibs z ws2_32 )
-@@ -50,12 +37,23 @@
- set( APILibs z )
- endif()
-
--target_link_libraries( BamTools ${APILibs} )
--target_link_libraries( BamTools-static ${APILibs} )
-+# create main BamTools API shared library
-+add_library( BamTools SHARED ${BamToolsAPISources} )
-+set_target_properties( BamTools PROPERTIES
-+ SOVERSION "2.4.1"
-+ OUTPUT_NAME "bamtools" )
-+target_link_libraries( BamTools ${APILibs} )
-+install( TARGETS BamTools LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" )
-
--# set library install destinations
--install( TARGETS BamTools LIBRARY DESTINATION "lib/bamtools" RUNTIME DESTINATION "bin")
--install( TARGETS BamTools-static ARCHIVE DESTINATION "lib/bamtools")
-+# create main BamTools API static library
-+if( BUILD_STATIC )
-+ add_library( BamTools-static STATIC ${BamToolsAPISources} )
-+ set_target_properties( BamTools-static PROPERTIES
-+ OUTPUT_NAME "bamtools"
-+ PREFIX "lib" )
-+ target_link_libraries( BamTools-static ${APILibs} )
-+ install( TARGETS BamTools-static ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" )
-+endif()
-
- # export API headers
- include(../ExportHeader.cmake)
---- a/src/bamtools.pc.in
-+++ b/src/bamtools.pc.in
-@@ -0,0 +1,11 @@
-+prefix=@CMAKE_INSTALL_PREFIX@
-+exec_prefix=${prefix}
-+libdir=${exec_prefix}/@CMAKE_INSTALL_LIBDIR@
-+includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@
-+
-+Name: BamTools
-+Description: BamTools is a C++ library for reading and manipulating BAM files
-+Version: @BamTools_VERSION_MAJOR@.@BamTools_VERSION_MINOR@.@BamTools_VERSION_BUILD@
-+
-+Libs: -L${libdir} -lbamtools
-+Cflags: -I${includedir}
---- a/src/CMakeLists.txt
-+++ b/src/CMakeLists.txt
-@@ -14,3 +14,7 @@
- include( ExportHeader.cmake )
- set( SharedIncludeDir "shared" )
- ExportHeader( SharedHeaders shared/bamtools_global.h ${SharedIncludeDir} )
-+
-+# configure and install pkg-config file
-+configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/bamtools.pc.in ${CMAKE_CURRENT_BINARY_DIR}/bamtools-1.pc @ONLY )
-+install( FILES ${CMAKE_CURRENT_BINARY_DIR}/bamtools-1.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig )
---- a/src/ExportHeader.cmake
-+++ b/src/ExportHeader.cmake
-@@ -18,10 +18,10 @@
- add_custom_command( TARGET ${MODULE} COMMAND
- ${CMAKE_COMMAND} -E copy_if_different
- "${CMAKE_CURRENT_SOURCE_DIR}/${FILE}"
-- "${CMAKE_SOURCE_DIR}/include/${DEST}/${FILENAME}" )
-+ "${CMAKE_CURRENT_BINARY_DIR}/include/${DEST}/${FILENAME}" )
-
- # make sure files are properly 'installed'
-- install( FILES "${FILE}" DESTINATION "include/bamtools/${DEST}" )
-+ install( FILES "${FILE}" DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/bamtools/${DEST}" )
-
- endfunction( ExportHeader )
-
---- a/src/third_party/CMakeLists.txt
-+++ b/src/third_party/CMakeLists.txt
-@@ -5,5 +5,3 @@
- # src/third-party/
- # ==========================
-
--# list third-party subdirectories to build in
--add_subdirectory( jsoncpp )
---- a/src/toolkit/CMakeLists.txt
-+++ b/src/toolkit/CMakeLists.txt
-@@ -35,10 +35,14 @@
- OUTPUT_NAME "bamtools"
- )
- # make version info available in application
--configure_file( bamtools_version.h.in ${BamTools_SOURCE_DIR}/src/toolkit/bamtools_version.h )
-+configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/bamtools_version.h.in ${CMAKE_CURRENT_BINARY_DIR}/bamtools_version.h )
-+include_directories( ${CMAKE_CURRENT_BINARY_DIR} )
-+
-+# set include paths for system JsonCpp
-+target_include_directories( bamtools_cmd PRIVATE ${JSONCPP_INCLUDE_DIRS} )
-
- # define libraries to link
--target_link_libraries( bamtools_cmd BamTools BamTools-utils jsoncpp )
-+target_link_libraries( bamtools_cmd BamTools-utils ${BAMTOOLS_CMD_LDFLAGS} ${JSONCPP_LDFLAGS} )
-
- # set application install destinations
--install( TARGETS bamtools_cmd DESTINATION "bin")
-+install( TARGETS bamtools_cmd DESTINATION "${CMAKE_INSTALL_BINDIR}" )
---- a/src/utils/CMakeLists.txt
-+++ b/src/utils/CMakeLists.txt
-@@ -8,9 +8,8 @@
- # list include paths
- include_directories( ${BamTools_SOURCE_DIR}/src/api )
-
--# add compiler definitions
-+# add compiler definitions
- add_definitions( -DBAMTOOLS_UTILS_LIBRARY ) # (for proper exporting of library symbols)
--add_definitions( -fPIC ) # (attempt to force PIC compiling on CentOS, not being set on shared libs by CMake)
-
- # create BamTools utils library
- add_library( BamTools-utils STATIC
+++ /dev/null
-* Fix building in C++11/C++14 modes
-See also: https://bugs.gentoo.org/show_bug.cgi?id=596208
-
-Taken from https://github.com/pezmaster31/bamtools/pull/139
-
---- a/src/api/BamConstants.h
-+++ b/src/api/BamConstants.h
-@@ -126,10 +126,10 @@
-
- // zlib & BGZF constants
- const char GZIP_ID1 = 31;
--const char GZIP_ID2 = 139;
-+const char GZIP_ID2 = static_cast<char>(139);
- const char CM_DEFLATE = 8;
- const char FLG_FEXTRA = 4;
--const char OS_UNKNOWN = 255;
-+const char OS_UNKNOWN = static_cast<char>(255);
- const char BGZF_XLEN = 6;
- const char BGZF_ID1 = 66;
- const char BGZF_ID2 = 67;
---- a/src/toolkit/bamtools_filter.cpp
-+++ b/src/toolkit/bamtools_filter.cpp
-@@ -16,7 +16,7 @@
- #include <utils/bamtools_utilities.h>
- using namespace BamTools;
-
--#include <jsoncpp/json.h>
-+#include <json/json.h>
- using namespace Json;
-
- #include <cstdio>
-@@ -647,7 +647,7 @@
- if ( !reader.parse(document, root) ) {
- // use built-in error reporting mechanism to alert user what was wrong with the script
- cerr << "bamtools filter ERROR: failed to parse script - see error message(s) below" << endl
-- << reader.getFormatedErrorMessages();
-+ << reader.getFormattedErrorMessages();
- return false;
- }
-
---- a/src/toolkit/bamtools_resolve.cpp
-+++ b/src/toolkit/bamtools_resolve.cpp
-@@ -410,7 +410,7 @@
- ReadGroupResolver& resolver = (*rgIter).second;
-
- // store read name with resolver
-- resolver.ReadNames.insert( make_pair<string,bool>(fields[1], true) ) ;
-+ resolver.ReadNames.insert( make_pair(fields[1], true) ) ;
- }
-
- // if here, return success
-@@ -607,7 +607,7 @@
- resolver.IsAmbiguous = ( fields.at(6) == TRUE_KEYWORD );
-
- // store RG entry and return success
-- readGroups.insert( make_pair<string, ReadGroupResolver>(name, resolver) );
-+ readGroups.insert( make_pair(name, resolver) );
- return true;
- }
-
-@@ -1014,7 +1014,7 @@
- }
-
- // if read name not found, store new entry
-- else resolver.ReadNames.insert( make_pair<string, bool>(al.Name, isCurrentMateUnique) );
-+ else resolver.ReadNames.insert( make_pair(al.Name, isCurrentMateUnique) );
- }
-
- // close files
-@@ -1046,7 +1046,7 @@
- SamReadGroupConstIterator rgEnd = header.ReadGroups.ConstEnd();
- for ( ; rgIter != rgEnd; ++rgIter ) {
- const SamReadGroup& rg = (*rgIter);
-- m_readGroups.insert( make_pair<string, ReadGroupResolver>(rg.ID, ReadGroupResolver()) );
-+ m_readGroups.insert( make_pair(rg.ID, ReadGroupResolver()) );
- }
- }
-