|
@@ -1,10 +1,16 @@
|
1
|
1
|
cmake_minimum_required(VERSION 3.1.0 FATAL_ERROR)
|
2
|
2
|
|
|
3
|
+# Bug in CMake on Linux, but Linux, Mac, and Win all support shared libraries, no harm in this,
|
|
4
|
+# but remove when warning no longer shows.
|
|
5
|
+# Related to calling find_package before a project is created...
|
|
6
|
+# https://cmake.org/Bug/view.php?id=15999
|
|
7
|
+SET_PROPERTY(GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS TRUE)
|
|
8
|
+
|
3
|
9
|
####################################################################################################
|
4
|
10
|
# Lemma versioning, set Major, minor, and patch here #
|
5
|
11
|
set(LEMMA_VERSION_MAJOR "0") #
|
6
|
12
|
set(LEMMA_VERSION_MINOR "2") #
|
7
|
|
-set(LEMMA_VERSION_PATCH "1") #
|
|
13
|
+set(LEMMA_VERSION_PATCH "2") #
|
8
|
14
|
set(LEMMA_VERSION "\"${LEMMA_VERSION_MAJOR}.${LEMMA_VERSION_MINOR}.${LEMMA_VERSION_PATCH}\"") #
|
9
|
15
|
set(LEMMA_VERSION_NOQUOTES "${LEMMA_VERSION_MAJOR}.${LEMMA_VERSION_MINOR}.${LEMMA_VERSION_PATCH}") #
|
10
|
16
|
####################################################################################################
|
|
@@ -23,9 +29,14 @@ option ( LEMMA_BUILD_EXAMPLES "Compile example Lemma applications" OFF )
|
23
|
29
|
option ( LEMMA_USE_OPENMP "Use OpenMP in Lemma" OFF )
|
24
|
30
|
option ( LEMMA_BUILD_DOCUMENTATION "Build Doxygen man pages" OFF )
|
25
|
31
|
|
|
32
|
+option (LEMMA_VTK6_SUPPORT "VTK 6.x library for visualisation and grids" OFF)
|
|
33
|
+option (LEMMA_VTK7_SUPPORT "VTK 7.x library for visualisation and grids" OFF)
|
|
34
|
+option (LEMMA_VTK8_SUPPORT "VTK 8.x library for visualisation and grids" OFF)
|
|
35
|
+
|
26
|
36
|
## 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
|
|
37
|
+#set(Eigen3_DIR ${CMAKE_INSTALL_PREFIX} )
|
|
38
|
+find_package (Eigen3 3.3 QUIET) # Matrix/Vector & Math
|
|
39
|
+find_package (yaml-cpp 0.6 QUIET ) # Serialisation of classes
|
29
|
40
|
|
30
|
41
|
INCLUDE_DIRECTORIES(${YAML_CPP_INCLUDE_DIR})
|
31
|
42
|
|
|
@@ -35,20 +46,17 @@ endif()
|
35
|
46
|
|
36
|
47
|
## Optional Dependencies
|
37
|
48
|
if (LEMMA_ENABLE_TESTING)
|
38
|
|
- message (STATUS "LEMMA_ENABLE_TESTING is set" )
|
39
|
|
- #find_package (CxxTest QUIET) # Unit testing
|
40
|
|
- if (EXISTS "${CMAKE_CURRENT_BINARY_DIR}/external/CxxTest/src/CxxTest/cxxtest")
|
41
|
|
- set (CXXTEST_INCLUDE_DIR "${CMAKE_CURRENT_BINARY_DIR}/external/CxxTest/src/CxxTest/" CACHE PATH "" FORCE)
|
|
49
|
+ if (EXISTS "${CMAKE_CURRENT_BINARY_DIR}/external/CxxTest/src/CxxTest/README")
|
|
50
|
+ set (CXXTEST_INCLUDE_DIR "${CMAKE_CURRENT_BINARY_DIR}/external/CxxTest/src/CxxTest/" CACHE PATH "" FORCE )
|
42
|
51
|
else()
|
43
|
|
- set (CXXTEST_INCLUDE_DIR "CXXTEST_INCLUDE_DIR-NOTFOUND" CACHE PATH "" FORCE)
|
|
52
|
+ set (CXXTEST_INCLUDE_DIR "CXXTEST_INCLUDE_DIR-NOTFOUND" CACHE PATH "" FORCE )
|
44
|
53
|
endif()
|
45
|
|
- if (EXISTS "${CMAKE_CURRENT_BINARY_DIR}/external/CxxTest/src/CxxTest/bin/cxxtestgen")
|
46
|
|
- set (CXXTEST_PYTHON_TESTGEN_EXECUTABLE "${CMAKE_CURRENT_BINARY_DIR}/external/CxxTest/src/CxxTest/bin/cxxtestgen" CACHE PATH "" FORCE)
|
|
54
|
+ if (EXISTS "${CMAKE_CURRENT_BINARY_DIR}/external/CxxTest/src/CxxTest/bin/cxxtestgen")
|
|
55
|
+ set (CXXTEST_PYTHON_TESTGEN_EXECUTABLE "${CMAKE_CURRENT_BINARY_DIR}/external/CxxTest/src/CxxTest/bin/cxxtestgen" CACHE PATH "" FORCE )
|
47
|
56
|
else()
|
48
|
|
- set (CXXTEST_PYTHON_TESTGEN_EXECUTABLE "CXXTEST_PYTHON_TESTGEN_EXECUTABLE-NOTFOUND" CACHE PATH "" FORCE)
|
49
|
|
- endif ()
|
50
|
|
- find_package (CxxTest) # Unit testing
|
51
|
|
- message (STATUS "CXXTEST_FOUND ${CxxTest_FOUND}" )
|
|
57
|
+ set (CXXTEST_PYTHON_TESTGEN_EXECUTABLE "CXXTEST_PYTHON_TESTGEN_EXECUTABLE-NOTFOUND" CACHE PATH "" FORCE )
|
|
58
|
+ endif()
|
|
59
|
+ find_package (CxxTest QUIET) # Unit testing
|
52
|
60
|
endif()
|
53
|
61
|
|
54
|
62
|
#######################################################################
|
|
@@ -71,13 +79,9 @@ if ( NOT Eigen3_FOUND OR
|
71
|
79
|
# execute the superbuild (this script will be invoked again without the
|
72
|
80
|
# USE_SUPERBUILD option this time)
|
73
|
81
|
include (CMake/SuperBuild.cmake)
|
74
|
|
-
|
75
|
|
- #add_dependencies(SUPERBUILD CxxTest)
|
76
|
|
-
|
77
|
82
|
return() # stop processing this file further
|
78
|
83
|
else()
|
79
|
84
|
#project (Blah) # <-- YOUR PROJECT NAME HERE
|
80
|
|
- message( STATUS "CXX test Dir${CXXTEST_DIR}" )
|
81
|
85
|
message( STATUS "Everything was found, happy Lemma-ing" )
|
82
|
86
|
endif()
|
83
|
87
|
|
|
@@ -91,6 +95,13 @@ set(CMAKE_MACOSX_RPATH 1)
|
91
|
95
|
|
92
|
96
|
project (Lemma CXX)
|
93
|
97
|
|
|
98
|
+# Disallow in-source build
|
|
99
|
+if ("${Lemma_SOURCE_DIR}" STREQUAL "${Lemma_BINARY_DIR}")
|
|
100
|
+ message(FATAL_ERROR
|
|
101
|
+ "Lemma requires an out of source Build. "
|
|
102
|
+ "Please create a separate binary directory and run CMake there.")
|
|
103
|
+endif()
|
|
104
|
+
|
94
|
105
|
##############################
|
95
|
106
|
# required external programs # for downloading packages
|
96
|
107
|
##############################
|
|
@@ -120,7 +131,7 @@ endif(NOT CMAKE_BUILD_TYPE)
|
120
|
131
|
###################
|
121
|
132
|
|
122
|
133
|
# We don't build VTK, it is too heavy.
|
123
|
|
-option (LEMMA_VTK6_SUPPORT "VTK library for visualisation and grids" OFF)
|
|
134
|
+
|
124
|
135
|
if ( LEMMA_VTK6_SUPPORT )
|
125
|
136
|
#find_package(VTK 6 REQUIRED NO_MODULE)
|
126
|
137
|
find_package(VTK 6.0 COMPONENTS vtkCommonCore vtkRenderingCore vtkFiltersCore vtkFiltersSources
|
|
@@ -134,7 +145,7 @@ if ( LEMMA_VTK6_SUPPORT )
|
134
|
145
|
#include_directories ("${PROJECT_SOURCE_DIR}/Matplot_vtk")
|
135
|
146
|
endif()
|
136
|
147
|
|
137
|
|
-option (LEMMA_VTK7_SUPPORT "VTK library for visualisation and grids" OFF)
|
|
148
|
+
|
138
|
149
|
if ( LEMMA_VTK7_SUPPORT )
|
139
|
150
|
#find_package(VTK 7 REQUIRED NO_MODULE)
|
140
|
151
|
find_package(VTK 7.0 COMPONENTS vtkCommonCore vtkRenderingCore vtkFiltersCore vtkFiltersSources
|
|
@@ -164,7 +175,7 @@ if ( LEMMA_VTK7_SUPPORT )
|
164
|
175
|
endif()
|
165
|
176
|
endif()
|
166
|
177
|
|
167
|
|
-option (LEMMA_VTK8_SUPPORT "VTK library for visualisation and grids" OFF)
|
|
178
|
+
|
168
|
179
|
if ( LEMMA_VTK8_SUPPORT )
|
169
|
180
|
find_package(VTK 8.0 COMPONENTS vtkCommonCore vtkRenderingCore vtkFiltersCore vtkFiltersSources
|
170
|
181
|
vtkCommonDataModel vtkFiltersHyperTree vtkIOXML vtkIOImage vtkIOLegacy vtkInteractionStyle
|
|
@@ -231,14 +242,10 @@ endif()
|
231
|
242
|
SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
|
232
|
243
|
|
233
|
244
|
if (LEMMA_USE_OPENMP)
|
234
|
|
- find_package(OpenMP)
|
235
|
|
- if (OPENMP_FOUND)
|
236
|
|
- set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
|
237
|
|
- set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
|
238
|
|
- set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OpenMP_EXE_LINKER_FLAGS}")
|
239
|
|
- else()
|
240
|
|
- message (FATAL ERROR "OpenMP cannot be found, but was specified!")
|
241
|
|
- endif()
|
|
245
|
+ find_package(OpenMP REQUIRED)
|
|
246
|
+ set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
|
|
247
|
+ set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
|
|
248
|
+ set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OpenMP_EXE_LINKER_FLAGS}")
|
242
|
249
|
endif()
|
243
|
250
|
|
244
|
251
|
configure_file (
|