Browse Source

added cmake option for LinAl dbv 3rd party

Johannes Ruehle 11 years ago
parent
commit
71cc287f7e
4 changed files with 61 additions and 2 deletions
  1. 14 0
      CMakeLists.txt
  2. 45 0
      cmake/FindLinAl.cmake
  3. 1 1
      core/CMakeLists.txt
  4. 1 1
      core/tutorial/progs/05_matio.cpp

+ 14 - 0
CMakeLists.txt

@@ -71,12 +71,26 @@ if(WITH_DBV_LIBRARIES)
         #message(STATUS "ipp link dir: ${IPP_LIBRARY_DIRS}")
         #message(STATUS "ipp link libs: ${IPP_LIBRARIES}")
         ADD_DEFINITIONS( "-DNICE_USELIB_IPP=5" )
+	ADD_DEFINITIONS( "-lpthread" )
         INCLUDE_DIRECTORIES(${IPP_INCLUDE_DIRS})
         
       else()
         message(STATUS "IPP library not found")
       endif()
     endif()
+
+    NICE_OPTION(WITH_LINAL "Build with dbv LinAl support" OFF)
+    if(WITH_LINAL)
+      FIND_PACKAGE(LinAl)
+      if(LINAL_FOUND)
+	ADD_DEFINITIONS( "-DNICE_USELIB_LINAL" )
+	#ADD_DEFINITIONS("-lgfortran")
+        INCLUDE_DIRECTORIES(${LINAL_INCLUDE_DIR})
+	#message(STATUS "linal link libs: ${LINAL_LIBRARIES}")
+        message(STATUS "Using LinAl include dir: ${LINAL_INCLUDE_DIR}")
+      endif()
+    endif()
+
   else()
     message( SEND_ERROR "trying to use DBV extern library dir, but couldn't be found ${NICE_DBV_LIBRARIES_DIR}. Switch off DBV Usage to continue.") #unsetting dbv libraries path
     unset(WITH_DBV_LIBRARIES) #unsetting, since dbv dir not found

+ 45 - 0
cmake/FindLinAl.cmake

@@ -0,0 +1,45 @@
+# Find the DBV library LinAl headers and library.
+#
+#  LINAL_INCLUDE_DIR - where to find Linal/linal.h, etc.
+#  LINAL_LIBRARIES      - List of libraries.
+#  LINAL_FOUND        - True if LinAl found.
+
+
+
+# Look for the library.
+#execute_process(COMMAND /home/dbv/3rdparty64-gcc43/LinAl/bin/linal-config --libs
+#                OUTPUT_VARIABLE LINAL_LIBRARIES)
+
+set(LINAL_LIBRARIES "/home/dbv/3rdparty64-gcc43/LinAl/lib/libLinAl.so;/home/dbv/3rdparty64-gcc43/LinAl/lib/libarpack++.a;/home/dbv/3rdparty64-gcc43/LinAl/lib/libsuperlu.a;/home/dbv/3rdparty64-gcc43/LinAl/lib/libarpack.a;/home/dbv/3rdparty64-gcc43/LinAl/lib/liblapack.a;/home/dbv/3rdparty64-gcc43/LinAl/lib/libblas.so")
+IF(UNIX) #find gfortran
+  # If the faster 'gold' linker is used, to avoid complaints about undefined symbol
+  # '_gfortran_concat_string', '_gfortran_pow_i4_i4', ... , let's link against gfortran libraries.
+  # These errors happen while linking against VTK static built with R support
+  SET(CMAKE_FIND_LIBRARY_SUFFIXES_SAVED ${CMAKE_FIND_LIBRARY_SUFFIXES}) # Backup
+  LIST(APPEND CMAKE_FIND_LIBRARY_SUFFIXES ".so.3")
+  FIND_LIBRARY(GFortran_LIBRARY gfortran)
+  SET(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES_SAVED}) # Restore
+  LIST(APPEND LINAL_LIBRARIES ${GFortran_LIBRARY})
+#  message(STATUS "GFortran_LIBRARY: ${GFortran_LIBRARY}")
+ENDIF()
+MARK_AS_ADVANCED(LINAL_LIBRARIES)
+
+# Look for the header file.
+#execute_process(COMMAND /home/dbv/3rdparty64-gcc43/LinAl/bin/linal-config --cxxflags
+#                OUTPUT_VARIABLE LINAL_INCLUDE_DIR)
+set(LINAL_INCLUDE_DIR "/home/dbv/3rdparty64-gcc43/LinAl/include/")
+MARK_AS_ADVANCED(LINAL_INCLUDE_DIR)
+
+
+# handle the QUIETLY and REQUIRED arguments and set LINAL_FOUND to TRUE if 
+# all listed variables are TRUE
+INCLUDE(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(LINAL DEFAULT_MSG LINAL_LIBRARIES LINAL_INCLUDE_DIR)
+
+#IF(MATIO_FOUND)
+#  SET(MATIO_LIBRARIES ${MATIO_LIBRARY} ${HDF5_LIBRARIES})
+#  SET(MATIO_INCLUDE_DIRS ${MATIO_INCLUDE_DIR} ${HDF5_INCLUDE_DIR})
+#ELSE(MATIO_FOUND)
+  #SET(MATIO_LIBRARIES)
+  #SET(MATIO_INCLUDE_DIRS)
+#ENDIF(MATIO_FOUND)

+ 1 - 1
core/CMakeLists.txt

@@ -5,7 +5,7 @@
 set(the_library "core")
 
 #add linkage dependencies to other libraries here
-set("nice_${the_library}_LINKING_DEPENDENCIES"  ${Boost_LIBRARIES} ${OPENGL_LIBRARIES} ${GLUT_LIBRARIES} ${QT_LIBRARIES} ${IPP_LIBRARIES} ${ImageMagick_LIBRARIES})
+set("nice_${the_library}_LINKING_DEPENDENCIES"  ${Boost_LIBRARIES} ${OPENGL_LIBRARIES} ${GLUT_LIBRARIES} ${QT_LIBRARIES} ${IPP_LIBRARIES} ${LINAL_LIBRARIES} ${ImageMagick_LIBRARIES})
 if(MATIO_FOUND)
   list(APPEND nice_${the_library}_LINKING_DEPENDENCIES ${MATIO_LIBRARIES})
 endif(MATIO_FOUND)

+ 1 - 1
core/tutorial/progs/05_matio.cpp

@@ -89,7 +89,7 @@ int main(int argc, char** argv) {
 
 #ifdef NICE_USELIB_LINAL
 	// Calculate singular value decomposition
-	NICE::SVD matrix_svd(matrix);
+    NICE::SVD<double> matrix_svd(matrix);
 
 	std::cout << "Vt:\n";
 	printMatrix(matrix_svd.getVt());