Skip to content
This repository has been archived by the owner on Dec 16, 2022. It is now read-only.

Commit

Permalink
Make CMAKE the default build script
Browse files Browse the repository at this point in the history
* use add_compile_options instead of hardcode setting of the env variable
* remove lib from include directories
* add header files to the source list
* include htslib directories at the cmake build location (no longer using the git-submodule)
* remove git submodule and use htslib via cmake from now on.
* exclude tests from building by default
* build release by default, but tests in debug mode
* remove boost build files
* add cmake to travis
* add release / debug options to the build
  • Loading branch information
Mauricio Carneiro committed Nov 2, 2014
1 parent 40aea31 commit 6800236
Show file tree
Hide file tree
Showing 13 changed files with 122 additions and 89 deletions.
4 changes: 0 additions & 4 deletions .gitmodules
@@ -1,4 +0,0 @@
[submodule "lib/htslib"]
path = lib/htslib
url = ../htslib.git
branch = broad
10 changes: 6 additions & 4 deletions .travis.yml
Expand Up @@ -15,14 +15,16 @@ before_install:
- sudo apt-get -qq update;

install:
- .travis_scripts/boost.sh
- .travis_scripts/boost.sh
- if [ "$CXX" == "clang++" ]; then .travis_scripts/clang.sh; fi
- if [ "$CXX" == "g++" ]; then .travis_scripts/gcc.sh; fi

script:
- if [ "$TRAVIS_BRANCH" == "master" ]; then b2 -a toolset=${CC} test variant=production; fi
- b2 -a toolset=${CC} test variant=debug cxxflags=--coverage linkflags=--coverage
- mkdir build; pushd build;
- cmake .. && make debug && make -j 2 gamgee_test
- popd;
- build/test/gamgee_test

after_success:
- .travis_scripts/update_website_dox.sh
- .travis_scripts/coveralls.sh
- .travis_scripts/coveralls.sh
6 changes: 0 additions & 6 deletions .travis_scripts/boost.sh
Expand Up @@ -3,9 +3,3 @@
# install boost libraries
sudo apt-get install -qq boost1.55

# install boost build from sources in ${HOME}/boost-build
git clone https://github.com/boostorg/build.git ${HOME}/boost-build
cd ${HOME}/boost-build
./bootstrap.sh --with-toolset=${CC}
sudo ./b2 install
cd -
3 changes: 2 additions & 1 deletion .travis_scripts/coveralls.sh
Expand Up @@ -5,5 +5,6 @@
if [ "$CXX" == "g++" ];
then
sudo pip install cpp-coveralls
coveralls -b . -r . -e lib -e test -e testdata -t ${COVERALLS_TOKEN}
cd build
coveralls -r ../ -e CMakeFiles -e contrib -e test -t ${COVERALLS_TOKEN}
fi
14 changes: 14 additions & 0 deletions .travis_scripts/gcc.sh
Expand Up @@ -3,3 +3,17 @@
wget ftp://gsapubftp-anonymous@ftp.broadinstitute.org/travis/gcc_4.9.1-1_amd64.deb
sudo apt-get remove cpp libffi-dev
sudo dpkg --install gcc_4.9.1-1_amd64.deb

echo "BEGIN Eliminating old libstdc++"
sudo rm /usr/lib/gcc/i586-mingw32msvc/4.2.1-sjlj/libstdc++.a
sudo rm /usr/lib/gcc/i586-mingw32msvc/4.2.1-sjlj/libstdc++.la
sudo rm /usr/lib/gcc/i586-mingw32msvc/4.2.1-sjlj/libstdc++_s.a
sudo rm /usr/lib/gcc/i586-mingw32msvc/4.2.1-sjlj/libstdc++_sjlj_6.dll
sudo rm /usr/lib/gcc/x86_64-linux-gnu/4.6/libstdc++.a
sudo rm /usr/lib/gcc/x86_64-linux-gnu/4.6/libstdc++.so
sudo rm /usr/lib/x86_64-linux-gnu/libstdc++.so.6
sudo rm /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.16
echo "END Eliminating old libstdc++"

export LD_LIBRARY_PATH=/usr/lib64
sudo ln -s /usr/lib64/libstd* /usr/lib/x86_64-linux-gnu/
26 changes: 21 additions & 5 deletions CMakeLists.txt
@@ -1,16 +1,32 @@
cmake_minimum_required(VERSION 2.8.4)
cmake_minimum_required(VERSION 2.8.7)
project(gamgee)

include(ExternalProject)

## This is the right way to do this, but only supported in cmake 2.8.12
#add_compile_options("-std=c++1y")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++1y")

find_package(Boost 1.56 COMPONENTS unit_test_framework REQUIRED)
# Dependency: Boost Unit Test Framework (find in the system)
find_package(Boost 1.55 COMPONENTS unit_test_framework REQUIRED)
include_directories(${Boost_INCLUDE_DIRS})

# Dependency: htslib (download and build)
include("contrib/htslib.cmake")

include_directories(gamgee)
include_directories(gamgee/utils)
include_directories(lib)
include_directories(lib/htslib)

add_subdirectory(gamgee)
add_subdirectory(test)

ADD_CUSTOM_TARGET(debug
COMMAND ${CMAKE_COMMAND} -DCMAKE_BUILD_TYPE=Debug ${CMAKE_SOURCE_DIR}
COMMAND ${CMAKE_COMMAND} --build ${CMAKE_BINARY_DIR} --target all
COMMENT "Switch CMAKE_BUILD_TYPE to Debug"
)

