-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
272 lines (229 loc) · 9.88 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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
CMAKE_MINIMUM_REQUIRED( VERSION 2.8 )
SET (CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/")
# Use GCC
# SET( CMAKE_CXX_COMPILER g++-mp-4.7 )
# When Clang is ready
#SET( CMAKE_CXX_COMPILER /opt/local/bin/clang++)
MESSAGE( STATUS "Building in ${BUILDENV} Environment" )
Project( Parana2 )
IF (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
MESSAGE ("-- Detected OSX")
SET (OperatingSystem "Mac OS X")
SET (SHARED_LIB_EXT "dylib")
ELSEIF (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
MESSAGE ("-- Detected Linux")
SET (OperatingSystem "Linux")
SET (SHARED_LIB_EXT "so")
ELSE ()
MESSAGE ("WHAT's THE OS? ${CMAKE_SYSTEM_NAME}")
ENDIF()
SET(CMAKE_VERBOSE_MAKEFILE ON)
SET( CMAKE_BUILD_TYPE Release)
SET( CMAKE_CXX_FLAGS "-g -O3 -DBOOST_HAS_HASH -DHAVE_ANSI_TERM -DNDEBUG -arch x86_64 -std=c++11 -Wl,-no_pie -Wno-deprecated ${CMAKE_CXX_FLAGS}")
# When Clang is ready
#SET( CMAKE_CXX_FLAGS "-O3 -g -std=c++11 -stdlib=libstdc++ ${CMAKE_CXX_FLAGS}")
FIND_PACKAGE( Boost 1.54 COMPONENTS regex program_options filesystem timer chrono system regex)
SET( PROJECT_ROOT ${CMAKE_CURRENT_SOURCE_DIR} )
SET( CMAKE_INSTALL_PREFIX "." )
SET( EXECUTABLE_OUTPUT_PATH ${PROJECT_ROOT}/build/bin )
SET( EXTERNAL_INSTALL_DIR ${CMAKE_CURRENT_SOURCE_DIR}/external/install)
## Look for GMP ##
FIND_PACKAGE (GMP)
IF (GMP_FOUND)
MESSAGE ("-- found GMP.")
ELSE()
SET (FETCH_GMP TRUE)
MESSAGE ("-- couldn't find GMP; fetching from internet")
SET(GMP_LIBRARY ${EXTERNAL_INSTALL_DIR}/lib/libgmp.${SHARED_LIB_EXT})
ENDIF()
## Look for MPFR ##
FIND_PACKAGE (MPFR)
IF (MPFR_FOUND)
MESSAGE ("-- found MPFR.")
ELSE()
SET (FETCH_MPFR TRUE)
MESSAGE ("-- couldn't find MPFR; fetching from internet")
SET(MPFR_LIBRARY ${EXTERNAL_INSTALL_DIR}/lib/libmpfr.${SHARED_LIB_EXT})
ENDIF()
## Look for CLN ##
FIND_PACKAGE (CLN)
IF (CLN_FOUND)
MESSAGE ("-- found CLN.")
ELSE()
SET (FETCH_CLN TRUE)
MESSAGE ("-- couldn't find CLN; fetching from internet")
SET(CLN_LIBRARY ${EXTERNAL_INSTALL_DIR}/lib/libcln.${SHARED_LIB_EXT})
ENDIF()
## Look for PUGIXML ##
FIND_LIBRARY ( PUGIXML_LIBRARY NAMES pugixml HINTS ${LINK_DIRECTORIES})
FIND_PATH ( PUGIXML_INCLUDE_DIR pugixml.hpp HINTS ${INCLUDE_DIRECTORIES} PATH_SUFFIXES pugixml )
## Look for Bio++ ##
FIND_LIBRARY( BPP_CORE_LIBRARY NAMES bpp-core HINTS ${LINK_DIRECTORIES})
FIND_PATH (BPP_CORE_INCLUDE_DIR BppString.h HINTS ${INCLUDE_DIRECTORIES} PATH_SUFFIXES Bpp)
FIND_LIBRARY( BPP_PHYL_LIBRARY NAMES bpp-phyl HINTS ${LINK_DIRECTORIES})
FIND_PATH (BPP_PHYL_INCLUDE_DIR Tree.h HINTS ${INCLUDE_DIRECTORIES} PATH_SUFFIXES Bpp/Phyl)
FIND_LIBRARY( BPP_SEQ_LIBRARY NAMES bpp-seq HINTS ${LINK_DIRECTORIES})
FIND_PATH (BPP_SEQ_INCLUDE_DIR Sequence.h HINTS ${INCLUDE_DIRECTORIES} PATH_SUFFIXES Bpp/Seq)
IF (BPP_CORE_LIBRARY-NOTFOUND OR BPP_CORE_INCLUDE_DIR-NOTFOUND OR
BPP_PHYL_LIBRARY-NOTFOUND OR BPP_PHYL_INCLUDE_DIR-NOTFOUND OR
BPP_SEQ_LIBRARY-NOTFOUND OR BPP_SEQ_INCLUDE_DIR-NOTFOUND )
MESSAGE ("-- couldn't find Bio++; fetching from the internet")
SET (FETCH_BPP TRUE)
SET(BPP_CORE_LIBRARY ${EXTERNAL_INSTALL_DIR}/lib/libbpp-core.${SHARED_LIB_EXT})
SET(BPP_PHYL_LIBRARY ${EXTERNAL_INSTALL_DIR}/lib/libbpp-phyl.${SHARED_LIB_EXT})
SET(BPP_SEQ_LIBRARY ${EXTERNAL_INSTALL_DIR}/lib/libbpp-seq.${SHARED_LIB_EXT})
ELSE()
MESSAGE ("-- found Bio++.")
ENDIF()
########
##
# Fetching of external dependencies
##
########
INCLUDE (ExternalProject)
IF (PUGIXML_LIBRARY-NOTFOUND OR PUGIXML_INCLUDE_DIR-NOTFOUND )
MESSAGE("-- Did not find pugixml library and heades")
SET(FETCH_PUGIXML TRUE)
SET(PUGIXML_LIBRARY ${EXTERNAL_INSTALL_DIR}/lib/libpugixml.a)
ELSE()
MESSAGE("-- Found pugiXML library and headers (lib = ${PUGIXML_LIBRARY})")
ENDIF()
IF (FETCH_PUGIXML)
EXTERNALPROJECT_ADD(
pugixml_proj
URL http://pugixml.googlecode.com/files/pugixml-1.2.zip
DOWNLOAD_DIR ${CMAKE_CURRENT_SOURCE_DIR}/external
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/external/pugixml
BINARY_DIR ${CMAKE_CURRENT_SOURCE_DIR}/external/pugixml/build
INSTALL_DIR ${CMAKE_CURRENT_SOURCE_DIR}/external/install
PATCH_COMMAND sh -c "mkdir -p <SOURCE_DIR>/build && cp <SOURCE_DIR>/scripts/CMakeLists.txt <SOURCE_DIR>"
CMAKE_ARGS -DCMAKE_CXX_COMPILER=g++ -DBUILD_SHARED_LIBS=ON -DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR>
BUILD_COMMAND sh -c "make"
INSTALL_COMMAND sh -c "mkdir -p <INSTALL_DIR>/include && cp <SOURCE_DIR>/src/*.hpp <INSTALL_DIR>/include"
BUILD_IN_SOURCE 0
)
ENDIF()
IF (FETCH_GMP)
EXTERNALPROJECT_ADD(
gmp_proj
URL ftp://ftp.gnu.org/gnu/gmp/gmp-5.1.2.tar.bz2
DOWNLOAD_DIR ${CMAKE_CURRENT_SOURCE_DIR}/external
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/external/gmp
BINARY_DIR ${CMAKE_CURRENT_SOURCE_DIR}/external/gmp
INSTALL_DIR ${CMAKE_CURRENT_SOURCE_DIR}/external/install
CONFIGURE_COMMAND sh -c "CC=g++ CXX=g++ ./configure --prefix=<INSTALL_DIR>"
BUILD_COMMAND sh -c "make -j4"
INSTALL_COMMAND sh -c "make install"
)
ENDIF()
IF (FETCH_MPFR)
## If we fetched GMP, use the one we fetched
IF (FETCH_GMP)
SET (GMP_INSTALL_DIR ${CMAKE_CURRENT_SOURCE_DIR}/external/install)
SET (MPFR_CONFIGURE_STRING "CC=g++ CXX=g++ ./configure --prefix=${GMP_INSTALL_DIR} --with-gmp=${GMP_INSTALL_DIR}")
ELSE() # Otherwise use the system GMP
SET (MPFR_CONFIGURE_STRING "CC=g++ CXX=g++ ./configure --prefix=${CMAKE_CURRENT_SOURCE_DIR}/external/install")
ENDIF()
EXTERNALPROJECT_ADD(
mpfr_proj
URL http://www.mpfr.org/mpfr-current/mpfr-3.1.2.tar.bz2
DOWNLOAD_DIR ${CMAKE_CURRENT_SOURCE_DIR}/external
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/external/mpfr
BINARY_DIR ${CMAKE_CURRENT_SOURCE_DIR}/external/mpfr
INSTALL_DIR ${CMAKE_CURRENT_SOURCE_DIR}/external/install
CONFIGURE_COMMAND sh -c ${MPFR_CONFIGURE_STRING}
BUILD_COMMAND sh -c "make -j4"
INSTALL_COMMAND sh -c "make install"
)
ENDIF()
IF (FETCH_CLN)
## If we fetched GMP, use the one we fetched
IF (FETCH_GMP)
SET (GMP_INSTALL_DIR ${CMAKE_CURRENT_SOURCE_DIR}/external/install)
SET (CLN_CONFIGURE_STRING "CC=g++ CXX=g++ ./configure --prefix=${GMP_INSTALL_DIR} --with-gmp=${GMP_INSTALL_DIR}")
ELSE() # Otherwise use the system GMP
SET (CLN_CONFIGURE_STRING "CC=g++ CXX=g++ ./configure --prefix=${CMAKE_CURRENT_SOURCE_DIR}/external/install")
ENDIF()
EXTERNALPROJECT_ADD(
cln_proj
URL http://www.ginac.de/CLN/cln-1.3.3.tar.bz2
DOWNLOAD_DIR ${CMAKE_CURRENT_SOURCE_DIR}/external
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/external/cln
BINARY_DIR ${CMAKE_CURRENT_SOURCE_DIR}/external/cln
INSTALL_DIR ${CMAKE_CURRENT_SOURCE_DIR}/external/install
CONFIGURE_COMMAND sh -c ${MPFR_CONFIGURE_STRING}
BUILD_COMMAND sh -c "make -j4"
INSTALL_COMMAND sh -c "make install"
)
ENDIF()
IF (FETCH_BPP)
EXTERNALPROJECT_ADD(
bpp_core_proj
URL http://biopp.univ-montp2.fr/repos/sources/bpp-core-2.1.0.tar.gz
DOWNLOAD_DIR ${CMAKE_CURRENT_SOURCE_DIR}/external
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/external/bpp-core
BINARY_DIR ${CMAKE_CURRENT_SOURCE_DIR}/external/bpp-core/build
INSTALL_DIR ${CMAKE_CURRENT_SOURCE_DIR}/external/install
PATCH_COMMAND sh -c "mkdir -p <BINARY_DIR>"
CMAKE_ARGS -DCMAKE_CXX_COMPILER=g++ -DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR>
BUILD_COMMAND sh -c "make -j4"
INSTALL_COMMAND sh -c "make install"
BUILD_IN_SOURCE 0
)
EXTERNALPROJECT_ADD(
bpp_seq_proj
DEPENDS bpp_core_proj
URL http://biopp.univ-montp2.fr/repos/sources/bpp-seq-2.1.0.tar.gz
DOWNLOAD_DIR ${CMAKE_CURRENT_SOURCE_DIR}/external
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/external/bpp-seq
BINARY_DIR ${CMAKE_CURRENT_SOURCE_DIR}/external/bpp-seq/build
INSTALL_DIR ${CMAKE_CURRENT_SOURCE_DIR}/external/install
PATCH_COMMAND sh -c "mkdir -p <BINARY_DIR>"
CMAKE_ARGS -Dbpp-core_INCLUDE_DIR=<INSTALL_DIR>/include -Dbpp-core_LIBRARY=<INSTALL_DIR>/lib/libbpp-core.${SHARED_LIB_EXT}
-DCMAKE_CXX_COMPILER=g++ -DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR>
BUILD_COMMAND sh -c "make -j4"
INSTALL_COMMAND sh -c "make install"
BUILD_IN_SOURCE 0
)
EXTERNALPROJECT_ADD(
bpp_phyl_proj
DEPENDS bpp_seq_proj
URL http://biopp.univ-montp2.fr/repos/sources/bpp-phyl-2.1.0.tar.gz
DOWNLOAD_DIR ${CMAKE_CURRENT_SOURCE_DIR}/external
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/external/bpp-phyl
BINARY_DIR ${CMAKE_CURRENT_SOURCE_DIR}/external/bpp-phyl/build
INSTALL_DIR ${CMAKE_CURRENT_SOURCE_DIR}/external/install
PATCH_COMMAND sh -c "mkdir -p <BINARY_DIR>"
CMAKE_ARGS -Dbpp-core_INCLUDE_DIR=<INSTALL_DIR>/include -Dbpp-core_LIBRARY=<INSTALL_DIR>/lib/libbpp-core.${SHARED_LIB_EXT}
-Dbpp-seq_INCLUDE_DIR=<INSTALL_DIR>/include -Dbpp-seq_LIBRARY=<INSTALL_DIR>/lib/libbpp-seq.${SHARED_LIB_EXT}
-DCMAKE_CXX_COMPILER=g++ -DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR>
BUILD_COMMAND sh -c "make -j4"
INSTALL_COMMAND sh -c "make install"
BUILD_IN_SOURCE 0
)
ENDIF()
########
##
# END: Fetching of external dependencies
##
########
SUBDIRS( src )
set(CPACK_SET_DESTDIR ON)
set(CPACK_BUNDLE_NAME "Parana2")
set(CPACK_BUNDLE_IDENTIFIER "edu.cmu.cs.parana2")
SET(CPACK_PACKAGING_INSTALL_PREFIX ".")
SET(CPACK_PACKAGE_DEFAULT_LOCATION "${CPACK_PACKAGE_NAME}")
set(CPACK_PACKAGE_EXECUTABLES "parana2" "Parana2")
set(CPACK_PACKAGE_NAME "Parana2")
set(CPACK_PACKAGE_VENDOR "Robert Patro & Carl Kingsford; Carnegie Mellon University")
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Network history infernce via a sum over parsimonious histories")
set(CPACK_PACKAGE_VERSION_MAJOR "1")
set(CPACK_PACKAGE_VERSION_MINOR "0")
set(CPACK_PACKAGE_VERSION_PATCH "0")
set(CPACK_SOURCE_GENERATOR "TBZ2")
SET(CPACK_PACKAGE_INSTALL_DIRECTORY "CMake ${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}")
set(CPACK_SOURCE_PACKAGE_FILE_NAME
"${CMAKE_PROJECT_NAME}-${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}-src")
set(CPACK_SOURCE_IGNORE_FILES
"/doc/;/.git/;.gitignore;/build/;/.bzr/;~$;${CPACK_SOURCE_IGNORE_FILES}")
INCLUDE( CPack )