Commit Graph

135 Commits

Author SHA1 Message Date
Alex Stewart 0ec02c0a6c Move check for non-standard Eigen installs into FindEigen.cmake
- As part of adding support for detection of non-standard Homebrew
  install on OSX, an Eigen specific search directory was added to the
  search path in the main CMakeLists.  This commit moves that search
  into FindEigen.cmake.

Change-Id: Ia6142211961a0d1fdddeea77b83438e4ef94434f
2015-01-11 12:39:28 +00:00
Alex Stewart cbe694505e Autodetect gflags namespace.
- At version 2.1, gflags changed from using the google namespace, to
  using gflags by default.  However, it can be configured at build time
  to be something else (which would be google for legacy compatibility
  unless you were evil).
- Ceres previously assumed that gflags was in the google namespace.
- Now, FindGFlags.cmake extracts the namespace when gflags.h is found
  and saves it in GFLAGS_NAMESPACE.
- When building the tests and examples that require gflags,
  CERES_GFLAGS_NAMESPACE is defined to be the detected namespace, and
  all tests/examples now use CERES_GFLAGS_NAMESPACE:: instead of
  google:: when calling gflags functions.

Change-Id: Ia333df7a7e2f08ba9f26bbd339c3a785b88f04c4
2014-11-27 09:56:37 +00:00
Alex Stewart f4f753ab68 Fix empty Cache HELPSTRING parsing error on OS X 10.10 Yosemite.
- Without quotations, on Yosemite, CMake will fail on first configure,
  but will then work fine subsequently.  This is because if the
  HELPSTRING property is empty, without "" quotes, it is removed from
  the arguments list for set().

Change-Id: Ia60444695e9770b947f145a54e949c9eeae67fbb
2014-10-24 10:38:13 +01:00
Sameer Agarwal 79491a3f4a Solver::FullReport now reports build config.
The header of Summary::FullReport now looks like

Solver Summary (v 1.10.0-suitesparse-cxsparse-lapack-no_openmp)

                                     Original                  Reduced
Parameter blocks                        22122                    22122
Parameters                              66462                    66462
Residual blocks                         83718                    83718
Residual                               167436                   167436

Change-Id: Id1b81bbf90ba412d19e2dd3687eeb9d372b72c1b
2014-08-28 23:30:28 +00:00
Sameer Agarwal 031598295c Enable Eigen as sparse linear algebra library.
SPARSE_NORMAL_CHOLESKY and SPARSE_SCHUR can now be used
with EIGEN_SPARSE as the backend.

The performance is not as good as CXSparse. This needs to be
investigated. Is it because the quality of AMD ordering that
we are computing is not as good as the one for CXSparse? This
could be because we are working with the scalar matrix instead
of the block matrix.

Also, the upper/lower triangular story is not completely clear.
Both of these issues will be benchmarked and tackled in the
near future.

Also included in this change is a bunch of cleanup to the
SparseNormalCholeskySolver and SparseSchurComplementSolver
classes around the use of the of defines used to conditionally
compile out parts of the code.

The system_test has been updated to test EIGEN_SPARSE also.

Change-Id: I46a57e9c4c97782696879e0b15cfc7a93fe5496a
2014-07-31 22:05:34 -07:00
Alex Stewart 22b26cd7b7 Add release flags to iOS toolchain.
- Without explicitly specifying the flags for release compilation in
  the iOS toolchain file, no additional flags are passed and so the
  libraries were not being built with full optimisations, even though
  the CMAKE_BUILD_TYPE was 'Release'.

Change-Id: I742bab7589906b556640776d481491a8cc2303d4
2014-07-07 22:08:24 +01:00
Greg Coombe 2a5599f378 Fix Cmake error when using miniglog.
Create the glog include directories and library directories
only if we've already checked that the user is using
glog (and not miniglog).

Otherwise, @GLOG_INCLUDE_DIR@ and @GLOG_LIBRARY@ will be
empty and the generated files will cause Cmake errors.

Change-Id: Ia0ce9cf98f7d56c83b2285f72f45b8e0d5dc34c4
2014-06-04 23:21:33 +00:00
Sameer Agarwal 082d9e2a1b Add iOS.cmake from the ios-cmake project.
URL: https://github.com/cristeab/ios-cmake
Commit: 86dc085f0d5ed955cd58e2657cc3efc7c1aabbc8

Change-Id: I8fe6023d4cb6655b5a724e8b695fdae87ce3b685
2014-05-13 16:48:25 -07:00
Alex Stewart 2f8fb218f0 Adding function to update CMake cache variables and preserve help.
- Previously we were replicating the same two lines to update a cache
  variable whilst preserving its help string.
- This commit adds a function which wraps up this common operation into
  a single line.

