CMakeLists.txt 6.18 KB
Newer Older
1
cmake_minimum_required(VERSION 3.0)
Dr. Carsten Kemena's avatar
Dr. Carsten Kemena committed
2

Dr. Carsten Kemena's avatar
Dr. Carsten Kemena committed
3
# onec cmake 3 will be used
4 5
#set(CMAKE_CXX_STANDARD 11)
#set(CMAKE_CXX_STANDARD_REQUIRED ON)
Dr. Carsten Kemena's avatar
Dr. Carsten Kemena committed
6

Dr. Carsten Kemena's avatar
Dr. Carsten Kemena committed
7
add_compile_options(-std=c++17)
Dr. Carsten Kemena's avatar
Dr. Carsten Kemena committed
8 9

project (BioSeqDataLib_TESTS CXX)
10 11 12
SET(MAJOR_VERSION 1)
SET(MINOR_VERSION 0)
SET(PATCH_VERSION 0)
Dr. Carsten Kemena's avatar
Dr. Carsten Kemena committed
13

Dr. Carsten Kemena's avatar
Dr. Carsten Kemena committed
14
SET(CMAKE_CXX_FLAGS_COVERAGE
15
    "-g -O0 --coverage -fprofile-arcs -ftest-coverage -fno-inline -fno-inline-small-functions -fno-default-inline -pedantic -Wall -Wextra" # -Wcast-align -Wcast-qual -Wctor-dtor-privacy -Wdisabled-optimization -Wformat=2 -Winit-self -Wlogical-op -Wmissing-declarations -Wmissing-include-dirs -Wnoexcept -Wold-style-cast -Woverloaded-virtual -Wredundant-decls -Wshadow -Wsign-conversion -Wsign-promo -Wstrict-null-sentinel -Wstrict-overflow=5 -Wswitch-default -Wundef -Werror -Wno-unused"
Dr. Carsten Kemena's avatar
Dr. Carsten Kemena committed
16 17
    CACHE STRING "Flags used by the C++ compiler during coverage builds."
    FORCE )
Dr. Carsten Kemena's avatar
Dr. Carsten Kemena committed
18
SET(CMAKE_C_FLAGS_COVERAGE
19
    "-g -O0 --coverage -fprofile-arcs -ftest-coverage -fno-inline -fno-inline-small-functions -fno-default-inline -pedantic -Wall -Wextra" # -Wcast-align -Wcast-qual -Wctor-dtor-privacy -Wdisabled-optimization -Wformat=2 -Winit-self -Wlogical-op -Wmissing-declarations -Wmissing-include-dirs -Wnoexcept -Wold-style-cast -Woverloaded-virtual -Wredundant-decls -Wshadow -Wsign-conversion -Wsign-promo -Wstrict-null-sentinel -Wstrict-overflow=5 -Wswitch-default -Wundef -Werror -Wno-unused"
Dr. Carsten Kemena's avatar
Dr. Carsten Kemena committed
20 21 22 23 24 25 26 27 28 29 30 31
    CACHE STRING "Flags used by the C compiler during coverage builds."
    FORCE )
SET(CMAKE_EXE_LINKER_FLAGS_COVERAGE
    "--coverage"
    CACHE STRING "Flags used for linking binaries during coverage builds."
    FORCE )
SET(CMAKE_SHARED_LINKER_FLAGS_COVERAGE
    "--coverage"
    CACHE STRING "Flags used by the shared libraries linker during coverage builds."
    FORCE )
MARK_AS_ADVANCED(
    CMAKE_CXX_FLAGS_COVERAGE
Dr. Carsten Kemena's avatar
Dr. Carsten Kemena committed
32
  #  CMAKE_C_FLAGS_COVERAGE
Dr. Carsten Kemena's avatar
Dr. Carsten Kemena committed
33 34 35 36
    CMAKE_EXE_LINKER_FLAGS_COVERAGE
    CMAKE_SHARED_LINKER_FLAGS_COVERAGE )


Dr. Carsten Kemena's avatar
Dr. Carsten Kemena committed
37 38

if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
39
	set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Weverything -Wno-padded -Wno-c++98-compat -fcomment-block-commands=file")
Dr. Carsten Kemena's avatar
Dr. Carsten Kemena committed
40 41 42
endif ()

if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
43
	set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -pedantic -Wextra -Wunused -Wold-style-cast")# -Wcast-align -Wcast-qual -Wctor-dtor-privacy -Wdisabled-optimization -Wformat=2 -Winit-self -Wlogical-op -Wmissing-declarations -Wmissing-include-dirs -Wnoexcept -Wold-style-cast -Woverloaded-virtual -Wredundant-decls -Wsign-conversion -Wsign-promo -Wstrict-null-sentinel -Wstrict-overflow=5 -Wswitch-default -Wundef -Werror -Wno-unused")
