blob: 275a440e650102ec5d4f8bb973a95c1291d59181 [file] [log] [blame]
Sascha Haeberling1d2624a2013-07-23 19:00:21 -07001# 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.
33LIST(APPEND SEARCH_LIBS /usr/lib)
34LIST(APPEND SEARCH_LIBS /usr/local/lib)
35LIST(APPEND SEARCH_LIBS /usr/local/homebrew/lib) # Mac OS X
36LIST(APPEND SEARCH_LIBS /opt/local/lib)
37
38LIST(APPEND SEARCH_HEADERS /usr/include)
39LIST(APPEND SEARCH_HEADERS /usr/local/include)
40LIST(APPEND SEARCH_HEADERS /usr/local/homebrew/include) # Mac OS X
41LIST(APPEND SEARCH_HEADERS /opt/local/include)
42
43# Locations to search for Eigen
44SET(EIGEN_SEARCH_HEADERS ${SEARCH_HEADERS})
45LIST(APPEND EIGEN_SEARCH_HEADERS /usr/include/eigen3) # Ubuntu 10.04's default location.
46LIST(APPEND EIGEN_SEARCH_HEADERS /usr/local/include/eigen3)
47LIST(APPEND EIGEN_SEARCH_HEADERS /usr/local/homebrew/include/eigen3) # Mac OS X
48LIST(APPEND EIGEN_SEARCH_HEADERS /opt/local/var/macports/software/eigen3/opt/local/include/eigen3) # Mac OS X
49
50# Google Flags
51OPTION(GFLAGS
52 "Enable Google Flags."
53 ON)
54
55IF (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}")
71ENDIF (GFLAGS)
72
73# Google Logging
74MESSAGE("-- Check for Google Log")
75FIND_LIBRARY(GLOG_LIB NAMES glog PATHS ${SEARCH_LIBS})
76IF (NOT EXISTS ${GLOG_LIB})
77 MESSAGE(FATAL_ERROR
78 "Can't find Google Log. Please specify: "
79 "-DGLOG_LIB=...")
80ENDIF (NOT EXISTS ${GLOG_LIB})
81MESSAGE("-- Found Google Log library: ${GLOG_LIB}")
82
83FIND_PATH(GLOG_INCLUDE NAMES glog/logging.h PATHS ${SEARCH_HEADERS})
84IF (NOT EXISTS ${GLOG_INCLUDE})
85 MESSAGE(FATAL_ERROR
86 "Can't find Google Log. Please specify: "
87 "-DGLOG_INCLUDE=...")
88ENDIF (NOT EXISTS ${GLOG_INCLUDE})
89MESSAGE("-- Found Google Log header in: ${GLOG_INCLUDE}")
90
91# Eigen
92MESSAGE("-- Check for Eigen 3.x")
93FIND_PATH(EIGEN_INCLUDE NAMES Eigen/Core PATHS ${EIGEN_SEARCH_HEADERS})
94IF (NOT EXISTS ${EIGEN_INCLUDE})
95 MESSAGE(FATAL_ERROR "Can't find Eigen. Try passing -DEIGEN_INCLUDE=...")
96ENDIF (NOT EXISTS ${EIGEN_INCLUDE})
97MESSAGE("-- Found Eigen 3.x: ${EIGEN_INCLUDE}")
98
99
100INCLUDE_DIRECTORIES(
101 ${GLOG_INCLUDE}
102 ${EIGEN_INCLUDE}
103 )