Change-Id: Ic78a5adf5d59262bbbcec1e353ded7620391e862
2014-05-13 20:57:39 +01:00
Alex Stewart d48e705022 Configure config.h and include it from the build directory.
- Previously we overwrote the default (empty) config.h in the source
  tree with a configured config.h, generated using the current compile
  options.
- This was undesirable as it could lead to inadvertant commits of the
  generated config.h.

- This patch moves the default config.h to <src>/config/ceres/internal,
  separate from the other headers, thus if Ceres is compiled without
  CMake this directory will now also have to be included.  This
  directory is _not_ added to the CMake include directories for Ceres
  (thus the default config.h is never used when compiling with CMake).
- When using CMake, the generated config.h is now placed in
  <build>/config/ceres/internal, which is in turn added to the include
  directories for Ceres when it is compiled, and the resulting config.h
  is copied to ceres/internal when installed.

Change-Id: Ib1ba45e66e383ade2ebb08603af9165c1df616f2
2014-05-13 20:23:20 +01:00
Alex Stewart ea76585068 Adding autogenerated Ceres config.h to #define Ceres compile options.
- Previously we passed all compile options to Ceres via add_definitions
  in CMake.  This was fine for private definitions (used only by Ceres)
  but required additional work for public definitions to ensure they
  were correctly propagated to clients via CMake using
  target_compile_definitions() (>= 2.8.11) or add_definitions().
- A drawback to these approaches is that they did not work for chained
  dependencies on Ceres, as in if in the users project B <- A <- Ceres,
  then although the required Ceres public compile definitions would
  be used when compiling A, they would not be propagated to B.

- This patch replaces the addition of compile definitions via
  add_definitions() with an autogenerated config.h header which
  is installed with Ceres and defines all of the enabled Ceres compile
  options.
- This removes the need for the user to propagate any compile
  definitions in their projects, and additionally allows post-install
  inspect of the options with which Ceres was compiled.

Change-Id: Idbdb6abdad0eb31e7540370e301afe87a07f2260
2014-05-09 10:57:31 +01:00
Sameer Agarwal 7088a08f5d Fix some 80col violations and reflow the comments in cmake.in file.
Change-Id: I4c65c89b794845aeef69159a03350c727e2ee812
2014-05-05 09:02:05 -07:00
Alex Stewart 5ffe06019a Export Ceres compile definitions to targets compiled against Ceres.
- Previously all Ceres compile definitions were private to Ceres, that
  is they were not exported to users via the CMake export mechanism.
- Now that we use compile definitions in public (installed) Ceres
  headers, we need to export the Ceres compile definitions.
- If we did not do this, then the client's code 'see's' a different
  version of the Ceres headers to those which were in fact compiled,
  or in the case of shared_ptr, may not find the required header.

- This patch makes use of the new, in CMake 2.8.11, function:
  target_compile_definitions() to export all of the Ceres compile
  definitions using CMake's export functionality.
- For CMake versions < 2.8.11, we have to use the blunter instrument of
  calling add_definitions() in CeresConfig.cmake (invoked by a call to
  find_package(Ceres)).  This is messy because it ends up adding the
  Ceres compile definitions to any target declared in the user's code
  after the call to find_package(Ceres).  Although this should do no
  harm as all of our defines are prefaced with CERES_, so any
  unintentional name clashes are unlikely.

Change-Id: I5dea80949190eaf4fb08ea4ac568ce28c32dd4e0
2014-05-02 13:33:24 +00:00
Sergey Sharybin ceb7a3beaa Fix compilation error when using G++ compiler
This compiler defines shared_ptr in std::tr1 namespace, but
for this <tr1/memory> is to be included. Further, this compiler
also does have <memory> header which confused previous shared
pointer check.

Simplified logic around defines now, so currently we've got:
- CERES_TR1_MEMORY_HEADER defined if <tr1/memory> is to be
  used for shared_ptr, otherwise <memory> is to be used.
- CERES_TR1_SHARED_PTR defined if shared_ptr is defined in
  std::tr1 namespace, otherwise it's defined in std namespace.

All the shared_ptr checks are now moved to own file FindSharedPtr
which simplifies main CMakeLists.

Change-Id: I558a74793baaa0bd088801910a356be4ef17c31b
2014-04-28 15:37:59 +00:00
Andreas Franek 6cb82b609a METIS_FOUND is never set.
Changed the commit to fit the setting of the other *_FOUND definitions.

Change-Id: I3f0d11a9a65a0decd1a6a6b28a4a4823eb74c9c3
2014-02-20 17:52:51 +01:00
Alex Stewart 9697a08a2b Defining CERES_FOUND in addition to Ceres_FOUND in CeresConfig.
- Previously we relied on FindPackage() to define Ceres_FOUND when
  find_package(Ceres) was called.