Dr. Carsten Kemena's avatar
Dr. Carsten Kemena committed
44 45
endif ()
#message(${CMAKE_CXX_FLAGS})
46
#-Wshadow
Dr. Carsten Kemena's avatar
Dr. Carsten Kemena committed
47 48


Dr. Carsten Kemena's avatar
Dr. Carsten Kemena committed
49 50 51 52 53 54
if( NOT CMAKE_BUILD_TYPE )
  set( CMAKE_BUILD_TYPE Release CACHE STRING
       "Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel." FORCE )
endif()


Dr. Carsten Kemena's avatar
Dr. Carsten Kemena committed
55

Dr. Carsten Kemena's avatar
Dr. Carsten Kemena committed
56 57 58 59 60 61 62 63 64
FUNCTION(PREPEND var prefix)
   SET(listVar "")
   FOREACH(f ${ARGN})
      LIST(APPEND listVar "${prefix}/${f}")
   ENDFOREACH(f)
   SET(${var} "${listVar}" PARENT_SCOPE)
ENDFUNCTION(PREPEND)


Dr. Carsten Kemena's avatar
Dr. Carsten Kemena committed
65 66 67

# To run in debug mode -DCMAKE_BUILD_TYPE=Debug

Dr. Carsten Kemena's avatar
Dr. Carsten Kemena committed
68
if (WITH_UNIT_TEST)
Dr. Carsten Kemena's avatar
Dr. Carsten Kemena committed
69
	FIND_PACKAGE(Boost 1.65 COMPONENTS system filesystem iostreams unit_test_framework REQUIRED)
Dr. Carsten Kemena's avatar
Dr. Carsten Kemena committed
70
else (WITH_UNIT_TEST)
Dr. Carsten Kemena's avatar
Dr. Carsten Kemena committed
71
	FIND_PACKAGE(Boost 1.65 COMPONENTS system filesystem iostreams REQUIRED)
Dr. Carsten Kemena's avatar
Dr. Carsten Kemena committed
72
endif(WITH_UNIT_TEST)
Dr. Carsten Kemena's avatar
Dr. Carsten Kemena committed
73 74 75 76
INCLUDE_DIRECTORIES(SYSTEM ${Boost_INCLUDE_DIR})
link_directories(${Boost_LIBRARY_DIRS})
ADD_DEFINITIONS( "-DHAS_BOOST" )

Dr. Carsten Kemena's avatar
Dr. Carsten Kemena committed
77 78
# The cluster module
set(clusterCPP ClusterSet.cpp IOStrategies/PfamCReader.cpp IOStrategies/BasicClusterReader.cpp)
Dr. Carsten Kemena's avatar
Dr. Carsten Kemena committed
79
PREPEND(clusterCPP "${CMAKE_CURRENT_SOURCE_DIR}/src/cluster" ${clusterCPP})
Dr. Carsten Kemena's avatar
Dr. Carsten Kemena committed
80

Dr. Carsten Kemena's avatar
Dr. Carsten Kemena committed
81
# The annotation module
82
set(annotationCPP Feature.cpp BlastHit.cpp FeatureSet.cpp OrthologySet.cpp)
Dr. Carsten Kemena's avatar
Dr. Carsten Kemena committed
83 84
PREPEND(annotationCPP "${CMAKE_CURRENT_SOURCE_DIR}/src/annotation" ${annotationCPP})

85 86 87 88
# The sequence module
set(sequenceCPP SeqFunctions.cpp)
PREPEND(sequenceCPP "${CMAKE_CURRENT_SOURCE_DIR}/src/sequence" ${sequenceCPP})

89
# The domain module
90
set(domainCPP Domain.cpp DomainExt.cpp PfamDomain.cpp SFDomain.cpp DomainArrangementSet.cpp DomainArrangement.cpp InterProXMLReader.cpp)
91 92
PREPEND(domainCPP "${CMAKE_CURRENT_SOURCE_DIR}/src/domain" ${domainCPP})

93
# external_interfaces module
94
set(external_interfacesCPP runPhylo.cpp runDBsearch.cpp EI_Manager.cpp DP_Manager.cpp)
95
PREPEND(external_interfacesCPP "${CMAKE_CURRENT_SOURCE_DIR}/src/external_interfaces" ${external_interfacesCPP})
Dr. Carsten Kemena's avatar
Dr. Carsten Kemena committed
96 97