ADD_CUSTOM_TARGET(release
COMMAND ${CMAKE_COMMAND} -DCMAKE_BUILD_TYPE=Release ${CMAKE_SOURCE_DIR}
COMMAND ${CMAKE_COMMAND} --build ${CMAKE_BINARY_DIR} --target all
COMMENT "Switch CMAKE_BUILD_TYPE to Release"
)
19 changes: 0 additions & 19 deletions Jamroot

This file was deleted.

14 changes: 9 additions & 5 deletions contrib/htslib.cmake
@@ -1,16 +1,20 @@
# build htslib
set(htslib_PREFIX ${CMAKE_BINARY_DIR}/contrib/htslib-prefix)
set(htslib_PREFIX ${CMAKE_BINARY_DIR}/contrib/htslib)
ExternalProject_Add(htslib
PREFIX ${htslib_PREFIX}
GIT_REPOSITORY "https://github.com/broadinstitute/htslib.git"
# NOTE: gamgee tracks the 'broad' branch
# we should always sync to a commit from that branch for consistency
GIT_TAG broad
BUILD_IN_SOURCE 1
CONFIGURE_COMMAND ""
BUILD_COMMAND ${MAKE}
BUILD_COMMAND make lib-static -j 4
INSTALL_COMMAND ""
)
LOG_DOWNLOAD 0
LOG_UPDATE 0
LOG_CONFIGURE 0
LOG_BUILD 0
LOG_TEST 0
LOG_INSTALL 0
)

include_directories(${htslib_PREFIX}/src/htslib)
set(htslib_LIB ${htslib_PREFIX}/src/htslib/libhts.a)
75 changes: 66 additions & 9 deletions gamgee/CMakeLists.txt
@@ -1,40 +1,97 @@
set(SOURCE_FILES
utils/file_utils.cpp
utils/genotype_utils.cpp
utils/hts_memory.cpp
utils/utils.cpp
utils/variant_field_type.cpp
utils/variant_utils.cpp
base_quals.cpp
base_quals.h
cigar.cpp
cigar.h
exceptions.h
fastq.cpp
fastq.h
fastq_iterator.cpp
fastq_iterator.h
fastq_reader.cpp
fastq_reader.h
gamgee.h
genotype.cpp
genotype.h
indexed_sam_iterator.cpp
indexed_sam_iterator.h
indexed_sam_reader.h
indexed_variant_iterator.cpp
indexed_variant_iterator.h
indexed_variant_reader.h
individual_field.h
individual_field_iterator.h
individual_field_value.h
individual_field_value_iterator.h
interval.cpp
interval.h
missing.h
multiple_variant_iterator.cpp
multiple_variant_iterator.h
multiple_variant_reader.h
read_bases.cpp
read_bases.h
read_group.cpp
read_group.h
reference_iterator.cpp
reference_iterator.h
reference_map.cpp
sam.cpp
reference_map.h
sam_builder.cpp
sam_builder_data_field.cpp
sam_builder_data_field.h
sam_builder.h
sam.cpp
sam.h
sam_header.cpp
sam_header.h
sam_iterator.cpp
sam_iterator.h
sam_pair_iterator.cpp
sam_pair_iterator.h
sam_reader.h
sam_tag.h
sam_writer.cpp
sam_writer.h
shared_field.h
shared_field_iterator.h
synced_variant_iterator.cpp
variant.cpp
synced_variant_iterator.h
synced_variant_reader.h
utils/file_utils.cpp
utils/file_utils.h
utils/genotype_utils.cpp
utils/genotype_utils.h
utils/hts_memory.cpp
utils/hts_memory.h
utils/short_value_optimized_storage.h
utils/utils.cpp
utils/utils.h
utils/variant_field_type.cpp
utils/variant_field_type.h
utils/variant_utils.cpp
utils/variant_utils.h
variant_builder.cpp
variant_builder.h
variant_builder_individual_field.h
variant_builder_individual_region.cpp
variant_builder_individual_region.h
variant_builder_shared_region.cpp
variant_header.cpp
variant_builder_shared_region.h
variant.cpp
variant_filters.h
variant_filters_iterator.h
variant.h
variant_header_builder.cpp
variant_header_builder.h
variant_header.cpp
variant_header.h
variant_iterator.cpp
variant_iterator.h
variant_reader.h
variant_writer.cpp
variant_writer.h
zip.h
)

add_library(gamgee STATIC ${SOURCE_FILES})
20 changes: 0 additions & 20 deletions lib/Jamfile

This file was deleted.

1 change: 0 additions & 1 deletion lib/htslib
Submodule htslib deleted from a68627
9 changes: 4 additions & 5 deletions test/CMakeLists.txt
Expand Up @@ -21,11 +21,10 @@ set(SOURCE_FILES
variant_reader_test.cpp
variant_test.cpp)

include("../contrib/htslib.cmake")
add_executable(gamgee_test EXCLUDE_FROM_ALL ${SOURCE_FILES})

include_directories(${Boost_INCLUDE_DIRS})

add_executable(gamgee_test ${SOURCE_FILES})
target_compile_definitions(gamgee_test PUBLIC -DBOOST_TEST_DYN_LINK)
## This is the right way to do this, but only supported in cmake 2.8.12
# target_compile_definitions(gamgee_test PUBLIC -DBOOST_TEST_DYN_LINK)
set_property(TARGET gamgee_test PROPERTY COMPILE_DEFINITIONS BOOST_TEST_DYN_LINK)
target_link_libraries(gamgee_test gamgee ${htslib_LIB} ${Boost_LIBRARIES} pthread z)
add_dependencies(gamgee_test htslib)
10 changes: 0 additions & 10 deletions test/Jamfile

This file was deleted.

0 comments on commit 6800236

Please sign in to comment.