-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
165 lines (142 loc) · 6.64 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
cmake_minimum_required (VERSION 2.6)
project (mpi_manager-project)
# The version number.
set (mpi_manager-project_VERSION_MAJOR 0)
set (mpi_manager-project_VERSION_MINOR 1)
set (mpi_manager-project_PATCH_LEVEL 0 )
# project options
OPTION( BUILD_SHARED_LIBS "Set to OFF to build static libraries" ON )
OPTION( INSTALL_DOC "Set to OFF to skip build/install Documentation" ON )
OPTION( BUILD_MISSING_DEPENDANCIES "Set to OFF to skip building missing dependencies (you might want to build the latest versions yourself)" ON )
OPTION( BUILD_COVERAGE "Set to ON to generate coverage information (make lcov)" OFF )
# Put the libaries and binaries that get built into directories at the
# top of the build tree rather than in hard-to-find leaf
# directories.
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/xlib)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
#include find modules
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/")
##########################################################################
# MAKE SOME EXTRA BUILD TYPES:
# MAINTAINER: with some extra warnings (only gcc)
# PROFILE: Profiling mode (only gcc)
###########################################################################
##########################################################################
# MAINTAINTER
##########################################################################
IF (CMAKE_COMPILER_IS_GNUCC)
SET( CMAKE_CXX_FLAGS_MAINTAINER "-Wall -Wabi" CACHE STRING
"Flags used by the C++ compiler during maintainer builds."
FORCE )
SET( CMAKE_C_FLAGS_MAINTAINER "-Wall -pedantic" CACHE STRING
"Flags used by the C compiler during maintainer builds."
FORCE )
SET( CMAKE_EXE_LINKER_FLAGS_MAINTAINER
"-Wl,--warn-unresolved-symbols,--warn-once" CACHE STRING
"Flags used for linking binaries during maintainer builds."
FORCE )
SET( CMAKE_SHARED_LINKER_FLAGS_MAINTAINER
"-Wl,--warn-unresolved-symbols,--warn-once" CACHE STRING
"Flags used by the shared libraries linker during maintainer builds."
FORCE )
MARK_AS_ADVANCED(
CMAKE_CXX_FLAGS_MAINTAINER
CMAKE_C_FLAGS_MAINTAINER
CMAKE_EXE_LINKER_FLAGS_MAINTAINER
CMAKE_SHARED_LINKER_FLAGS_MAINTAINER )
# Update the documentation string of CMAKE_BUILD_TYPE for GUIs
SET( CMAKE_BUILD_TYPE "${CMAKE_BUILD_TYPE}" CACHE STRING
"Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel Maintainer."
FORCE )
ENDIF()
##########################################################################
# PROFILE mode for linux
##########################################################################
IF (CMAKE_COMPILER_IS_GNUCC)
SET( CMAKE_CXX_FLAGS_PROFILE "-O2 -g -pg" CACHE STRING
"Flags used by the C++ compiler during profile builds."
FORCE )
SET( CMAKE_C_FLAGS_PROFILE "-O2 -g -pg" CACHE STRING
"Flags used by the C compiler during profile builds."
FORCE )
SET( CMAKE_EXE_LINKER_FLAGS_PROFILE
"-pg " CACHE STRING
"Flags used for linking binaries during profile builds."
FORCE )
SET( CMAKE_SHARED_LINKER_FLAGS_PROFILE
"-pg " CACHE STRING
"Flags used by the shared libraries linker during profile builds."
FORCE )
MARK_AS_ADVANCED(
CMAKE_CXX_FLAGS_PROFILE
CMAKE_C_FLAGS_PROFILE
CMAKE_EXE_LINKER_FLAGS_PROFILE
CMAKE_SHARED_LINKER_FLAGS_PROFILE )
# Update the documentation string of CMAKE_BUILD_TYPE for GUIs
SET( CMAKE_BUILD_TYPE "${CMAKE_BUILD_TYPE}" CACHE STRING
"Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel Maintainer Profile."
FORCE )
ENDIF()
##########################################################################
# Find the Boost Libraries
##########################################################################
##find the boost test suite
FIND_PACKAGE(Boost COMPONENTS test_exec_monitor serialization mpi REQUIRED) # do we have any boost at all?
##########################################################################
# Now gsl subset
##########################################################################
set(GSL_DIR cmake)
find_package(GSL REQUIRED)
IF(GSL_FOUND)
include_directories(${GSL_INCLUDE_DIRS} ${GSLCBLAS_INCLUDE_DIRS})
ENDIF()
##########################################################################
# Build the app
##########################################################################
add_subdirectory(src)
##########################################################################
# Build the TEST app
##########################################################################
add_subdirectory(test)
##########################################################################
# Build Documentation
##########################################################################
# add a target to generate API documentation with Doxygen
find_package(Doxygen)
if(DOXYGEN_FOUND)
configure_file(${mpi_manager-project_SOURCE_DIR}/Doxyfile.in ${mpi_manager-project_SOURCE_DIR}/Doxyfile @ONLY)
add_custom_target(doc
${DOXYGEN_EXECUTABLE} ${mpi_manager-project_SOURCE_DIR}/Doxyfile
WORKING_DIRECTORY ${mpi_manager-project_SOURCE_DIR_SOURCE_DIR}
COMMENT "Generating API documentation with Doxygen" VERBATIM
)
endif(DOXYGEN_FOUND)
##########################################################################
# Packaging
##########################################################################
INCLUDE(InstallRequiredSystemLibraries)
SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "MPI manager")
SET(CPACK_PACKAGE_VENDOR "T.H. Shorrock")
SET(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/README")
SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/COPYING")
SET(CPACK_PACKAGE_VERSION_MAJOR "0")
SET(CPACK_PACKAGE_VERSION_MINOR "1")
SET(CPACK_PACKAGE_VERSION_PATCH "0")
SET(CPACK_PACKAGE_INSTALL_DIRECTORY "CMake ${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}")
IF(WIN32 AND NOT UNIX)
# There is a bug in NSI that does not handle full unix paths properly. Make
# sure there is at least one set of four (4) backlasshes.
#SET(CPACK_PACKAGE_ICON "${CMake_SOURCE_DIR}/Utilities/Release\\\\InstallIcon.bmp")
# SET(CPACK_NSIS_INSTALLED_ICON_NAME "bin\\\\ICA.exe")
SET(CPACK_NSIS_DISPLAY_NAME "${CPACK_PACKAGE_INSTALL_DIRECTORY} mpi_manager-project")
#SET(CPACK_NSIS_HELP_LINK "http:\\\\\\\\[email protected]:thshorrock/Ensemble-Learning.git")
#SET(CPACK_NSIS_URL_INFO_ABOUT "http:\\\\\\\\www.my-personal-home-page.com")
SET(CPACK_NSIS_CONTACT "[email protected]")
SET(CPACK_NSIS_MODIFY_PATH ON)
ELSE(WIN32 AND NOT UNIX)
# SET(CPACK_STRIP_FILES "bin/ICA")
SET(CPACK_SOURCE_STRIP_FILES "")
ENDIF(WIN32 AND NOT UNIX)
#SET(CPACK_PACKAGE_EXECUTABLES "ICA" "mpi_manager-project")
INCLUDE(CPack)