# phylogeny module
Dr. Carsten Kemena's avatar
Dr. Carsten Kemena committed
98
set(phylogenyCPP PhylogeneticTree.cpp fitch.cpp dollo.cpp)
Dr. Carsten Kemena's avatar
Dr. Carsten Kemena committed
99 100 101
PREPEND(phylogenyCPP "${CMAKE_CURRENT_SOURCE_DIR}/src/phylogeny" ${phylogenyCPP})

# utility module
Dr. Carsten Kemena's avatar
Dr. Carsten Kemena committed
102
set(utilityCPP algorithm.cpp TwoValues.cpp DSM.cpp stringHelpers.cpp properties.cpp utility.cpp Settings.cpp Input.cpp Output.cpp)
Dr. Carsten Kemena's avatar
Dr. Carsten Kemena committed
103 104
PREPEND(utilityCPP "${CMAKE_CURRENT_SOURCE_DIR}/src/utility" ${utilityCPP})

Dr. Carsten Kemena's avatar
Dr. Carsten Kemena committed
105
#draw module
106
set(drawCPP SVG_Drawer.cpp DA_drawer.cpp)
Dr. Carsten Kemena's avatar
Dr. Carsten Kemena committed
107
PREPEND(drawCPP "${CMAKE_CURRENT_SOURCE_DIR}/src/draw" ${drawCPP})
Dr. Carsten Kemena's avatar
Dr. Carsten Kemena committed
108

Dr. Carsten Kemena's avatar
Dr. Carsten Kemena committed
109
set(bioCPP Alphabet.cpp GeneticCode.cpp)
110 111 112
PREPEND(bioCPP "${CMAKE_CURRENT_SOURCE_DIR}/src/bio" ${bioCPP})

set(SOURCE_FILES ${bioCPP} ${clusterCPP} ${sequenceCPP} ${annotationCPP} ${external_interfacesCPP} ${phylogenyCPP} ${utilityCPP} ${domainCPP} ${drawCPP})
Dr. Carsten Kemena's avatar
Dr. Carsten Kemena committed
113 114 115 116
IF (CURL_FOUND)
	set(SOURCE_FILES ${SOURCE_FILES} ${webserviceCPP})
ENDIF(CURL_FOUND)

Dr. Carsten Kemena's avatar
Dr. Carsten Kemena committed
117 118

add_library(BioSeqDataLib SHARED ${SOURCE_FILES})
Dr. Carsten Kemena's avatar
Dr. Carsten Kemena committed
119
set_target_properties (BioSeqDataLib PROPERTIES VERSION ${MAJOR_VERSION}.${MINOR_VERSION}.${PATCH_VERSION})
Dr. Carsten Kemena's avatar
Dr. Carsten Kemena committed
120
target_link_libraries(BioSeqDataLib ${Boost_LIBRARIES}  ${CURL_LIBRARIES})
Dr. Carsten Kemena's avatar
Dr. Carsten Kemena committed
121 122 123 124 125 126 127 128 129 130 131 132 133 134


INSTALL(TARGETS BioSeqDataLib
	DESTINATION "lib"
)

install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/src/ DESTINATION include/BioSeqDataLib
	FILES_MATCHING PATTERN "*.hpp"
	PATTERN ${CMAKE_CURRENT_SOURCE_DIR}/src/documentation.hpp EXCLUDE
)

if (WITH_UNIT_TEST)
	add_subdirectory (tests)
	enable_testing ()
Dr. Carsten Kemena's avatar
Dr. Carsten Kemena committed
135
	add_test (NAME domainTest COMMAND domain_tests)
Dr. Carsten Kemena's avatar
Dr. Carsten Kemena committed
136
    add_test (NAME SequenceTest COMMAND sequence_tests)
137
    add_test (NAME BioTest COMMAND bio_tests)
Dr. Carsten Kemena's avatar
Dr. Carsten Kemena committed
138
    add_test (NAME ClusterTest COMMAND cluster_tests)
Dr. Carsten Kemena's avatar
Dr. Carsten Kemena committed
139 140 141
	add_test (NAME PhylogenyTest COMMAND phylogeny_tests)
	add_test (NAME AnnotationTest COMMAND annotation_tests)
	add_test (NAME AlignTest COMMAND align_tests)
142
	add_test (NAME external_interfacesTest COMMAND external_interfaces_tests)
Dr. Carsten Kemena's avatar
Dr. Carsten Kemena committed
143 144
    add_test (NAME UtilityTest COMMAND utility_tests)
    add_test (NAME DrawTest COMMAND draw_tests)
Dr. Carsten Kemena's avatar
Dr. Carsten Kemena committed
145
endif ()