|
| 1 | +cmake_minimum_required(VERSION 3.7) |
| 2 | + |
| 3 | +include(ExternalProject) |
| 4 | + |
| 5 | +#set(CMAKE_EXPORT_COMPILE_COMMANDS ON) |
| 6 | +#add_compile_options(-Werror) |
| 7 | + |
| 8 | +list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake) |
| 9 | + |
| 10 | +# set the project name |
| 11 | +project(chips VERSION 2.1) |
| 12 | +configure_file(chipsConfig.h.in chipsConfig.h) |
| 13 | + |
| 14 | +# specify the C++ standard |
| 15 | +set(CMAKE_CXX_STANDARD 11) |
| 16 | +set(CMAKE_CXX_STANDARD_REQUIRED True) |
| 17 | + |
| 18 | +ExternalProject_Add(zlib |
| 19 | + PREFIX ${CMAKE_BINARY_DIR}/thirdparty/zlib |
| 20 | + GIT_REPOSITORY "https://github.com/madler/zlib.git" |
| 21 | + GIT_TAG "v1.2.8" |
| 22 | + UPDATE_COMMAND "" |
| 23 | + BUILD_IN_SOURCE 1 |
| 24 | + CONFIGURE_COMMAND ${CMAKE_BINARY_DIR}/thirdparty/zlib/src/zlib/configure --prefix=${CMAKE_BINARY_DIR}/thirdparty/zlib --static |
| 25 | + INSTALL_DIR ${CMAKE_BINARY_DIR}/thirdparty/zlib |
| 26 | + LOG_DOWNLOAD 1 |
| 27 | + LOG_INSTALL 1 |
| 28 | + ) |
| 29 | +ExternalProject_Add(htslib |
| 30 | + PREFIX ${CMAKE_BINARY_DIR}/thirdparty/htslib |
| 31 | + GIT_REPOSITORY "https://github.com/samtools/htslib.git" |
| 32 | + GIT_TAG "1.3.1" |
| 33 | + UPDATE_COMMAND "" |
| 34 | + BUILD_IN_SOURCE 1 |
| 35 | + CONFIGURE_COMMAND "" |
| 36 | + BUILD_COMMAND make |
| 37 | + INSTALL_COMMAND make install prefix=${CMAKE_BINARY_DIR}/thirdparty/htslib |
| 38 | + LOG_DOWNLOAD 1 |
| 39 | + ) |
| 40 | + |
| 41 | +include_directories(${CMAKE_CURRENT_SOURCE_DIR}) |
| 42 | +include_directories(${CMAKE_BINARY_DIR}/thirdparty/zlib/include) |
| 43 | +set(zlib_static ${CMAKE_BINARY_DIR}/thirdparty/zlib/lib/libz.a) |
| 44 | +set(htslib_static ${CMAKE_BINARY_DIR}/thirdparty/htslib/lib/libhts.a) |
| 45 | +include_directories(${CMAKE_BINARY_DIR}/thirdparty/htslib/include) |
| 46 | +add_dependencies(htslib zlib) |
| 47 | + |
| 48 | +add_subdirectory(ChIPs) |
| 49 | + |
| 50 | +# add the executable |
| 51 | +add_executable(chips src/main.cpp) |
| 52 | + |
| 53 | +target_compile_features(chips PRIVATE cxx_range_for) |
| 54 | +target_include_directories(chips PUBLIC "${PROJECT_BINARY_DIR}") |
| 55 | +target_link_libraries(chips ChIPs pthread) |
| 56 | +install(TARGETS chips DESTINATION bin) |
| 57 | + |
| 58 | +add_dependencies(htslib zlib) |
| 59 | +add_dependencies(ChIPs htslib) |
0 commit comments