-
Notifications
You must be signed in to change notification settings - Fork 51
/
Copy pathCMakeLists.txt
95 lines (74 loc) · 2.9 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
cmake_minimum_required(VERSION 3.13)
project(ExpansionHunter)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
# Check for required packages:
find_package(ZLIB REQUIRED)
find_package(BZip2 REQUIRED)
find_package(LibLZMA REQUIRED)
find_package(CURL REQUIRED)
if(NOT APPLE)
find_package(OpenSSL REQUIRED)
endif()
include(ExternalProject)
set(installDir ${CMAKE_CURRENT_BINARY_DIR}/install)
ExternalProject_Add(htslib
BUILD_IN_SOURCE YES
URL https://github.com/samtools/htslib/releases/download/1.10.2/htslib-1.10.2.tar.bz2
CONFIGURE_COMMAND ./configure --prefix=${installDir} --enable-libcurl --enable-s3
BUILD_COMMAND $(MAKE) lib-static
)
# Setup boost user config so that it uses the same c++ compiler as other components:
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
set (BOOST_COMPILER_TAG "gcc")
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
set (BOOST_COMPILER_TAG "clang")
set(B2_OPTIONS ${B2_OPTIONS} "toolset=clang")
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
set (BOOST_COMPILER_TAG "darwin")
set(B2_OPTIONS ${B2_OPTIONS} "toolset=clang")
endif()
if (BOOST_COMPILER_TAG)
set(BOOST_UCONFIG "${CMAKE_BINARY_DIR}/user-config.jam")
file(WRITE "${BOOST_UCONFIG}" "using ${BOOST_COMPILER_TAG} : : \"${CMAKE_CXX_COMPILER}\" ;\n")
set(BOOST_PATCH_COMMAND ${CMAKE_COMMAND} -E copy ${BOOST_UCONFIG} tools/build/src/user-config.jam)
endif()
ExternalProject_Add(Boost
BUILD_IN_SOURCE YES
URL https://boostorg.jfrog.io/artifactory/main/release/1.73.0/source/boost_1_73_0.tar.bz2
PATCH_COMMAND ${BOOST_PATCH_COMMAND}
CONFIGURE_COMMAND ./bootstrap.sh --prefix=${installDir}
BUILD_COMMAND ./b2 install -j8 --with-filesystem --with-system --with-program_options link=static ${B2_OPTIONS}
INSTALL_COMMAND ""
)
ExternalProject_Add(spdlog
URL https://github.com/gabime/spdlog/archive/refs/tags/v1.6.1.tar.gz
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=${installDir}
-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
)
ExternalProject_Add(googletest
URL https://github.com/google/googletest/archive/refs/tags/release-1.10.0.tar.gz
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=${installDir}
-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
)
# CMAKE_CXX_STANDARD is required for macOS 10.15
ExternalProject_Add(abseil
URL https://github.com/abseil/abseil-cpp/archive/refs/tags/20210324.2.tar.gz
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=${installDir}
-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
-DCMAKE_CXX_STANDARD=11
-DBUILD_TESTING=OFF
)
ExternalProject_Add(ehunter
SOURCE_DIR ${CMAKE_SOURCE_DIR}/ehunter
BUILD_ALWAYS YES
TEST_COMMAND "ctest"
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=${installDir}
-DCMAKE_PREFIX_PATH:PATH=${installDir}
-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} ${CMAKE_SOURCE_DIR}/ehunter
)
ExternalProject_Add_StepDependencies(ehunter configure
Boost spdlog htslib googletest abseil)