Currently, the logic for exporting symbols is rather complicated: when
tests are enabled internal symbols are exported in addition to the
public symbols. Such logic causes several problems. (1) Test binaries
link against a Ceres build that is different from the final release
since fewer optimizations are applied if more symbols are exported. (2)
Also, some toolchains hide symbols by default breaking the existing
logic eventually causing linker errors.
Since internal symbols are not intended to be used outside of the
project, we can compile them into object files and use exactly the same
binary code both for the final build and the tests without relying on
conditionals.
By default, all symbols are now hidden unless annotated as public.
Internal symbols are explicitly marked as not being exported in case
users chose not to hide symbols by default.
Change-Id: I589dd10be2f6f438508783cf99d141af0120057b
1. Add CUDADenseCholesky64Bit, CUDADenseCholesky32Bit, & tests.
CUDADenseCholesky32Bit uses the legacy versions of potrf/potrs
in cuSolverDN, while CUDADenseCholesky64Bit uses the new 64-bit
versions available since Cuda 11.1. The legacy versions are
provided since some platforms such as the Nvidia Jetsons only
support Cuda 10.2.
2. Expose CUDA as a new option under DenseLinearAlgebraLibraryType.
The relevant option to string and string to option helper functions
are modified accordingly.
3. Add cuda as a dense_linear_algebra_library option in bundle_adjuster
to demonstrate the use of the new CUDA option.
Change-Id: I23615e1d301df5185ed646b3e33ee802508dae86
Build with documentation fails if the required 'sphinx rtd theme' is
not available. Check if dependency is installed before building with
documentation.
Add Python3 as requirement for building documentation.
Change-Id: I5edc5d7374864990e625a5efb358f5a23b3c50fe
- Protect against the case when the user has multiple installs of TBB
in their search paths and the first install does not contain debug
libraries. In this case it is possible to get mismatched versions
of TBB inserted into TBB_LIBRARIES.
- Also suppresses warning about use of TBB_ROOT on modern versions of
CMake due to CMP0074.
Change-Id: I2eaafdde4a028cbf6c500c63771973d85bc4723d
- Ceres will fail to configure if Eigen3::Eigen target is not found, and
the minimum required Eigen version specified (3.3) exports Eigen as
a CMake package and this is reflected in the default Ubuntu 18.04
packages.
- This permits users to specify their own Eigen3 detection should they
choose to do so, but they must do so via an imported target.
Change-Id: I5edff117c8001770004f49012ac1ae63b66ec9c1
- As our minimum required version of gflags (2.2) exports itself as
a CMake package and this is the case for the default 18.04 package
we can use the gflags target directly.
- Replaces forced use of CONFIG in find_package(gflags) with a check
that the gflags imported target exists to avoid ambiguity with
libgflags if installed in a default location. This permits users to
override the gflags detection should they so choose, provided that
they do so via an imported target.
- Also removes some previously removed legacy GLAGS_ vars from the
installation docs.
Change-Id: I015f5a751e5b22f956bbf9df692e63a6825c9f0d
- Removes all workarounds for pre-C++14 versions
- Removes '11' qualifier from C++ threading option and associated
defines.
- Fix missing inclusion of 'Multithreading' in reported Ceres components
when C++ threading model is enabled.
- Update Sphinx documentation to specify C++14 as minimum requirement.
Change-Id: I706c8b367b3221e3c4d1a0aaf669a8f9c911e438
- If the version of glog detected and used to build Ceres was built with
CMake (i.e. Config mode) then we now use Config mode directly in
CeresConfig.cmake and do not install Ceres' FindGlog.cmake module.
- This has the benefit of removing any hard-coded paths from
CeresConfig.cmake provided that all dependencies were also built with
CMake.
Change-Id: I85af8a953fd6d300e8bc0cdeb0b3636fec182f68
- This reflects modern CMake style, and also provides a measure of
protection against missing find_package() imports in downstream
clients resulting in linker errors when 'ceres' matches the compiled
library and not the imported target.
- The original 'ceres' target remains, as a local imported interface
target created by CeresConfig for backwards compatibility.
Change-Id: Ie9ed8de9b7059bc0cae1ae5002bb94d8fe617188
Ensure that Ceres does not print any log messages when somebody has
used 'find_package(Ceres QUIET)' in their CMake project.
Change-Id: Id6b68859cc8a5857f3fa78f29736cb82fd5a0943
This patch integrates the code generation module into the build
system. All depenendcies are tracked through CMake targets.
Modifying the cost functor will automatically trigger code
re-generation.
All this functionality is defined in the CMake function
ceres_generate_cost_function_implementation_for_functor
in CeresCodeGeneration.cmake. A hello world usage example
is included in examples/CMakeLists.txt.
Change-Id: I23b8b6698d1ea51cf3d788a47afcf39f8c5ce327
Use the CMake provided module CMakePackageConfigHelpers and its function
write_basic_package_version_file() to write the CeresConfigVersion.cmake
file to be installed.
Use SameMajorVersion compatibility flag.
Change-Id: I353aa8ede1ffee34e58b41371958ed5dedca4104
- Fix Homebrew Ruby errors by forcing brew update before install.
- Remove use of custom Eigen 3.3.4 on Linux in favour of default Bionic
3.3.4 package.
- Update Android NDK version to R20b and build for arm64-v8.
- Fix erroneous string -> STRING in iOS toolchain file.
Change-Id: I041c2a08b92b8307c12bd8967159beb6984e3c65
- As detailed in a previous CL, Xcode 11.0-1 exhibited a -fstack-check
bug on 10.15 Catalina that broke alignment for at least AVX
instructions causing segfaults from within Eigen.
- As Xcode 11.2 fixes this issue, and is probably a more reliable fix
than -fno-stack-check, we now require the user update in this case.
Change-Id: I482748fe5f40f82e7daf4da133cdfabbd95ffc89
- On macOS 10.15 and Xcode 11 -fstack-check is enabled by default. This
breaks SIMD alignment (and other alignment) as detailed here:
https://forums.developer.apple.com/thread/121887 resulting in random
segfaults from within Eigen.
- The underlying problem also exists with earlier OS versions running
Xcode 11 if -fstack-check is explicitly enabled.
- This CL explicitly disables -fstack-check on affected versions of
macOS 10.15 and Xcode 11.
Change-Id: I74d964281c360710d5fb722ac59e6930b0fdcc41
This commit includes the following:
- Changes to CMake to make it safer to see which compiler flags are supported,
so this way we do not need to worry about version checks in CMake.
- Unix platforms (which includes both Linux and Apple as far as i can tell)
will now enable -Wmissing-declarations warning for the whole Ceres.
- Changes in all sources to solve missing declaration warning. In most cases
it was either matter of using static qualifier or moving functions to an
anonymous namespace.
In one case the function got removed, since it seems to be unused.
Additionally, in slam examples there was a non-inlined function implementation
in a header, which is a direct way to cause linking errors if other .cc file
will include that helper header.
- All third party sources (which is currently only gmock) has this extra
paranoid warning disabled.
This warning is important in the following cases:
- Detect helper functions which are not needed anymore.
- Avoid unnoticed pollution of namespace.
- Avoid bad level calls.
- Avoid missing updates in header files after changes in implementation file.
- Helps integrating Ceres into software where paranoid warnings are important.
Change-Id: I9b1044aced3910d8c6b2356cfe2bf57f3c8c58db
- Adding the Homebrew install prefix to CMAKE_PREFIX_PATH, irrespective
of whether it is a standard location (e.g. /usr/local) overrides any
user-specified HINTS locations according to the search order of
CMake's find_xxx() functions.
- Now we append the relevant include/lib directory to its respective
HINTS directory variable (to the back to avoid overriding any user
specified values). This achieves the same effect, but only after
searching any user specified values.
- Also adds Homebrew install prefix to find_package() calls for
dependencies optionally exported with CMake after the possible user
specified <DEPENDENCY_NAME>_DIR prefix.
- Raised as issue #431
Change-Id: I47030f0f4fd9b96665fac57279be2285d9700b9a
In ceres' CMakeLists.txt a workaround for custom homebrew locations
sets CMAKE_PREFIX_PATH to the homebrew install path. This overrides
explicit requests for custom locations for third-party dependencies,
in particular for Eigen with EIGEN_INCLUDE_DIR_HINTS.
This commit introduces a workaround to make EIGEN_INCLUDE_DIR_HINTS
work on macos by ignoring CMAKE_PREFIX_PATH in that case.
Fixes https://github.com/ceres-solver/ceres-solver/issues/431
Change-Id: I3ec0ec418d45d41b9e5ebdd6aee60552438afec3
- Required now that Threads is a public dependency for Ceres and so
Threads::Threads will appear in the dependency list for the Ceres
target and so must be defined when Ceres itself is imported.
Change-Id: Ia5f8ea16e8f24cf0158f40e1fc8d3962106459a6
- In light of the C++11 threads threading option this is no longer
necessary for cross-platform threading support and did not offer a
noticeable performance gain over either the C++11 threads
implementation or OpenMP.
Change-Id: Icb588d520888c19a1775171795b55bcaffb3d256
- Now that we require CMake >= 3.x, we can roll the definition of the
include directories for clients linking against Ceres into the
exported Ceres CMake target via target_include_directories().
- This removes the requirement for CERES_INCLUDE_DIRS.
Change-Id: Ibe3bbf796339871d66138fc9520053d1766f09a8
- Previously we had separate variables for each of the threading
backends, each of which were made mutually exclusive via
cmake_dependent_option(). This has unfortunate side-effects when
trying to disable options if they are not currently enabled, in which
case they are not defined.
- As all the threading options are mutually exclusive, this replaces
all threading option variables with a single variable: CERES_THREADS,
which is constrained to take the value of only the available threading
backends.
Change-Id: I0822eefbac9a30772907b7732add365b37cc8ca0
- Add missing CMAKE_FIND_ROOT_PATH_MODE_PACKAGE = ONLY, mimicking what
we previously set for INCLUDE/LIBRARY/PROGRAM s/t the standard
package locations on the host system will not be searched by
find_package() when cross-compiling for iOS.
- Remove now unnecessary forced disabling of dependency options on iOS
as they should now never be found (unless they were explicitly built
for iOS) irrespective of whether the option defaults to ON initially.
Change-Id: I1d2c5da4838d7becb8ebd43f90a88cfc6ded4a1f
- This should no longer be required on newer (3.5+) CMake versions and
breaks the detection of supplementary compiler feature information
such as the population of CMAKE_CXX_COMPILE_FEATURES which is required
in order to compile Ceres.
Change-Id: Ibceab545925aa1e829320efa03fb74ef149cbb8b
- In practice, this was not causing any errors, as
GFLAGS_INCLUDE_DIR_HINTS is set from GFLAGS_INCLUDE_DIRS so the two
would have been equivalent, but we should nonetheless be using the
one set after the find_package() call.
- Note that this would only have been active for older gflags versions
that were not built with CMake.
Change-Id: Ie54145f522c974b7685052aafb1d2f6055d22337
1. Replace HashMap and HashSet with std::unordered_map and
std::unordered_set respectively.
2. Extract the pair hasher into a struct pair_hash.
3. Delete collections_port.h
4. Convert explicit iterator based loops to auto based
loops where sensible.
Change-Id: Ib88bcd13a7463d18435639d3b771abaa52080efb
- Removes CXX11 option, and all associate paraphernalia. Ceres now
requires a compiler with full >= C++11 support. In MSVC terms this
means >= 2013 Release 4.
- This deprecates the use of CERES_STD_UNORDERED_MAP and CERES_USE_CXX11
as they will now always be defined. They will be removed from the
source in a future CL.
- For clients with CMake >= 3.8 we propagate via the exported/installed
Ceres target the CXX version that was specified when Ceres was built.
For versions < 3.8 (but >= 3.5) we specify the CXX features currently
used in the Ceres public API.
Change-Id: I535b545b10156e4426659c270a4a0649e071df0e
- Use cmake_dependent_option() for all threading models and encode their
respective mutual exclusivity in the dependent-option s/t the job of
ensuring mutual exclusivity is performed by CMake.
- Use of cmake_dependent_option() has the downside that options are
removed from the GUI if their requirements for availability are not
met. So if CXX11 is OFF, then neither TBB nor CXX11_THREADS will
even appear as options (they will be undefined, assumed OFF).
- Perform checks for availability of C++11 if CXX11 is enabled prior to
testing other options to handle dependence of TBB & CXX11_THREADS on
CXX11 actually being present.
- Add check for availability of C++11-specific math functions used in
jet.h before reporting C++11 as found.
- Add check for <atomic> before allowing TBB or CXX11_THREADS, as both
options require it and it may not always be available even if the
other required C++11 components are.
Change-Id: Ife8cd182aeb1978539ce2c9966910ae59ebd9177
Implements ParallelFor using the C++11 based ThreadPool. The C++11
parallel for is 50-70% faster than single threaded, and 20-30% slower
than TBB.
Tested by compiling with OpenMP, TBB, and C++11 Threading support and
ran the unit tests. Ran bazel as well.
Change-Id: I7fd6c9037ff9f200ce6999b5f39918995bb6b8ea
- Update FindSuiteSparse to use FindTBB.cmake to find TBB.
- Fix logic handling of TBB=ON if TBB is not found to continue with
build after disabling TBB rather than throwing a fatal error.
- Use TBB_LIBRARIES instead of TBB_tbb_LIBRARY as a Ceres dependency,
the former also includes the TBB malloc library.
- Add warning message about GPL licensing if TBB version < 2017.
- Add ‘TBB’ & ‘Mulithreading’ component options to find_package(Ceres),
where ‘Mulithreading’ is equivalent to ‘TBB’ || ‘OpenMP’.
Change-Id: Ifc7f1d01b050ba6e2097ad1913b178805df4769a
There are platforms where OpenMP is not available. This
patch adds support for Intel Threading Building Blocks (TBB)
as an alternative threading backend.
Change-Id: I94497d7cba0c3cfaccfc992169236f17fe948ae9