-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
217 lines (181 loc) · 8.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
cmake_minimum_required (VERSION 2.6)
project (EnsembleLearningProject)
# The version number.
set (EnsembleLearning_VERSION_MAJOR 0)
set (EnsembleLearning_VERSION_MINOR 1)
set (EnsembleLearning_PATCH_LEVEL 3 )
# 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_EXAMPLES "Set to OFF to skip building the examples" 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}/lib)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
##########################################################################
# 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
##########################################################################
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 #-static-libgcc -lc_p
"Flags used for linking binaries during profile builds."
FORCE )
SET( CMAKE_SHARED_LINKER_FLAGS_PROFILE
"-pg " CACHE STRING #-static-libgcc -lc_p
"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()
##########################################################################
# Check for architecture and sse extentions
##########################################################################
include(cmake/architecture.cmake)
include(cmake/sse.cmake)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${SSE_FLAGS}")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${MARCH_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${SSE_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${MARCH_FLAGS}")
##########################################################################
# Add OpenMP support
##########################################################################
#require the omp library
FIND_PACKAGE(OpenMP REQUIRED)
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_C_FLAGS}")
##########################################################################
# The libraries and executables depend upon boost and gsl library.
# If these already exist on system then want to use the existing install.
# If not (and if BUILD_MISSING_DEPENDANCIES is ON) then want to build them.
###########################################################################
##########################################################################
# BOOST FIRST;
##########################################################################
FIND_PACKAGE(Boost COMPONENTS system program_options test_exec_monitor filesystem REQUIRED) # do we have any boost at all?
IF(Boost_FOUND)
include_directories(${Boost_INCLUDE_DIRS})
ELSE()
IF(BUILD_MISSING_DEPENDANCIES)
#At present the following is redundent (GSL required)
# This is because it is not working yet, when it is done the required will be removed
message(STATUS "BUILDING call_traits library")
add_subdirectory(boost)
include_directories(boost)
set(Boost_filesystem_LIBRARY ${CMAKE_BINARY_DIR}/lib/boost_filesytem-mt)
set(Boost_program_options_LIBRARY ${CMAKE_BINARY_DIR}/lib/boost_program_options-mt)
ELSE()
message(STATUS "Could not find boost. If you have boost you need to tell me where it is by using the ... command.\n Alternatively, you may: \n\t - build the latest boost libraries yourself (Recommended),\n\t - Or let me build a (possibly old) version myself.\n\n For this final option, you need the BUILD_MISSING_DEPENDANCIES option to be ON.")
ENDIF()
ENDIF()
##########################################################################
# Now gsl subset
##########################################################################
set(GSL_DIR cmake)
find_package(GSL REQUIRED)
IF("${GSL_FOUND}")
include_directories(${GSL_INCLUDE_DIRS} ${GSLCBLAS_INCLUDE_DIRS})
ELSE("${GSL_FOUND}")
#At present the following is redundent (GSL required)
# This is because it is not working yet, when it is done the required will be removed
MESSAGE("GSL NOT FOUND -- BUILDING FROM SOURCE")
add_subdirectory(gsl)
ENDIF("${GSL_FOUND}" )
##########################################################################
# Ensemble Learning modules
# Do in the same style as Boost.CMake so that uniform style if libraries not found #
##########################################################################
include(boost/tools/build/CMake/BoostUtils.cmake)
message(STATUS "./cmake")
colormsg(_HIBLUE_ "Ensemble Learning Project, starting ...")
message(STATUS "")
##########################################################################
# Build the EL library
##########################################################################
enable_testing()
add_subdirectory(EnsembleLearning-src)
IF( BUILD_EXAMPLES )
message(STATUS "")
colormsg(_HIBLUE_ "Building Examples")
message(STATUS "")
add_subdirectory(example/InferData1)
add_subdirectory(example/InferMixtureData1)
add_subdirectory(example/InferScaledData1)
add_subdirectory(example/ICA/build)
ENDIF( BUILD_EXAMPLES )
INCLUDE(InstallRequiredSystemLibraries)
SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Ensemble Learning Project")
SET(CPACK_PACKAGE_VENDOR "T.H. Shorrock")
SET(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/README.txt")
SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/COPYING")
SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE_1_0.txt")
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} EnsembleLearning")
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" "EnsembleLearning")
INCLUDE(CPack)