Browse Source

Option to build with VTK 7, now that Arch (and others) are shipping with that.

enhancement_3
Trevor Irons 8 years ago
parent
commit
cd2fcdbb2a
3 changed files with 46 additions and 24 deletions
  1. 33
    15
      CMakeLists.txt
  2. 3
    1
      LemmaCore/CMakeLists.txt
  3. 10
    8
      LemmaCore/src/QWEKey.cpp

+ 33
- 15
CMakeLists.txt View File

18
   message(FATAL_ERROR "Lemma requires that git is installed and in the path of your machine")
18
   message(FATAL_ERROR "Lemma requires that git is installed and in the path of your machine")
19
 endif(NOT HAVEGIT)
19
 endif(NOT HAVEGIT)
20
 
20
 
21
-# FIND_PROGRAM(HAVEHG hg
22
-#   PATHS /usr/bin/ /bin ENV PATH NO_DEFAULT_PATH
23
-# )
24
-# if(NOT HAVEHG)
25
-#   message(STATUS "Mercurial (hg) was not found.")
26
-# endif(NOT HAVEHG)
21
+FIND_PROGRAM(HAVEHG hg
22
+  PATHS /usr/bin/ /bin ENV PATH NO_DEFAULT_PATH
23
+)
24
+if(NOT HAVEHG)
25
+   message(STATUS "Mercurial (hg) was not found.")
26
+endif(NOT HAVEHG)
27
 
27
 
28
 option(BUILD_SHARED_LIBS OFF)
28
 option(BUILD_SHARED_LIBS OFF)
29
 if(BUILD_SHARED_LIBS)
29
 if(BUILD_SHARED_LIBS)
38
 include(ExternalProject)
38
 include(ExternalProject)
39
 # Eigen, this header-library is used extensively for linear algebra, matrices, and arrays
39
 # Eigen, this header-library is used extensively for linear algebra, matrices, and arrays
40
 # Mercurial (hg) repo pull, Would it be better to just download latest stable?
40
 # Mercurial (hg) repo pull, Would it be better to just download latest stable?
41
-#ExternalProject_Add(EIGEN
42
-#	HG_REPOSITORY  "https://bitbucket.org/eigen/eigen/"
43
-#	UPDATE_COMMAND ""
44
-#	PATCH_COMMAND ""
45
-#    PREFIX ${CMAKE_CURRENT_BINARY_DIR}/external/eigen
46
-#    CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=${CMAKE_INSTALL_PREFIX}
47
-#)
41
+if (HAVEHG)
42
+ExternalProject_Add(EIGEN
43
+	HG_REPOSITORY  "https://bitbucket.org/eigen/eigen/"
44
+	UPDATE_COMMAND ""
45
+	HG_TAG "default"
46
+    PREFIX ${CMAKE_CURRENT_BINARY_DIR}/external/eigen
47
+    CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=${CMAKE_INSTALL_PREFIX}
48
+)
49
+ELSE() 
48
 # Stable Eigen, requires manual updating when new releases, but lighter weight.  
50
 # Stable Eigen, requires manual updating when new releases, but lighter weight.  
49
 ExternalProject_Add(EIGEN
51
 ExternalProject_Add(EIGEN
50
 	URL "http://bitbucket.org/eigen/eigen/get/3.2.7.tar.gz"
52
 	URL "http://bitbucket.org/eigen/eigen/get/3.2.7.tar.gz"
53
+    #URL "http://bitbucket.org/eigen/eigen/get/default.tar.gz" # tip from repo
51
     PREFIX ${CMAKE_CURRENT_BINARY_DIR}/external/eigen
54
     PREFIX ${CMAKE_CURRENT_BINARY_DIR}/external/eigen
52
     CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=${CMAKE_INSTALL_PREFIX}
55
     CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=${CMAKE_INSTALL_PREFIX}
53
 )
56
 )
57
+ENDIF()
54
 
58
 
55
 # Yaml-cpp, this library is used extensively for serialisation of classes (class persistence) 
59
 # Yaml-cpp, this library is used extensively for serialisation of classes (class persistence) 
