-
Notifications
You must be signed in to change notification settings - Fork 15
/
CMakeLists.txt
85 lines (68 loc) · 3.02 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
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
PROJECT(ale CXX)
SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
add_definitions(-std=c++11)
IF(NOT NO_VIRTUAL_COV)
SET(NO_VIRTUAL_COV FALSE CACHE BOOL
"Disable covariant return type with virtual inheritance, for compilers that do not support it."
FORCE)
ENDIF(NOT NO_VIRTUAL_COV)
IF(NO_VIRTUAL_COV)
MESSAGE("-- Covariant return with virtual inheritance disabled.")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DNO_VIRTUAL_COV=1")
ENDIF(NO_VIRTUAL_COV)
option(BUILD_STATIC "Build a static binary" ON)
IF(NOT CMAKE_CONFIGURATION_TYPES AND NOT CMAKE_BUILD_TYPE)
SET(CMAKE_BUILD_TYPE Distribution)
ENDIF(NOT CMAKE_CONFIGURATION_TYPES AND NOT CMAKE_BUILD_TYPE)
SET(CMAKE_CXX_FLAGS_DEBUG "-g -Wall -Weffc++ -Wshadow")
SET(CMAKE_C_FLAGS_DEBUG "-g -Wall -Weffc++ -Wshadow")
SET(CMAKE_CXX_FLAGS_RELEASE "-O3 -Wall -Weffc++ -Wshadow -DNDEBUG")
SET(CMAKE_C_FLAGS_RELEASE "-O3 -Wall -Weffc++ -Wshadow -DNDEBUG")
SET(CMAKE_CXX_FLAGS_DISTRIBUTION "-O3 -w -DNDEBUG")
SET(CMAKE_C_FLAGS_DISTRIBUTION "-O3 -w -DNDEBUG")
#here is a useful function:
MACRO(IMPROVED_FIND_LIBRARY OUTPUT_LIBS lib_name include_to_find)
#start:
FIND_PATH(${lib_name}_INCLUDE_DIR ${include_to_find})
IF(${BUILD_STATIC})
SET(${lib_name}_NAMES lib${lib_name}.a)
ELSE(${BUILD_STATIC})
SET(${lib_name}_NAMES ${lib_name} ${lib_name}lib ${lib_name}dll)
ENDIF(${BUILD_STATIC})
FIND_LIBRARY(${lib_name}_LIBRARY NAMES ${${lib_name}_NAMES})
IF(${lib_name}_LIBRARY)
MESSAGE("-- Library ${lib_name} ${lib_type} found here:")
MESSAGE(" includes : ${${lib_name}_INCLUDE_DIR}")
MESSAGE(" library: ${${lib_name}_LIBRARY}")
ELSE(${lib_name}_LIBRARY)
MESSAGE(FATAL_ERROR "${lib_name} required but not found.")
ENDIF(${lib_name}_LIBRARY)
#add the dependency:
INCLUDE_DIRECTORIES(${${lib_name}_INCLUDE_DIR})
SET(${OUTPUT_LIBS} ${${OUTPUT_LIBS}} ${${lib_name}_LIBRARY})
ENDMACRO(IMPROVED_FIND_LIBRARY)
#Find the libraries. The order is very important for static linkage, it won't
#link if you change it!
IMPROVED_FIND_LIBRARY(BPP_LIBRARIES bpp-phyl Bpp/Phyl/Tree.h)
IMPROVED_FIND_LIBRARY(BPP_LIBRARIES bpp-seq Bpp/Seq/Alphabet/Alphabet.h)
IMPROVED_FIND_LIBRARY(BPP_LIBRARIES bpp-core Bpp/Clonable.h)
# Require MPI for this project:
find_package(MPI REQUIRED)
include_directories(${MPI_INCLUDE_PATH})
set(CMAKE_CXX_COMPILE_FLAGS "${CMAKE_CXX_COMPILE_FLAGS} ${MPI_COMPILE_FLAGS}")
set(CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_LINK_FLAGS} ${MPI_LINK_FLAGS}")
SET(Boost_USE_STATIC_LIBS ${BUILD_STATIC})
find_package(Boost COMPONENTS mpi serialization REQUIRED)
include_directories(${Boost_INCLUDE_DIRS})
# Require openMP for this project
include(FindOpenMP)
if(OPENMP_FOUND)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OpenMP_EXE_LINKER_FLAGS}")
else(OPENMP_FOUND)
message("ERROR: OpenMP could not be found on your system.")
endif(OPENMP_FOUND)
# Source Directory
add_subdirectory(src ${ALE_BINARY_DIR})