- This is fine, but users might legitimately expect the variable to be
  CERES_FOUND given the form of CERES_INCLUDE_DIRS/LIBRARIES.
- As there is an inconsistency in the CMake recommended names when
  FindPackage() is called in Module vs Config form, we now explicltly
  define both.

Change-Id: I54bce9aa112b684d26b60a9ae4d11eb7925a6ee5
2013-11-23 10:12:35 +00:00
Alex Stewart 4d0e626b55 Fixing gflags HINTS variable names (adding missing “_DIR”).
- The HINTS variables for gflags were incorrectly used as
  GFLAGS_[INCLUDE/LIBRARY]_HINTS when they should have been
  GFLAGS_[INCLUDE/LIBRARY]_DIR_HINTS as per the docs.
- Also removing a completed TODO in the main CMakeLists.
- Updating method of extracting current directory in CeresConfig.cmake
  to avoid use of CMAKE_CURRENT_LIST_DIR, which was not present in
  CMake =< v2.8.3.

Change-Id: I42ae696e3b785febe48688d912f0f343e8947cb0
2013-11-15 14:51:21 +00:00
Alex Stewart 54fc942367 Removing incorrect specialisation of install dirs on Windows.
- Previously on Windows the leaf include & lib install directories
  passed to CeresConfig.cmake.in when configured where capitalised on
  Windows.
- This capitalisation was incorrect, as the actual paths used are
  specified in the install() statements and are always in the standard
  lower-case form.
- This likely did not cause any issues previously as although NTFS is
  case sensitive, the Win32 API is not, and most applications access
  files through the Win32 API, and are thus not case-sensitive.

Change-Id: I335b6e2d10a1c64f320c2a1a68eeda1b22344e73
2013-11-14 11:42:00 +00:00
Alex Stewart fcbbb11e37 Ensure build paths for dependencies are searched in FindPackage(Ceres)
- Append to hint locations used by FindPackage scripts for public
  dependencies (glog & Eigen) the locations of the dependencies when
  Ceres was built.
- This means that the user should not have to supply them again when
  using find_package(Ceres) even if they are installed in a
  non-standard location.

Change-Id: I9550de91025ba47f01f1ea3c3fefe80fe38d14ff
2013-11-13 22:22:30 +00:00
Alex Stewart 7899e45d37 Fixing a documentation typo, DIRS -> DIR in HINTS variables.
Change-Id: I42b75a5e0b8a451c3a43ab29d0c14856e4b86ab8
2013-11-13 21:08:27 +00:00
Alex Stewart b5be6b9c06 Cleaning up messages output when SuiteSparse is not found.
- Automatically generated failure message now provides more
  information as to which sub-modules are missing.

Change-Id: I6eed94af49263540b8f87917b75c41b8f49658a0
2013-11-05 21:12:48 +00:00
Alex Stewart 69bd65ff43 Downgrading warning messages when optional deps are not found.
- Now when find_package() is called for a dependency without the
  REQUIRED or QUIET qualifiers, we emit no priority (above STATUS, but
  below WARNING) messages and continue.

Change-Id: I8cdeda7a8f6c91d45fb7f24fb366244c6c9b66e1
2013-11-04 23:01:14 +00:00
Alex Stewart b0a8731fcd Removing duplicate SuiteSparse found message.
- Also flipping ordering of variables in
  find_package_handle_standard_args() so that the automatically
  generated message prints the include directories, not TRUE.

Change-Id: I2bf62eacd5c96f27152e9542b9a74651243a584e
2013-11-04 20:32:40 +00:00
Alex Stewart 6fed9fe0de Fix FindPackage scripts to emit warnings, not errors if not found.
- Previously we used message priority: SEND_ERROR when a package was
  not found and find_package() was called without QUIET or REQUIRED,
  which emits an error message, and prevents generation, but continues
  configuration.
- The fact SEND_ERROR induces an error message was confusing for users
  as it implies that something bad has happened and they cannot
  continue, when in fact we were disabling the option in question
  and were thus able to continue, all they had to do was re-configure.

- This commit also reorders the search lists for includes/libraries
  so that we always search user installed locations (e.g. /usr/local)
  before system installed locations.  Thus we will now always prefer
  a user install to a system install if both are available, which is
  likely to be the users desired intention.

Change-Id: Ide84919f27d3373f31282f70c685720cd77a6723
2013-11-04 19:08:17 +00:00
Alex Stewart 21e7c0fcc7 Adding option for static/shared CRT in MSVC & Windows fixes.
- MSVC users can now choose whether to use the static or shared
  C-Run Time (CRT) libraries explicitly.
