-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathCMakeLists.txt
105 lines (85 loc) · 3.07 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
95
96
97
98
99
100
101
102
103
104
105
# ================================================================================
# Project Informationn
#
# ===============================================================================
cmake_minimum_required(VERSION 3.14)
project(apropos VERSION 0.0
DESCRIPTION "Tapestry: Inference from complex P.f. infections"
LANGUAGES CXX
)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/build/cmake/modules/")
# Compilation flags
set(COMPILE_TESTS ON)
# ================================================================================
# Use C++17
#
# ================================================================================
set(CMAKE_CXX_STANDARD 17) # required for <filesystem>
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
# ================================================================================
# Install GoogleTest
#
# ================================================================================
if (COMPILE_TESTS)
include(FetchContent)
FetchContent_Declare(
googletest
URL https://github.com/google/googletest/archive/5376968f6948923e2411081fd9372e71a59d8e77.zip
)
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
FetchContent_MakeAvailable(googletest)
endif()
# ================================================================================
# Compile `tapestry`
#
# ================================================================================
# Target executable
set(TARGET tapestry)
# Source files
set(SOURCES
src/bed.cpp
src/betabin.cpp
src/combinatorics.cpp
src/data.cpp
src/ibd.cpp
src/io.cpp
src/mcmcs.cpp
src/model_compare.cpp
src/model_fitting.cpp
src/models.cpp
src/parameters.cpp
src/particle_writers.cpp
src/particles.cpp
src/proposals.cpp
src/sampling.cpp
src/vcf.cpp
)
# Add the executable
add_executable(${TARGET} src/main.cpp ${SOURCES})
# --------------------------------------------------------------------------------
# Link htslib
# --------------------------------------------------------------------------------
# Define htslib_FOUND, htslib_INCLUDE_DIRS, htslib_LIBRARIES
find_package(HTSlib 1.4 REQUIRED)
# Link include directories and library to the executable
target_include_directories(${TARGET} PUBLIC ${HTSlib_INCLUDE_DIRS})
target_link_libraries(${TARGET} PUBLIC ${HTSlib_LIBRARIES})
# ================================================================================
# Compile tests
#
# ================================================================================
if (COMPILE_TESTS)
enable_testing()
set(TSOURCES
tests/test_combinatorics.cpp
tests/test_particle.cpp
tests/test_random.cpp
)
add_executable(test_tapestry ${TSOURCES} ${SOURCES})
target_include_directories(test_tapestry PUBLIC ${HTSlib_INCLUDE_DIRS})
target_link_libraries(test_tapestry GTest::gtest_main ${HTSlib_LIBRARIES})
include(GoogleTest)
gtest_discover_tests(test_tapestry)
endif()