Building Ceres w/ CMake Windows Visual Studio

1,000 views
Skip to first unread message

Eric

unread,
Jan 5, 2016, 9:21:45 PM1/5/16
to Ceres Solver
I am trying to build Ceres on a Windows 10 64-bit machine - using CMake to generate a Visual Studio 2013 project.  I would also like to include SuiteSparse.

As suggested, I followed the instructions at https://github.com/jlblancoc/suitesparse-metis-for-windows and was able to install SuiteSparse (but with some issues in connection with Metis - which is probably info for a separate post - for now I build SuiteSparse with Metis disabled).  Anywho, I seem to have SuiteSparse built on my machine.  I also have Eigen, glog and gflags built.

Now I'm trying to build the ceres project using the CMake gui in Windows.  I'm disabling CXSparse - but I think that's fine since I'm going to use SuiteSparse instead.  However, I'm having trouble getting CMake to include SuiteSparse.

Things that seemed to work:
 - I created two new entries SUITESPARSE_INCLUDE_DIR & SUITESPARSE_LIBRARY_DIR  (I also tried the _HINTS variant which also seemed to work) and set those to the paths of my SuiteSparse install directories.

The thing that *does not* seem to work:
 - CMake keeps complaining that "A library with BLAS API not found' and therefore can't enable Lapack and thus can't enable SuiteSparse!  I tried to create an entry BLAS_LIBRARY_DIR and point to the 'install/lib64/lapack_blas_windows' directory that was created when I built SuiteSparse.  However CMake is not happy with that and can't seem to find the BLAS libraries.  Is there a different entry that I must define to get CMake to see my BLAS and LAPACK libraries?


Cenek

unread,
Jan 5, 2016, 11:58:46 PM1/5/16
to Ceres Solver
Hi Eric,

it has been some time since I compiled it last time (ceres version 1.10), but as I look in my CMake config I have the entries LAPACK_lapack_LIBRARY and BLAS_blas_LIBRARY pointed to the x64 Lapack and Blas .lib files. Maybe adding those could help you?


Dne středa 6. ledna 2016 11:21:45 UTC+9 Eric napsal(a):

Björn Piltz

unread,
Jan 6, 2016, 4:28:33 AM1/6/16
to ceres-...@googlegroups.com
Hi Eric,
I have a script that builds Ceres which contains this line:

cmake %CERES_SOLVER_DIR%^
 -G %CMAKE_GENERATOR%^
 -DCMAKE_INSTALL_PREFIX=%BASEDIR%/%INSTALL_DIR%^
 -DEIGEN_INCLUDE_DIR=%EIGEN_DIR%^
 -DSUITESPARSE_INCLUDE_DIR_HINTS=%BASEDIR%/suitesparse_build_%BUILD_IDENTIFIER%/install/include/suitesparse^
 -DSUITESPARSE_LIBRARY_DIR_HINTS=%BASEDIR%/suitesparse_build_%BUILD_IDENTIFIER%/install/%SUITESPARSE_LIB_DIR%^
 -DSUITESPARSE=ON^
 -DBLAS_blas_LIBRARY=%BASEDIR%/suitesparse_build_%BUILD_IDENTIFIER%/install/%SUITESPARSE_LIB_DIR%/lapack_blas_windows/libblas.lib^
 -DLAPACK_lapack_LIBRARY=%BASEDIR%/suitesparse_build_%BUILD_IDENTIFIER%/install/%SUITESPARSE_LIB_DIR%/lapack_blas_windows/liblapack.lib^
 -DLAPACK=ON^
 -DGFLAGS=OFF^
 -DCMAKE_CXX_FLAGS="/DWIN32 /D_WINDOWS /W3 /GR /EHsc /MP /wd4267"^
 -DCMAKE_EXE_LINKER_FLAGS="/machine:%PLATFORM% shlwapi.lib"^
 -DCMAKE_SHARED_LINKER_FLAGS="/machine:%PLATFORM% shlwapi.lib"^
 -DGLOG_INCLUDE_DIR_HINTS=%GLOG_DIR%/src/windows/^
 -DGLOG_LIBRARY_DIR_HINTS=%BASEDIR%/%INSTALL_DIR%/lib^
 -DSCHUR_SPECIALIZATIONS=OFF^
 -DBUILD_SHARED_LIBS=ON^
 -DBUILD_EXAMPLES=OFF^
 -DBUILD_TESTING=OFF^

I hope that helps. You might want to include gflags to enable tests and examples.

Björn

Björn Piltz

www.blikken.de

Blikken Imaging UG(Haftungsbeschränkt)



--
You received this message because you are subscribed to the Google Groups "Ceres Solver" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ceres-solver...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ceres-solver/88d3c05b-41d0-48a3-aa33-084eb34f8713%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Eric

unread,
Jan 7, 2016, 10:23:11 PM1/7/16
to Ceres Solver
Cenek & Bjorn,

That was exactly it!

I had to define the additional filepath entries BLAS_blas_LIBRARY and LAPACK_lapack_LIBRARY.  Then hit 'configure' (In the CMake Gui (I'm still not versed enough in what's going on behind the scenes to use the CMake command line!))

I had to repeat the process of defining some of these paths (esp. the BLAS_blas_LIBRARY) (and being sure to keep marking LAPACK, and SUITESPARSE as build options) over multiple 'Configures' as CMake was slowly getting an idea of where everything was.  

So, basically, by defining those entries and carefully (re-)configuring in CMake, I was successful in generating project I needed.

Thank you!
Reply all
Reply to author
Forward
0 new messages