- FindPackage() scripts now check that the lowercase libraries match
  the expected library names, as Windows uses CamelCase for some
  library names (other OSs don't).

Change-Id: Icbba5e9bf80181a5437e5009bdda1c12934bc6f3
2013-10-19 14:25:07 +01:00
Alex Stewart 78cc2c4719 Cleaning up exported CeresConfig.cmake.
- Adding FindPackage scripts for all of Ceres dependencies.
- Moving depend.cmake contents to CeresConfig.cmake and cleaning up
  search for Ceres & required dependencies, no longer push Ceres
  options into client.
- Fixing uninstall to remove ceres include root directory.
- Fixing main CMakeLists to install miniglog header if enabled.
- Making miniglog library shared/static with Ceres library.

Change-Id: If926bebd11720230c5136597ccba672394ed9777
2013-10-17 19:13:08 +00:00
Alex Stewart 003a1624f4 Fixing issue with CMake >= 2.8.10.2 FindPackageHandleStandardArgs.
- Prior to CMake 2.8.10.2 FindPackageHandleStandardArgs was safe if
  passed <LIBRARY>_FOUND as a variable to validate, this is no longer
  true for newer CMake releases.
- Also adding missing SUITESPARSEQR_FOUND requirement for
  SUITESPARSE_FOUND.

Change-Id: I0fdde56585fc736bdfbf433901ad17ee9f1cc216
2013-10-09 18:39:43 +00:00
Alex Stewart 0b07d3e9f9 Making all config options in CMake & SuiteSparse cleanup.
- Also marking all library and include directories found via
  find_library/path advanced (not directly visible in CMake GUI unless
  toggled to show advanced options).
- Updating documentation to reflect SuiteSparse requirements on Ubuntu
  and ability to control build options in CMake GUI.
- Splitting out all SuiteSparse related find_XX directives into a
  FindSuiteSparse script.

Change-Id: I0d69e02392ec547a7c365ba3e06f2ebc61cacf16
2013-10-07 19:50:24 +01:00
Sameer Agarwal c24a4ec6fb Cmake refactoring
1. Use CMake FindLAPACK and FindBLAS Modules.
2. Remove SEARCH_HEADERS and SEARCH_LIBS and replace them with
CMAKE variables. This leads to simplification of the FIND_LIBRARY
and FIND_PATH calls.
3. Make miniglog a fallback when glog is not present and the
user indicates MINIGLOG=OFF.
4. Add time.h to miniglog.
5. Remove shared library building.

Change-Id: I8a97156d3d7cf645fbbfe8e571761bc16c89f43f
2013-08-25 23:56:48 -07:00
Joydeep Biswas aa20a6dc1b Updated depend.cmake to follow CMake IF convention.
Change-Id: I1e86cf134d3f40852033ae73f36d9143b389a918
2013-05-19 19:17:50 +00:00
Pablo Speciale 6bcb8d9c30 Compiling against static or shared library
Change-Id: I3fb35e9a49f90b8894f59dde49c90a7c2dd74b0a
2013-03-25 17:06:11 -07:00
Pablo Speciale 55b6c966c4 * Fixed the location of the Ceres doc (once installed with 'make install')
* Doing 'make ceres_docs' can be used to create the documentation (if the BUILD_DOCUMENTATION=ON)
* Included the copyright boilerplate for FindSphinx.cmake

Change-Id: Iea21eba9e68384b4fe72c85fa88c76b0ba8a7a1d
2013-03-20 17:56:47 -07:00
Pablo Speciale 16dbf11626 Added CeresConfig.cmake based on this example:
https://projects.kde.org/projects/kde/kdeexamples/repository/revisions/master/show/buildsystem/HowToInstallALibrary

Change-Id: I130cac5d43d9fbbf359abc04d3691e25c4e2bb63
2013-03-20 18:38:27 +00:00
Pablo Speciale c51b11c104 Sphinx and CMake, based on this example:
http://ericscottbarr.com/blog/2012/03/sphinx-and-cmake-beautiful-documentation-for-c-projects/

The 'docs/CMakeLists.txt' file was deleted in this commit: 0abfb8f46f

Thanks to Arnaud Gelas, he has passed some links:
   https://github.com/InsightSoftwareConsortium/ITKExamples/blob/master/CMake/FindSphinx.cmake
   https://github.com/InsightSoftwareConsortium/ITKExamples/blob/master/CMakeLists.txt#L120-L154

Change-Id: Ic65e7f8ec5280d1e71a897a144417a21761c5553
2013-03-19 21:05:31 +00:00
Arnaud Gelas 9ad27e8e9f Add one uninstall target to remove all installed files
Change-Id: Ifcf89a6c27b25f28403d95a50e29c093a525298f
2012-08-22 10:44:51 +02:00