-
Notifications
You must be signed in to change notification settings - Fork 2
/
CMakeLists.txt
84 lines (65 loc) · 1.85 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
cmake_minimum_required(VERSION 2.8.12)
project(splitcode)
include(GNUInstallDirs)
set(EXT_PROJECTS_DIR ${PROJECT_SOURCE_DIR}/ext)
set(CMAKE_CXX_FLAGS_PROFILE "-g")
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Release")
endif()
if(${CMAKE_VERSION} VERSION_LESS 3.1)
add_compile_options(-std=c++11)
else()
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
endif()
if(LINK MATCHES static)
message("static build")
ELSE(LINK MATCHES shared)
message("shared build")
ENDIF(LINK MATCHES static)
set(USE_HTSLIB "ON")
if (NO_HTSLIB)
set(USE_HTSLIB OFF)
endif()
if(EMSCRIPTEN_BUILD)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -s USE_ZLIB=1")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -s USE_ZLIB=1")
set(USE_HTSLIB OFF)
endif()
add_subdirectory(src)
if (BUILD_FUNCTESTING)
add_subdirectory(func_tests)
message("Functional testing enabled.")
add_custom_target(test
COMMAND /bin/bash ./func_tests/runtests.sh
DEPENDS ./src/splitcode
)
endif(BUILD_FUNCTESTING)
include(ExternalProject)
if (ZLIBNG)
message("zlib-ng enabled.")
ExternalProject_Add(zlib-ng
PREFIX ${PROJECT_SOURCE_DIR}/ext/zlib-ng
SOURCE_DIR ${PROJECT_SOURCE_DIR}/ext/zlib-ng
BUILD_IN_SOURCE 1
CONFIGURE_COMMAND mkdir -p zlib-ng && cd zlib-ng && cmake .. -DZLIB_COMPAT=ON -DZLIB_ENABLE_TESTS=OFF -DCMAKE_INSTALL_PREFIX=${PREFIX}
BUILD_COMMAND cd zlib-ng && make
INSTALL_COMMAND ""
)
endif(ZLIBNG)
if (USE_HTSLIB)
message("using htslib")
ExternalProject_Add(htslib
PREFIX ${PROJECT_SOURCE_DIR}/ext/htslib
SOURCE_DIR ${PROJECT_SOURCE_DIR}/ext/htslib
BUILD_IN_SOURCE 1
CONFIGURE_COMMAND ""
BUILD_COMMAND make lib-static
INSTALL_COMMAND ""
)
else()
set(NO_HTSLIB "ON")
add_compile_definitions("NO_HTSLIB=ON")
message("not using htslib")
endif()