Kaynağa Gözat

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

enhancement_3
Trevor Irons 8 yıl önce
ebeveyn
işleme
cd2fcdbb2a
3 değiştirilmiş dosya ile 46 ekleme ve 24 silme
  1. 33
    15
      CMakeLists.txt
  2. 3
    1
      LemmaCore/CMakeLists.txt
  3. 10
    8
      LemmaCore/src/QWEKey.cpp

+ 33
- 15
CMakeLists.txt Dosyayı Görüntüle

@@ -18,12 +18,12 @@ if(NOT HAVEGIT)
18 18
   message(FATAL_ERROR "Lemma requires that git is installed and in the path of your machine")
19 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 28
 option(BUILD_SHARED_LIBS OFF)
29 29
 if(BUILD_SHARED_LIBS)
@@ -38,19 +38,23 @@ endif()
38 38
 include(ExternalProject)
39 39
 # Eigen, this header-library is used extensively for linear algebra, matrices, and arrays
40 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 50
 # Stable Eigen, requires manual updating when new releases, but lighter weight.  
49 51
 ExternalProject_Add(EIGEN
50 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 54
     PREFIX ${CMAKE_CURRENT_BINARY_DIR}/external/eigen
52 55
     CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=${CMAKE_INSTALL_PREFIX}
53 56
 )
57
+ENDIF()
54 58
 
55 59
 # Yaml-cpp, this library is used extensively for serialisation of classes (class persistence) 
56 60
 ExternalProject_Add(YAML-CPP
@@ -96,8 +100,8 @@ if ( LEMMA_MATIO_SUPPORT )
96 100
 endif()
97 101
 
98 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 105
 	#find_package(VTK 6 REQUIRED NO_MODULE)
102 106
 	find_package(VTK 6.0 COMPONENTS vtkCommonCore vtkRenderingCore vtkFiltersCore vtkFiltersSources 
103 107
 			vtkCommonDataModel vtkFiltersHyperTree vtkIOXML vtkIOImage vtkIOLegacy vtkInteractionStyle 
@@ -110,6 +114,20 @@ if ( LEMMA_VTK_SUPPORT )
110 114
 	include_directories ("${PROJECT_SOURCE_DIR}/Matplot_vtk")
111 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 132
 # Lemma Configuration
115 133
 #####################

+ 3
- 1
LemmaCore/CMakeLists.txt Dosyayı Görüntüle

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

+ 10
- 8
LemmaCore/src/QWEKey.cpp Dosyayı Görüntüle

@@ -140,14 +140,16 @@ namespace Lemma {
140 140
     //      Method:  GaussQuadWeights
141 141
     //--------------------------------------------------------------------------------------
142 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…
İptal
Kaydet