forked from BioPP/bppsuite
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
126 lines (106 loc) · 4.03 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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
# CMake script for Bio++ Program Suite
# Authors:
# Julien Dutheil
# Francois Gindraud (2017)
# Created: 22/08/2009
cmake_minimum_required (VERSION 2.8.11)
project (bppsuite CXX)
# Compile options
SET (CMAKE_CXX_FLAGS "-std=c++11 -Wall -Weffc++ -Wshadow -Wconversion")
IF(NOT CMAKE_BUILD_TYPE)
SET(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING
"Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel."
FORCE)
ENDIF(NOT CMAKE_BUILD_TYPE)
IF(NOT NO_DEP_CHECK)
SET(NO_DEP_CHECK FALSE CACHE BOOL
"Disable dependencies check for building distribution only."
FORCE)
ENDIF(NOT NO_DEP_CHECK)
IF(NO_DEP_CHECK)
MESSAGE(STATUS "Dependencies checking disabled. Only distribution can be built.")
ELSE(NO_DEP_CHECK)
#static linkage?
IF(NOT BUILD_STATIC)
SET(BUILD_STATIC FALSE CACHE BOOL
"Enable static linkage."
FORCE)
ENDIF()
IF(BUILD_STATIC)
MESSAGE(STATUS "Static linkage requested.")
SET(CMAKE_CXX_FLAGS "-static -static-libgcc ${CMAKE_CXX_FLAGS}")
ENDIF()
# Check compression program
# COMPRESS_PROGRAM controls the choice of program
# COMPRESS_EXT can be used to override the file extension
if (NOT COMPRESS_PROGRAM)
set (COMPRESS_PROGRAM gzip CACHE STRING "Set program for compressing documentation" FORCE)
endif ()
find_program (COMPRESS_BIN NAMES ${COMPRESS_PROGRAM} DOC "${COMPRESS_PROGRAM} compression program")
if (NOT COMPRESS_BIN)
message (STATUS "${COMPRESS_PROGRAM} program not found, text doc will not be compressed")
else ()
# Deduce COMPRESS_EXT for known compression programs if not set
if (NOT COMPRESS_EXT)
if (${COMPRESS_PROGRAM} STREQUAL "gzip")
set (COMPRESS_EXT "gz")
elseif (${COMPRESS_PROGRAM} STREQUAL "bzip2")
set (COMPRESS_EXT "bz2")
else ()
set (COMPRESS_EXT "${COMPRESS_PROGRAM}") # Default: program name (works for xz/lzma)
endif ()
endif ()
# Generate command line args (always add -c to output compressed file to stdout)
if (${COMPRESS_PROGRAM} STREQUAL "gzip")
# -n for no timestamp in files (reproducible builds)
# -9 for maximum compression (lintian error)
set (COMPRESS_ARGS -c -n -9)
else ()
set (COMPRESS_ARGS -c)
endif ()
message (STATUS "Found ${COMPRESS_BIN} compression program, using file extension .${COMPRESS_EXT}")
endif ()
# Find dependencies (add install directory to search)
if (CMAKE_INSTALL_PREFIX)
set (CMAKE_PREFIX_PATH "${CMAKE_INSTALL_PREFIX}" ${CMAKE_PREFIX_PATH})
endif (CMAKE_INSTALL_PREFIX)
include (GNUInstallDirs)
find_package (bpp-phyl 12.0.0 REQUIRED)
find_package (bpp-popgen 8.0.0 REQUIRED)
# Subdirectories
add_subdirectory (bppSuite)
add_subdirectory (doc)
add_subdirectory (man)
ENDIF(NO_DEP_CHECK)
# Packager
SET(CPACK_PACKAGE_NAME "bppsuite")
SET(CPACK_PACKAGE_VENDOR "Bio++ Development Team")
SET(CPACK_PACKAGE_VERSION "2.4.1")
SET(CPACK_PACKAGE_VERSION_MAJOR "2")
SET(CPACK_PACKAGE_VERSION_MINOR "4")
SET(CPACK_PACKAGE_VERSION_PATCH "1")
SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "The Bio++ Program Suite")
SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/COPYING.txt")
SET(CPACK_RESOURCE_FILE_AUTHORS "${CMAKE_SOURCE_DIR}/AUTHORS.txt")
SET(CPACK_RESOURCE_FILE_INSTALL "${CMAKE_SOURCE_DIR}/INSTALL.txt")
SET(CPACK_SOURCE_GENERATOR "TGZ")
# /!\ This assumes that an external build is used
SET(CPACK_SOURCE_IGNORE_FILES
"/build/"
"/\\\\.git/"
"/\\\\.gitignore"
${CPACK_SOURCE_IGNORE_FILES}
)
SET(CPACK_SOURCE_PACKAGE_FILE_NAME "${CMAKE_PROJECT_NAME}-${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}")
SET(CPACK_DEBSOURCE_PACKAGE_FILE_NAME "${CMAKE_PROJECT_NAME}_${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}.orig")
INCLUDE(CPack)
#This adds the 'dist' target
ADD_CUSTOM_TARGET(dist COMMAND ${CMAKE_MAKE_PROGRAM} package_source)
IF(NOT NO_DEP_CHECK)
IF (UNIX)
#This creates rpm packages:
ADD_CUSTOM_TARGET(rpm rpmbuild -ta ${CPACK_SOURCE_PACKAGE_FILE_NAME}.tar.gz)
ADD_DEPENDENCIES(rpm dist info man)
#ADD_DEPENDENCIES(info install)
ENDIF(UNIX)
ENDIF(NOT NO_DEP_CHECK)