Sascha Haeberling | 1d2624a | 2013-07-23 19:00:21 -0700 | [diff] [blame] | 1 | # Ceres Solver - A fast non-linear least squares minimizer |
| 2 | # Copyright 2013 Google Inc. All rights reserved. |
| 3 | # http://code.google.com/p/ceres-solver/ |
| 4 | # |
| 5 | # Redistribution and use in source and binary forms, with or without |
| 6 | # modification, are permitted provided that the following conditions are met: |
| 7 | # |
| 8 | # * Redistributions of source code must retain the above copyright notice, |
| 9 | # this list of conditions and the following disclaimer. |
| 10 | # * Redistributions in binary form must reproduce the above copyright notice, |
| 11 | # this list of conditions and the following disclaimer in the documentation |
| 12 | # and/or other materials provided with the distribution. |
| 13 | # * Neither the name of Google Inc. nor the names of its contributors may be |
| 14 | # used to endorse or promote products derived from this software without |
| 15 | # specific prior written permission. |
| 16 | # |
| 17 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
| 18 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 19 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
| 20 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE |
| 21 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
| 22 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
| 23 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
| 24 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
| 25 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
| 26 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
| 27 | # POSSIBILITY OF SUCH DAMAGE. |
| 28 | # |
| 29 | # Author: pablo.speciale@gmail.com (Pablo Speciale) |
| 30 | # |
| 31 | |
| 32 | # Default locations to search for on various platforms. |
| 33 | LIST(APPEND SEARCH_LIBS /usr/lib) |
| 34 | LIST(APPEND SEARCH_LIBS /usr/local/lib) |
| 35 | LIST(APPEND SEARCH_LIBS /usr/local/homebrew/lib) # Mac OS X |
| 36 | LIST(APPEND SEARCH_LIBS /opt/local/lib) |
| 37 | |
| 38 | LIST(APPEND SEARCH_HEADERS /usr/include) |
| 39 | LIST(APPEND SEARCH_HEADERS /usr/local/include) |
| 40 | LIST(APPEND SEARCH_HEADERS /usr/local/homebrew/include) # Mac OS X |
| 41 | LIST(APPEND SEARCH_HEADERS /opt/local/include) |
| 42 | |
| 43 | # Locations to search for Eigen |
| 44 | SET(EIGEN_SEARCH_HEADERS ${SEARCH_HEADERS}) |
| 45 | LIST(APPEND EIGEN_SEARCH_HEADERS /usr/include/eigen3) # Ubuntu 10.04's default location. |
| 46 | LIST(APPEND EIGEN_SEARCH_HEADERS /usr/local/include/eigen3) |
| 47 | LIST(APPEND EIGEN_SEARCH_HEADERS /usr/local/homebrew/include/eigen3) # Mac OS X |
| 48 | LIST(APPEND EIGEN_SEARCH_HEADERS /opt/local/var/macports/software/eigen3/opt/local/include/eigen3) # Mac OS X |
| 49 | |
| 50 | # Google Flags |
| 51 | OPTION(GFLAGS |
| 52 | "Enable Google Flags." |
| 53 | ON) |
| 54 | |
| 55 | IF (GFLAGS) |
| 56 | MESSAGE("-- Check for Google Flags") |
| 57 | FIND_LIBRARY(GFLAGS_LIB NAMES gflags PATHS ${SEARCH_LIBS}) |
| 58 | IF (NOT EXISTS ${GFLAGS_LIB}) |
| 59 | MESSAGE(FATAL_ERROR |
| 60 | "Can't find Google Flags. Please specify: " |
| 61 | "-DGFLAGS_LIB=...") |
| 62 | ENDIF (NOT EXISTS ${GFLAGS_LIB}) |
| 63 | MESSAGE("-- Found Google Flags library: ${GFLAGS_LIB}") |
| 64 | FIND_PATH(GFLAGS_INCLUDE NAMES gflags/gflags.h PATHS ${SEARCH_HEADERS}) |
| 65 | IF (NOT EXISTS ${GFLAGS_INCLUDE}) |
| 66 | MESSAGE(FATAL_ERROR |
| 67 | "Can't find Google Flags. Please specify: " |
| 68 | "-DGFLAGS_INCLUDE=...") |
| 69 | ENDIF (NOT EXISTS ${GFLAGS_INCLUDE}) |
| 70 | MESSAGE("-- Found Google Flags header in: ${GFLAGS_INCLUDE}") |
| 71 | ENDIF (GFLAGS) |
| 72 | |
| 73 | # Google Logging |
| 74 | MESSAGE("-- Check for Google Log") |
| 75 | FIND_LIBRARY(GLOG_LIB NAMES glog PATHS ${SEARCH_LIBS}) |
| 76 | IF (NOT EXISTS ${GLOG_LIB}) |
| 77 | MESSAGE(FATAL_ERROR |
| 78 | "Can't find Google Log. Please specify: " |
| 79 | "-DGLOG_LIB=...") |
| 80 | ENDIF (NOT EXISTS ${GLOG_LIB}) |
| 81 | MESSAGE("-- Found Google Log library: ${GLOG_LIB}") |
| 82 | |
| 83 | FIND_PATH(GLOG_INCLUDE NAMES glog/logging.h PATHS ${SEARCH_HEADERS}) |
| 84 | IF (NOT EXISTS ${GLOG_INCLUDE}) |
| 85 | MESSAGE(FATAL_ERROR |
| 86 | "Can't find Google Log. Please specify: " |
| 87 | "-DGLOG_INCLUDE=...") |
| 88 | ENDIF (NOT EXISTS ${GLOG_INCLUDE}) |
| 89 | MESSAGE("-- Found Google Log header in: ${GLOG_INCLUDE}") |
| 90 | |
| 91 | # Eigen |
| 92 | MESSAGE("-- Check for Eigen 3.x") |
| 93 | FIND_PATH(EIGEN_INCLUDE NAMES Eigen/Core PATHS ${EIGEN_SEARCH_HEADERS}) |
| 94 | IF (NOT EXISTS ${EIGEN_INCLUDE}) |
| 95 | MESSAGE(FATAL_ERROR "Can't find Eigen. Try passing -DEIGEN_INCLUDE=...") |
| 96 | ENDIF (NOT EXISTS ${EIGEN_INCLUDE}) |
| 97 | MESSAGE("-- Found Eigen 3.x: ${EIGEN_INCLUDE}") |
| 98 | |
| 99 | |
| 100 | INCLUDE_DIRECTORIES( |
| 101 | ${GLOG_INCLUDE} |
| 102 | ${EIGEN_INCLUDE} |
| 103 | ) |