1 | # CMake file for levmar's MEX-file; see http://www.cmake.org
|
---|
2 | # Requires FindMatlab.cmake included with cmake
|
---|
3 |
|
---|
4 | PROJECT(LEVMARMEX)
|
---|
5 | #CMAKE_MINIMUM_REQUIRED(VERSION 1.4)
|
---|
6 |
|
---|
7 | INCLUDE("C:/Program Files/CMake 2.4/share/cmake-2.4/Modules/FindMatlab.cmake")
|
---|
8 |
|
---|
9 | # f2c is sometimes equivalent to libF77 & libI77; in that case, set HAVE_F2C to 0
|
---|
10 | SET(HAVE_F2C 1 CACHE BOOL "Do we have f2c or F77/I77?" )
|
---|
11 |
|
---|
12 | # the directory where the lapack/blas/f2c libraries reside
|
---|
13 | SET(LAPACKBLAS_DIR /usr/lib CACHE PATH "Path to lapack/blas libraries")
|
---|
14 |
|
---|
15 | # the directory where levmar.h resides
|
---|
16 | SET(LM_H_DIR .. CACHE PATH "Path to levmar.h")
|
---|
17 | # the directory where the levmar library resides
|
---|
18 | SET(LEVMAR_DIR .. CACHE PATH "Path to levmar library")
|
---|
19 |
|
---|
20 | # actual names for the lapack/blas/f2c libraries
|
---|
21 | SET(LAPACK_LIB lapack CACHE STRING "The name of the lapack library")
|
---|
22 | SET(BLAS_LIB blas CACHE STRING "The name of the blas library")
|
---|
23 | IF(HAVE_F2C)
|
---|
24 | SET(F2C_LIB f2c CACHE STRING "The name of the f2c library")
|
---|
25 | ELSE(HAVE_F2C)
|
---|
26 | SET(F77_LIB libF77 CACHE STRING "The name of the F77 library")
|
---|
27 | SET(I77_LIB libI77 CACHE STRING "The name of the I77 library")
|
---|
28 | ENDIF(HAVE_F2C)
|
---|
29 |
|
---|
30 | ########################## NO CHANGES BEYOND THIS POINT ##########################
|
---|
31 |
|
---|
32 | INCLUDE_DIRECTORIES(${LM_H_DIR})
|
---|
33 | LINK_DIRECTORIES(${LAPACKBLAS_DIR} ${LEVMAR_DIR})
|
---|
34 |
|
---|
35 | SET(SRC levmar.c)
|
---|
36 |
|
---|
37 | # naming conventions for the generated file's suffix
|
---|
38 | IF(WIN32)
|
---|
39 | SET(SUFFIX ".mexw32")
|
---|
40 | ELSE(WIN32)
|
---|
41 | SET(SUFFIX ".mexglx")
|
---|
42 | ENDIF(WIN32)
|
---|
43 |
|
---|
44 | SET(OUTNAME "levmar${SUFFIX}")
|
---|
45 |
|
---|
46 | ADD_LIBRARY(${OUTNAME} MODULE ${SRC})
|
---|
47 |
|
---|
48 | IF(HAVE_F2C)
|
---|
49 | ADD_CUSTOM_COMMAND(OUTPUT ${OUTNAME}
|
---|
50 | DEPENDS ${SRC}
|
---|
51 | COMMAND mex
|
---|
52 | ARGS -O -I${LM_H_DIR} ${SRC} -I${MATLAB_INCLUDE_DIR} -L${LAPACKBLAS_DIR} -L${LEVMAR_DIR} -L${MATLAB_MEX_LIBRARY} -llevmar -l${LAPACK_LIB} -l${BLAS_LIB} -l${F2C_LIB} -output ${MATLAB_LIBRARIES} ${OUTNAME})
|
---|
53 | ELSE(HAVE_F2C)
|
---|
54 | ADD_CUSTOM_COMMAND(OUTPUT ${OUTNAME}
|
---|
55 | DEPENDS ${SRC}
|
---|
56 | COMMAND mex
|
---|
57 | ARGS -O -I${LM_H_DIR} ${SRC} -I${MATLAB_INCLUDE_DIR} -L${LAPACKBLAS_DIR} -L${LEVMAR_DIR} -L${MATLAB_MEX_LIBRARY} -llevmar -l${LAPACK_LIB} -l${BLAS_LIB} -l${F77_LIB} -l${I77_LIB} ${MATLAB_LIBRARIES} -output ${OUTNAME})
|
---|
58 | ENDIF(HAVE_F2C)
|
---|