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.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")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -Wall -O2 -std=c99")
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_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 STATIC ${slow5_} ${slow5_idx} ${slow5_misc} ${slow5_press})
#else()
# message( STATUS "libslow5 will create a shared lib" )
add_library(slow5 SHARED ${slow5_} ${slow5_idx} ${slow5_misc} ${slow5_press})
#endif(SLOW5_LINK_STATIC)
#unset(SLOW5_LINK_STATIC CACHE)
set_target_properties(slow5 PROPERTIES
SOVERSION 0
)
target_link_libraries(slow5_static)
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}
)
|