daily pastebin goal
9%
SHARE
TWEET

CMakelists.txt

a guest Sep 24th, 2014 620 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # levmar CMake file; see http://www.cmake.org and
  2. #                        http://www.insightsoftwareconsortium.org/wiki/index.php/CMake_Tutorial
  3.  
  4. CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
  5. PROJECT(LEVMAR)
  6.  
  7. SET(HAVE_LAPACK 1 CACHE BOOL "Do we have LAPACK/BLAS?")
  8. # the directory where the lapack/blas/f2c libraries reside
  9. SET(LAPACKBLAS_DIR "/usr/lib" CACHE PATH "Path to lapack/blas libraries")
  10. SET(NEED_F2C 1 CACHE BOOL "Do we need either f2c or F77/I77?")
  11. SET(HAVE_PLASMA 0 CACHE BOOL "Do we have PLASMA parallel linear algebra library?")
  12. IF(HAVE_PLASMA)
  13.  SET(PLASMA_DIR "/usr/local/PLASMA" CACHE PATH "Path to PLASMA root")
  14. ENDIF(HAVE_PLASMA)
  15. SET(LINSOLVERS_RETAIN_MEMORY 1 CACHE BOOL "Should linear solvers retain working memory between calls? (non-reentrant!)")
  16. SET(LM_DBL_PREC 1 CACHE BOOL "Build double precision routines?")
  17. SET(LM_SNGL_PREC 1 CACHE BOOL "Build single precision routines?")
  18. OPTION(BUILD_DEMO "Build demo program?" TRUE)
  19.  
  20. # actual names for the lapack/blas/f2c libraries
  21. SET(LAPACKBLAS_LIB_NAMES "lapack;blas" CACHE STRING "The name of the lapack & blas libraries")
  22. #SET(LAPACKBLAS_LIB_NAMES "mkl_solver_sequential;mkl_intel_c;mkl_sequential;mkl_core" CACHE STRING "The name of the lapack library") # MKL
  23. IF(NEED_F2C)
  24.   SET(F2C_LIB_NAME f2c CACHE STRING "The name of the f2c or F77/I77 library")
  25.   # f2c is sometimes equivalent to libF77 & libI77
  26.   #SET(F2C_LIB_NAME "libF77;libI77" CACHE STRING "The name of the f2c or F77/I77 library")
  27. ELSE(NEED_F2C)
  28.   SET(F2C_LIB_NAME "" CACHE STRING "The name of the f2c or F77/I77 library")
  29. ENDIF(NEED_F2C)
  30.  
  31. # actual names for the PLASMA libraries
  32. IF(HAVE_PLASMA)
  33.   SET(PLASMA_LIB_NAMES "plasma;coreblas;quark;lapacke" CACHE STRING "The names of the PLASMA libraries")
  34. ENDIF(HAVE_PLASMA)
  35.  
  36.  
  37. IF(0)
  38. # treat paths relative to the source dir.
  39. IF(COMMAND CMAKE_POLICY)
  40.   CMAKE_POLICY(SET CMP0015 NEW)
  41. ENDIF(COMMAND CMAKE_POLICY)
  42. ENDIF(0)
  43.  
  44. # compiler flags
  45. #ADD_DEFINITIONS(-DLINSOLVERS_RETAIN_MEMORY) # do not free memory between linear solvers calls
  46. #REMOVE_DEFINITIONS(-DLINSOLVERS_RETAIN_MEMORY) # free memory between calls
  47.  
  48. ########################## NO CHANGES BEYOND THIS POINT ##########################
  49.  
  50. CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/levmar.h.in ${CMAKE_CURRENT_SOURCE_DIR}/levmar.h)
  51.  
  52. INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR})
  53. IF(HAVE_PLASMA)
  54.  INCLUDE_DIRECTORIES(${PLASMA_DIR}/include ${PLASMA_DIR}/quark)
  55. ENDIF(HAVE_PLASMA)
  56.  
  57. # PLASMA headers in Axb.c should be compiled as C++
  58. IF(HAVE_PLASMA)
  59.   SET_SOURCE_FILES_PROPERTIES(Axb.c PROPERTIES LANGUAGE CXX)
  60. ENDIF(HAVE_PLASMA)
  61.  
  62. # levmar library source files
  63. ADD_LIBRARY(levmar STATIC
  64.   lm.c Axb.c misc.c lmlec.c lmbc.c lmblec.c lmbleic.c
  65.   levmar.h misc.h compiler.h
  66. )
  67.  
  68. # demo program
  69. IF(BUILD_DEMO)
  70.   SET(LIBS levmar)
  71.  
  72.   LINK_DIRECTORIES(${CMAKE_BINARY_DIR}) # location of the levmar library
  73.   LINK_DIRECTORIES(${LAPACKBLAS_DIR})
  74.  
  75. # libraries the demo depends on
  76.   IF(HAVE_PLASMA)
  77.     LINK_DIRECTORIES(${PLASMA_DIR}/lib)
  78.     SET(LIBS ${LIBS} ${PLASMA_LIB_NAMES})
  79.   ENDIF(HAVE_PLASMA)
  80.  
  81.   IF(HAVE_LAPACK)
  82.     IF(NEED_F2C)
  83.       SET(LIBS ${LIBS} ${LAPACKBLAS_LIB_NAMES} ${F2C_LIB_NAME})
  84.     ELSE(NEED_F2C)
  85.       SET(LIBS ${LIBS} ${LAPACKBLAS_LIB_NAMES})
  86.     ENDIF(NEED_F2C)
  87.   ENDIF(HAVE_LAPACK)
  88.  
  89.   ADD_EXECUTABLE(lmdemo lmdemo.c levmar.h)
  90.   TARGET_LINK_LIBRARIES(lmdemo -u MAIN__  ${LIBS})
  91.   MESSAGE(STATUS "lmdemo will be linked against ${LIBS}")
  92.  
  93. # make sure that the library is built before the demo
  94.   ADD_DEPENDENCIES(lmdemo levmar)
  95. ENDIF(BUILD_DEMO)
  96.  
  97. #SUBDIRS(matlab)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top