56
 ExternalProject_Add(YAML-CPP
60
 ExternalProject_Add(YAML-CPP
96
 endif()
100
 endif()
97
 
101
 
98
 # We don't build VTK, it is too heavy.
102
 # We don't build VTK, it is too heavy.
99
-option (LEMMA_VTK_SUPPORT "VTK library for visualisation and grids" OFF)
100
-if ( LEMMA_VTK_SUPPORT ) 
103
+option (LEMMA_VTK6_SUPPORT "VTK library for visualisation and grids" OFF)
104
+if ( LEMMA_VTK6_SUPPORT ) 
101
 	#find_package(VTK 6 REQUIRED NO_MODULE)
105
 	#find_package(VTK 6 REQUIRED NO_MODULE)
102
 	find_package(VTK 6.0 COMPONENTS vtkCommonCore vtkRenderingCore vtkFiltersCore vtkFiltersSources 
106
 	find_package(VTK 6.0 COMPONENTS vtkCommonCore vtkRenderingCore vtkFiltersCore vtkFiltersSources 
103
 			vtkCommonDataModel vtkFiltersHyperTree vtkIOXML vtkIOImage vtkIOLegacy vtkInteractionStyle 
107
 			vtkCommonDataModel vtkFiltersHyperTree vtkIOXML vtkIOImage vtkIOLegacy vtkInteractionStyle 
110
 	include_directories ("${PROJECT_SOURCE_DIR}/Matplot_vtk")
114
 	include_directories ("${PROJECT_SOURCE_DIR}/Matplot_vtk")
111
 endif()
115
 endif()
112
 
116
 
117
+option (LEMMA_VTK7_SUPPORT "VTK library for visualisation and grids" OFF)
118
+if ( LEMMA_VTK7_SUPPORT ) 
119
+	#find_package(VTK 7 REQUIRED NO_MODULE)
120
+	find_package(VTK 7.0 COMPONENTS vtkCommonCore vtkRenderingCore vtkFiltersCore vtkFiltersSources 
121
+			vtkCommonDataModel vtkFiltersHyperTree vtkIOXML vtkIOImage vtkIOLegacy vtkInteractionStyle 
122
+			vtkRenderingAnnotation vtkFiltersHybrid vtkFiltersModeling vtkRenderingVolumeOpenGL2 NO_MODULE)
123
+	set(volumeRenderer volumerenderer.cxx)
124
+	include(${VTK_USE_FILE}) 
125
+	add_compile_options(-DLEMMAUSEVTK) 
126
+	# Compile Matplot_vtk if VTK is present
127
+	add_subdirectory(Matplot_vtk)	
128
+	include_directories ("${PROJECT_SOURCE_DIR}/Matplot_vtk")
129
+endif()
130
+
113
 #####################
131
 #####################
114
 # Lemma Configuration
132
 # Lemma Configuration
115
 #####################
133
 #####################

+ 3
- 1
LemmaCore/CMakeLists.txt View File

25
 if (LEMMA_MATIO_SUPPORT)
25
 if (LEMMA_MATIO_SUPPORT)
26
 	add_dependencies(lemmacore MATIO)
26
 	add_dependencies(lemmacore MATIO)
27
 endif()
27
 endif()
28
-if (LEMMA_VTK_SUPPORT) 
28
+
29
+if ( LEMMA_VTK6_SUPPORT OR LEMMA_VTK7_SUPPORT ) 
29
 	target_link_libraries(lemmacore ${VTK_LIBRARIES})
30
 	target_link_libraries(lemmacore ${VTK_LIBRARIES})
30
 	target_link_libraries(lemmacore "matplot")
31
 	target_link_libraries(lemmacore "matplot")
31
 endif()
32
 endif()
33
+
32
 target_link_libraries(lemmacore "yaml-cpp")
34
 target_link_libraries(lemmacore "yaml-cpp")
33
 
35
 
34
 # Install
36
 # Install

+ 10
- 8
LemmaCore/src/QWEKey.cpp View File

140
     //      Method:  GaussQuadWeights
140
     //      Method:  GaussQuadWeights
141
     //--------------------------------------------------------------------------------------
141
     //--------------------------------------------------------------------------------------
142
     void QWEKey::GaussQuadWeights(const int& N) {
142
     void QWEKey::GaussQuadWeights(const int& N) {
143
-        VectorXr Nv = VectorXr::LinSpaced(N-1, 1, N-1);
144
-        VectorXr beta  = 0.5 / (1.-(2.*Nv.array()).pow(-2)).sqrt();
145
-        MatrixXr T = MatrixXr::Zero(N,N);
146
-        //std::cerr << "Eigen ERROR BELOW, QWEKey.cpp  QWEKey::GaussQuadWeights, COMMENTED OUT ";
147
-        T.bottomLeftCorner(N-1, N-1) = beta.asDiagonal();
148
-        Eigen::SelfAdjointEigenSolver<MatrixXr> eig( T.selfadjointView< Eigen::Lower >() );
149
-            GaussAbscissa = eig.eigenvalues();
150
-            GaussWeights = 2.*eig.eigenvectors().row(0).array().pow(2);
143
+        std::cerr<<"QWEKey needs work to remove Boost, etc." << std::endl;
144
+        // Below works with older Eigen, need to find problem
145
+//         VectorXr Nv = VectorXr::LinSpaced(N-1, 1, N-1);
146
+//         VectorXr beta  = 0.5 / (1.-(2.*Nv.array()).pow(-2)).sqrt();
147
+//         MatrixXr T = MatrixXr::Zero(N,N);
148
+//         //std::cerr << "Eigen ERROR BELOW, QWEKey.cpp  QWEKey::GaussQuadWeights, COMMENTED OUT ";
149
+//         T.bottomLeftCorner(N-1, N-1) = beta.asDiagonal();
150
+//         Eigen::SelfAdjointEigenSolver<MatrixXr> eig( T.selfadjointView< Eigen::Lower >() ); // PROBLEM LINE
151
+//             GaussAbscissa = eig.eigenvalues();
152
+//             GaussWeights = 2.*eig.eigenvectors().row(0).array().pow(2);
151
     }
153
     }
152
 
154
 
153
     //--------------------------------------------------------------------------------------
155
     //--------------------------------------------------------------------------------------

Loading…
Cancel
Save