|
@@ -1,10 +1,66 @@
|
1
|
1
|
cmake_minimum_required(VERSION 3.1.0 FATAL_ERROR)
|
2
|
2
|
|
3
|
|
-set(LEMMA_VERSION_MAJOR "0")
|
4
|
|
-set(LEMMA_VERSION_MINOR "2")
|
5
|
|
-set(LEMMA_VERSION_PATCH "1")
|
6
|
|
-set(LEMMA_VERSION "\"${LEMMA_VERSION_MAJOR}.${LEMMA_VERSION_MINOR}.${LEMMA_VERSION_PATCH}\"")
|
7
|
|
-set(LEMMA_VERSION_NOQUOTES "${LEMMA_VERSION_MAJOR}.${LEMMA_VERSION_MINOR}.${LEMMA_VERSION_PATCH}")
|
|
3
|
+####################################################################################################
|
|
4
|
+# Lemma versioning, set Major, minor, and patch here #
|
|
5
|
+set(LEMMA_VERSION_MAJOR "0") #
|
|
6
|
+set(LEMMA_VERSION_MINOR "2") #
|
|
7
|
+set(LEMMA_VERSION_PATCH "1") #
|
|
8
|
+set(LEMMA_VERSION "\"${LEMMA_VERSION_MAJOR}.${LEMMA_VERSION_MINOR}.${LEMMA_VERSION_PATCH}\"") #
|
|
9
|
+set(LEMMA_VERSION_NOQUOTES "${LEMMA_VERSION_MAJOR}.${LEMMA_VERSION_MINOR}.${LEMMA_VERSION_PATCH}") #
|
|
10
|
+####################################################################################################
|
|
11
|
+
|
|
12
|
+########################################
|
|
13
|
+# ################################## #
|
|
14
|
+# # Pre-Build checks/ dependencies # #
|
|
15
|
+# ################################## #
|
|
16
|
+########################################
|
|
17
|
+
|
|
18
|
+## Options--what do you want to do
|
|
19
|
+
|
|
20
|
+option ( BUILD_SHARED_LIBS "Shared or static libraries" OFF )
|
|
21
|
+option ( LEMMA_ENABLE_TESTING "Turn on unit testing" OFF )
|
|
22
|
+option ( LEMMA_BUILD_EXAMPLES "Compile example Lemma applications" OFF )
|
|
23
|
+option ( LEMMA_USE_OPENMP "Use OpenMP in Lemma" OFF )
|
|
24
|
+option ( LEMMA_BUILD_DOCUMENTATION "Build Doxygen man pages" OFF )
|
|
25
|
+
|
|
26
|
+## Hard Dependencies
|
|
27
|
+find_package (Eigen3 3.3 NO_MODULE QUIET) # Matrix/Vector & Math
|
|
28
|
+find_package (yaml-cpp 0.6 QUIET) # Serialisation of classes
|
|
29
|
+
|
|
30
|
+if (LEMMA_BUILD_DOCUMENTATION)
|
|
31
|
+ find_package(Doxygen REQUIRED)
|
|
32
|
+endif()
|
|
33
|
+
|
|
34
|
+## Optional Dependencies
|
|
35
|
+if (LEMMA_ENABLE_TESTING)
|
|
36
|
+ find_package (CxxTest QUIET) # Unit testin
|
|
37
|
+endif()
|
|
38
|
+
|
|
39
|
+#######################################################################
|
|
40
|
+# CXXTEST Framework
|
|
41
|
+if(CXXTEST_FOUND)
|
|
42
|
+ if (LEMMA_ENABLE_TESTING)
|
|
43
|
+ #include_directories(${CXXTEST_INCLUDE_DIR}) # Add this in testing CMakeLists.txt instead, cleaner
|
|
44
|
+ enable_testing()
|
|
45
|
+ endif()
|
|
46
|
+endif()
|
|
47
|
+
|
|
48
|
+## Optional Dependencies
|
|
49
|
+if ( NOT Eigen3_FOUND OR
|
|
50
|
+ NOT yaml-cpp_FOUND OR
|
|
51
|
+ (LEMMA_ENABLE_TESTING AND NOT CxxTest_FOUND) )
|
|
52
|
+ message ( STATUS "Missing hard dependencies have been found, these will be downloaded any compiled." )
|
|
53
|
+ message ( STATUS "This necessitates a two step build." )
|
|
54
|
+ message ( STATUS "Build these packages first...THEN RERUN CMAKE!" )
|
|
55
|
+ project (SUPERBUILD NONE)
|
|
56
|
+ # execute the superbuild (this script will be invoked again without the
|
|
57
|
+ # USE_SUPERBUILD option this time)
|
|
58
|
+ include (CMake/SuperBuild.cmake)
|
|
59
|
+ return() # stop processing this file further
|
|
60
|
+else()
|
|
61
|
+ #project (Blah) # <-- YOUR PROJECT NAME HERE
|
|
62
|
+ message( STATUS "Everything was found, happy Lemma-ing" )
|
|
63
|
+endif()
|
8
|
64
|
|
9
|
65
|
# Mac OSX RPATH is weird
|
10
|
66
|
# enable @rpath in the install name for any shared library being built
|
|
@@ -26,7 +82,7 @@ if(NOT HAVEGIT)
|
26
|
82
|
message(FATAL_ERROR "Lemma requires that git is installed and in the path of your machine")
|
27
|
83
|
endif(NOT HAVEGIT)
|
28
|
84
|
|
29
|
|
-option(BUILD_SHARED_LIBS OFF)
|
|
85
|
+
|
30
|
86
|
if(BUILD_SHARED_LIBS)
|
31
|
87
|
set(LABEL_SUFFIX "shared")
|
32
|
88
|
else()
|
|
@@ -43,100 +99,6 @@ endif(NOT CMAKE_BUILD_TYPE)
|
43
|
99
|
###################
|
44
|
100
|
# External Projects
|
45
|
101
|
###################
|
46
|
|
-include(ExternalProject)
|
47
|
|
-##########################################################################################
|
48
|
|
-# Eigen, this header-library is used extensively for linear algebra, matrices, and arrays
|
49
|
|
-# Eigen now has an official mirror on GitHub, so Mercurial is no longer a requirement!
|
50
|
|
-ExternalProject_Add(EIGEN
|
51
|
|
- GIT_REPOSITORY "https://github.com/eigenteam/eigen-git-mirror.git"
|
52
|
|
- UPDATE_COMMAND ""
|
53
|
|
- GIT_TAG "3.3.3" #"default"
|
54
|
|
- PREFIX ${CMAKE_CURRENT_BINARY_DIR}/external/eigen
|
55
|
|
- CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=${CMAKE_INSTALL_PREFIX}
|
56
|
|
-)
|
57
|
|
-include_directories ("${CMAKE_INSTALL_PREFIX}/include/eigen3")
|
58
|
|
-
|
59
|
|
-#############################################################################################
|
60
|
|
-# Yaml-cpp, this library is used extensively for serialisation of classes (class persistence)
|
61
|
|
-#find_package(yaml-cpp)
|
62
|
|
-if (yaml-cpp_FOUND)
|
63
|
|
- message( STATUS "YAML-CPP FOUND ${yaml-cpp_FOUND}" )
|
64
|
|
- message( STATUS "YAML-CPP LIBRARIES ${YAML_CPP_LIBRARIES}" )
|
65
|
|
- message( STATUS "YAML-CPP LIBRARY ${yaml-cpp_LIBRARY}" )
|
66
|
|
-else()
|
67
|
|
- message( STATUS "YAML-CPP WAS NOT FOUND" )
|
68
|
|
- ExternalProject_Add(YAML_CPP
|
69
|
|
- GIT_REPOSITORY "https://github.com/jbeder/yaml-cpp.git"
|
70
|
|
- GIT_TAG "yaml-cpp-0.6.1" # "master"
|
71
|
|
- UPDATE_COMMAND ""
|
72
|
|
- PATCH_COMMAND ""
|
73
|
|
- PREFIX ${CMAKE_CURRENT_BINARY_DIR}/external/yaml-cpp
|
74
|
|
- CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=${CMAKE_INSTALL_PREFIX}
|
75
|
|
- -DBUILD_SHARED_LIBS=${BUILD_SHARED_LIBS}
|
76
|
|
- -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}
|
77
|
|
- -DYAML_CPP_BUILD_TESTS=OFF
|
78
|
|
- )
|
79
|
|
- find_package(yaml-cpp)
|
80
|
|
-endif()
|
81
|
|
-
|
82
|
|
-# CxxTest
|
83
|
|
-find_package(CxxTest)
|
84
|
|
-if (CXXTEST_FOUND)
|
85
|
|
- # Do nothing
|
86
|
|
- message( STATUS "CXXTEST FOUND" )
|
87
|
|
-else()
|
88
|
|
- message( STATUS "CxxTest will be built and installed along with Lemma, override if desired in GUI." )
|
89
|
|
- ExternalProject_Add(CxxTest
|
90
|
|
- GIT_REPOSITORY "https://github.com/CxxTest/cxxtest.git"
|
91
|
|
- GIT_TAG "master"
|
92
|
|
- UPDATE_COMMAND ""
|
93
|
|
- PATCH_COMMAND ""
|
94
|
|
- CONFIGURE_COMMAND ""
|
95
|
|
- BUILD_COMMAND ""
|
96
|
|
- INSTALL_COMMAND ""
|
97
|
|
- PREFIX ${CMAKE_CURRENT_BINARY_DIR}/external/CxxTest
|
98
|
|
- CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=${CMAKE_INSTALL_PREFIX} /
|
99
|
|
- -DBUILD_SHARED_LIBS=${BUILD_SHARED_LIBS} /
|
100
|
|
- -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
|
101
|
|
- )
|
102
|
|
- # The values "CACHE PATH "" FORCE" makes the GUI show the values of the local CxxTest, but this can cause issues
|
103
|
|
- # with users wanting to specify their own path, its not recommended
|
104
|
|
- set (CXXTEST_INCLUDE_DIR "${CMAKE_CURRENT_BINARY_DIR}/external/CxxTest/src/CxxTest/") # CACHE PATH "" FORCE )
|
105
|
|
- set (CXXTEST_PYTHON_TESTGEN_EXECUTABLE "${CMAKE_CURRENT_BINARY_DIR}/external/CxxTest/src/CxxTest/bin/cxxtestgen") # CACHE PATH "" FORCE )
|
106
|
|
- find_package(CxxTest REQUIRED)
|
107
|
|
-endif()
|
108
|
|
-
|
109
|
|
-# tinyxml2, this library is used for XML IO
|
110
|
|
-option( LEMMA_TINYXML_SUPPORT "TinyXML library support for .xml files" OFF)
|
111
|
|
-if ( LEMMA_TINYXML_SUPPORT )
|
112
|
|
- ExternalProject_Add(TINYXML2
|
113
|
|
- GIT_REPOSITORY "https://github.com/leethomason/tinyxml2.git"
|
114
|
|
- GIT_TAG "master"
|
115
|
|
- UPDATE_COMMAND ""
|
116
|
|
- PATCH_COMMAND ""
|
117
|
|
- PREFIX ${CMAKE_CURRENT_BINARY_DIR}/external/tinyxml2
|
118
|
|
- CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=${CMAKE_INSTALL_PREFIX} -DBUILD_SHARED_LIBS=${BUILD_SHARED_LIBS} /
|
119
|
|
- -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
|
120
|
|
- )
|
121
|
|
- add_compile_options(-DTINYXMLSUPPORT)
|
122
|
|
-endif()
|
123
|
|
-
|
124
|
|
-option( LEMMA_MATIO_SUPPORT "MATIO library support for MATLAB .mat files" OFF)
|
125
|
|
-if ( LEMMA_MATIO_SUPPORT )
|
126
|
|
- add_compile_options(-DHAVE_MATIO)
|
127
|
|
- # matio, this library is used for MATLAB file IO
|
128
|
|
- ExternalProject_ADD(MATIO
|
129
|
|
- GIT_REPOSITORY "git://git.code.sf.net/p/matio/matio"
|
130
|
|
- GIT_TAG "master"
|
131
|
|
- UPDATE_COMMAND ""
|
132
|
|
- PATCH_COMMAND ""
|
133
|
|
- PREFIX ${CMAKE_CURRENT_BINARY_DIR}/external/matio
|
134
|
|
- #CONFIGURE_COMMAND ${CMAKE_CURRENT_BINARY_DIR}/external/matio/src/MATIO/autogen.sh && configure
|
135
|
|
- CONFIGURE_COMMAND ./autogen.sh && ./configure --prefix=${CMAKE_INSTALL_PREFIX}
|
136
|
|
- BUILD_IN_SOURCE 1
|
137
|
|
- BUILD_COMMAND ${MAKE}
|
138
|
|
- )
|
139
|
|
-endif()
|
140
|
102
|
|
141
|
103
|
# We don't build VTK, it is too heavy.
|
142
|
104
|
option (LEMMA_VTK6_SUPPORT "VTK library for visualisation and grids" OFF)
|
|
@@ -249,9 +211,6 @@ endif()
|
249
|
211
|
####################
|
250
|
212
|
SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
|
251
|
213
|
|
252
|
|
-option( LEMMA_BUILD_EXAMPLES "Compile example Lemma applications" OFF )
|
253
|
|
-
|
254
|
|
-option( LEMMA_USE_OPENMP "Use OpenMP in Lemma" OFF)
|
255
|
214
|
if (LEMMA_USE_OPENMP)
|
256
|
215
|
find_package(OpenMP)
|
257
|
216
|
if (OPENMP_FOUND)
|
|
@@ -273,15 +232,7 @@ include_directories("${PROJECT_BINARY_DIR}/include")
|
273
|
232
|
include_directories ("${CMAKE_INSTALL_PREFIX}/include/")
|
274
|
233
|
link_directories ("${CMAKE_INSTALL_PREFIX}/lib/")
|
275
|
234
|
|
276
|
|
-#######################################################################
|
277
|
|
-# CXXTEST Framework
|
278
|
|
-if(CXXTEST_FOUND)
|
279
|
|
- option (LEMMA_ENABLE_TESTING "Turn on unit testing" ON)
|
280
|
|
- if (LEMMA_ENABLE_TESTING)
|
281
|
|
- #include_directories(${CXXTEST_INCLUDE_DIR}) # Add this in testing CMakeLists.txt instead, cleaner
|
282
|
|
- enable_testing()
|
283
|
|
- endif()
|
284
|
|
-endif()
|
|
235
|
+
|
285
|
236
|
|
286
|
237
|
########################################################################
|
287
|
238
|
# Build Modules
|
|
@@ -292,9 +243,7 @@ add_subdirectory (Modules)
|
292
|
243
|
# ALL make documentation build by default if possible
|
293
|
244
|
find_package(Doxygen)
|
294
|
245
|
if(DOXYGEN_FOUND)
|
295
|
|
- option( LEMMA_BUILD_DOCUMENTATION "Build Doxygen man pages" OFF )
|
296
|
246
|
if (LEMMA_BUILD_DOCUMENTATION)
|
297
|
|
-
|
298
|
247
|
# Custom header and footer option, enable in Doxygen
|
299
|
248
|
# file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/Documentation/header.html
|
300
|
249
|
# DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/Documentation/header.html
|
|
@@ -302,7 +251,6 @@ find_package(Doxygen)
|
302
|
251
|
# file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/Documentation/footer.html
|
303
|
252
|
# DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/Documentation/footer.html
|
304
|
253
|
# )
|
305
|
|
-
|
306
|
254
|
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/Documentation/Doxyfile.in ${CMAKE_CURRENT_BINARY_DIR}/Documentation/Doxyfile @ONLY)
|
307
|
255
|
add_custom_target(doc
|
308
|
256
|
ALL
|
|
@@ -310,7 +258,7 @@ find_package(Doxygen)
|
310
|
258
|
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
311
|
259
|
COMMENT "Generating API documentation with Doxygen" VERBATIM
|
312
|
260
|
)
|
313
|
|
-
|
314
|
261
|
endif (LEMMA_BUILD_DOCUMENTATION)
|
315
|
262
|
endif(DOXYGEN_FOUND)
|
316
|
263
|
|
|
264
|
+# vim: set tabstop=4 shiftwidth=4 expandtab:
|