File: CMakeLists.txt

package info (click to toggle)
libslow5lib 1.3.1%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 25,280 kB
  • sloc: ansic: 13,123; python: 1,353; sh: 600; makefile: 98; cpp: 40
file content (109 lines) | stat: -rw-r--r-- 3,847 bytes parent folder | download
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
106
107
108
109
cmake_minimum_required(VERSION 3.5)

# choose the architecture
set(DEPLOY_PLATFORM x86)
# set_property(CACHE DEPLOY_PLATFORM PROPERTY STRINGS unknown x86 arm64-v8a armeabi-v7a)

project(slow5lib)

#set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -Wall -O2 -std=gnu99 -fopenmp")
IF (CMAKE_BUILD_TYPE STREQUAL "Debug")
    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -Wall -O0 -std=c99")
ELSEIF()
    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -Wall -O2 -std=c99")
ENDIF()

option(SLOW5_USE_ZSTD "Use ZSTD" OFF) #OFF by default
if(SLOW5_USE_ZSTD)
    add_compile_options("-DSLOW5_USE_ZSTD")
    link_libraries("-lzstd")
endif(SLOW5_USE_ZSTD)
unset(SLOW5_USE_ZSTD CACHE)

option(SLOW5_ENABLE_MT "Use SLOW5_ENABLE_MT" OFF) #OFF by default
if(SLOW5_ENABLE_MT)
    add_compile_options("-DSLOW5_ENABLE_MT")
    link_libraries("-lpthread")
    set(slow5_mt src/slow5_mt.c)
endif(SLOW5_ENABLE_MT)
unset(SLOW5_ENABLE_MT CACHE)

# option(SLOW5_USE_OPENMP "Use OPENMP" OFF) #OFF by default
# if(SLOW5_USE_OPENMP)
#     add_compile_options("-fopenmp")
#     link_libraries("-fopenmp")
# endif(SLOW5_USE_OPENMP)
# unset(SLOW5_USE_OPENMP CACHE)

# include_directories(${PROJECT_SOURCE_DIR}/src)
# include_directories(${PROJECT_SOURCE_DIR}/test)
# include_directories(${PROJECT_SOURCE_DIR}/include)

set(slow5_ src/slow5.c)
set(slow5_idx src/slow5_idx.c)
set(slow5_misc src/slow5_misc.c)
set(slow5_press src/slow5_press.c)

# example source files
# set(random_read examples/random_read.c)
# set(sequential_read examples/sequential_read.c)
# set(slow5_hdr_get examples/get_hdr_attribute.c)
# set(slow5_aux_get examples/get_aux_field.c)
# set(pthread_get_reads examples/random_read_pthreads.c)
# set(openmp_get_reads examples/random_read_openmp.c)
# add_executable(slow5exmp ${openmp_get_reads})


#option(SLOW5_LINK_STATIC "libslow5 will create a static lib" OFF) #OFF by default
#if(SLOW5_LINK_STATIC)
#    message( STATUS "libslow5 will create a static lib" )
#    add_library(slow5 STATIC ${slow5_} ${slow5_idx} ${slow5_misc} ${slow5_press} ${slow5_mt})
#else()
#    message( STATUS "libslow5 will create a shared lib" )
    add_library(slow5_static STATIC ${slow5_} ${slow5_idx} ${slow5_misc} ${slow5_press} ${slow5_mt})
    add_library(slow5 SHARED ${slow5_} ${slow5_idx} ${slow5_misc} ${slow5_press} ${slow5_mt})
#endif(SLOW5_LINK_STATIC)
#unset(SLOW5_LINK_STATIC CACHE)

set_target_properties(slow5 PROPERTIES
        SOVERSION 0
)

target_include_directories(slow5_static PUBLIC ${PROJECT_SOURCE_DIR}/include)
target_link_libraries(slow5_static)
target_include_directories(slow5 PUBLIC ${PROJECT_SOURCE_DIR}/include)
target_link_libraries(slow5)

set(slow5_targets slow5 slow5_static)

target_compile_definitions(slow5_static PUBLIC _GLIBCXX_DEBUG) # PUBLIC to maintain ABI compatibility
target_compile_definitions(slow5 PUBLIC _GLIBCXX_DEBUG) # PUBLIC to maintain ABI compatibility

target_include_directories(slow5_static PUBLIC include)
target_include_directories(slow5 PUBLIC include)

# Build a static lib
#add_library(slow5 STATIC ${slow5_} ${slow5_idx} ${slow5_misc} ${slow5_press})
#
# Build a shared lib
#
#just to get rid of Clion warnings
# file(GLOB_RECURSE C_SOURCES RELATIVE ${CMAKE_SOURCE_DIR} "test/*.c")
# add_executable(slow5test test/unit_test_two_rg.c) #run make test to test all tests in one go. this is mostly for debugging
#
#
# link with dependencies
# IF (${DEPLOY_PLATFORM} STREQUAL "x86")
#     target_link_libraries(slow5test slow5 streamvbyte_slow5 -lz -ldl -lm -lpthread -lrt)
#     target_link_libraries(slow5exmp slow5 streamvbyte_slow5 -lz -ldl -lm -lpthread -lrt)
# ELSE()
#     target_link_libraries(slow5test slow5 streamvbyte_slow5 -lz -ldl -lm)
#     target_link_libraries(slow5exmp slow5 streamvbyte_slow5 -lz -ldl -lm)
# ENDIF()

install (
  TARGETS slow5
  TARGETS slow5 slow5_static
  LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
)