Move Ceres to extern/

Even tho it's currently only used by Libmv we might use it for something
else in the future. Plus, it's actually where it logically belongs to.
This commit is contained in:
Sergey Sharybin
2016-01-04 18:11:12 +05:00
parent 0b856dd97e
commit 6fb6a08bf8
265 changed files with 68 additions and 84 deletions

View File

@@ -2600,6 +2600,46 @@ if(WITH_LIBMV OR WITH_GTESTS OR (WITH_CYCLES AND WITH_CYCLES_LOGGING))
)
endif()
#-----------------------------------------------------------------------------
# Configure Ceres
if(WITH_LIBMV)
set(CERES_DEFINES)
TEST_SHARED_PTR_SUPPORT()
if(SHARED_PTR_FOUND)
if(SHARED_PTR_TR1_MEMORY_HEADER)
list(APPEND CERES_DEFINES -DCERES_TR1_MEMORY_HEADER)
endif()
if(SHARED_PTR_TR1_NAMESPACE)
list(APPEND CERES_DEFINES -DCERES_TR1_SHARED_PTR)
endif()
else()
message(FATAL_ERROR "Ceres: Unable to find shared_ptr.")
endif()
TEST_UNORDERED_MAP_SUPPORT()
if(HAVE_STD_UNORDERED_MAP_HEADER)
if(HAVE_UNORDERED_MAP_IN_STD_NAMESPACE)
list(APPEND CERES_DEFINES -DCERES_STD_UNORDERED_MAP)
else()
if(HAVE_UNORDERED_MAP_IN_TR1_NAMESPACE)
list(APPEND CERES_DEFINES -DCERES_STD_UNORDERED_MAP_IN_TR1_NAMESPACE)
else()
list(APPEND CERES_DEFINES -DCERES_NO_UNORDERED_MAP)
message(STATUS "Ceres: Replacing unordered_map/set with map/set (warning: slower!)")
endif()
endif()
else()
if(HAVE_UNORDERED_MAP_IN_TR1_NAMESPACE)
list(APPEND CERES_DEFINES -DCERES_TR1_UNORDERED_MAP)
else()
list(APPEND CERES_DEFINES -DCERES_NO_UNORDERED_MAP)
message(STATUS "Ceres: Replacing unordered_map/set with map/set (warning: slower!)")
endif()
endif()
endif()
#-----------------------------------------------------------------------------
# Extra compile flags

View File

@@ -86,6 +86,10 @@ if(WITH_X11 AND WITH_GHOST_XDND)
add_subdirectory(xdnd)
endif()
if(WITH_LIBMV)
add_subdirectory(ceres)
endif()
if(WITH_LIBMV OR WITH_GTESTS OR (WITH_CYCLES AND WITH_CYCLES_LOGGING))
add_subdirectory(gflags)
add_subdirectory(glog)

View File

@@ -31,8 +31,7 @@ set(INC
include
internal
config
../../../gflags/src
../../
../gflags/src
)
set(INC_SYS
@@ -131,6 +130,7 @@ set(SRC
include/ceres/covariance.h
include/ceres/crs_matrix.h
include/ceres/dynamic_autodiff_cost_function.h
include/ceres/dynamic_cost_function_to_functor.h
include/ceres/dynamic_numeric_diff_cost_function.h
include/ceres/fpclassify.h
include/ceres/gradient_checker.h
@@ -153,6 +153,7 @@ set(SRC
include/ceres/loss_function.h
include/ceres/normal_prior.h
include/ceres/numeric_diff_cost_function.h
include/ceres/numeric_diff_options.h
include/ceres/ordered_groups.h
include/ceres/problem.h
include/ceres/rotation.h
@@ -200,6 +201,7 @@ set(SRC
internal/ceres/gradient_problem_evaluator.h
internal/ceres/graph_algorithms.h
internal/ceres/graph.h
internal/ceres/householder_vector.h
internal/ceres/implicit_schur_complement.h
internal/ceres/integral_types.h
internal/ceres/iterative_schur_complement_solver.h
@@ -298,20 +300,18 @@ endif()
if(WIN32)
list(APPEND INC
../../../glog/src/windows
../glog/src/windows
)
if(NOT MINGW)
list(APPEND INC
../msinttypes
)
endif()
else()
list(APPEND INC
../../../glog/src
../glog/src
)
endif()
add_definitions(${GFLAGS_DEFINES})
add_definitions(${GLOG_DEFINES})
add_definitions(${CERES_DEFINES})
add_definitions(
-DCERES_HAVE_PTHREAD
-DCERES_NO_SUITESPARSE

View File

@@ -124,8 +124,7 @@ set(INC
include
internal
config
../gflags
../../
../gflags/src
)
set(INC_SYS
@@ -150,18 +149,16 @@ if(WIN32)
list(APPEND INC
../glog/src/windows
)
if(NOT MINGW)
list(APPEND INC
../msinttypes
)
endif()
else()
list(APPEND INC
../glog/src
)
endif()
add_definitions(\${GFLAGS_DEFINES})
add_definitions(\${GLOG_DEFINES})
add_definitions(\${CERES_DEFINES})
add_definitions(
-DCERES_HAVE_PTHREAD
-DCERES_NO_SUITESPARSE

View File

@@ -37,22 +37,9 @@ set(SRC
libmv-capi.h
)
TEST_SHARED_PTR_SUPPORT()
if(SHARED_PTR_FOUND)
if(SHARED_PTR_TR1_MEMORY_HEADER)
add_definitions(-DCERES_TR1_MEMORY_HEADER)
endif()
if(SHARED_PTR_TR1_NAMESPACE)
add_definitions(-DCERES_TR1_SHARED_PTR)
endif()
else()
message(FATAL_ERROR "Unable to find shared_ptr.")
endif()
add_definitions(${GFLAGS_DEFINES})
add_definitions(${GLOG_DEFINES})
add_subdirectory(third_party)
add_definitions(${CERES_DEFINES})
if(WITH_LIBMV)
list(APPEND INC

View File

@@ -17,10 +17,7 @@ git clone -b $BRANCH $repo $tmp/libmv
git --git-dir $tmp/libmv/.git --work-tree $tmp/libmv log -n 50 > ChangeLog
find libmv -type f -exec rm -rf {} \;
find third_party -type f \
-not -iwholename '*third_party/ceres*' \
-not -iwholename '*third_party/CMakeLists.txt*' \
-exec rm -rf {} \;
find third_party -type f -exec rm -rf {} \;
cat "files.txt" | while read f; do
mkdir -p `dirname $f`
@@ -32,13 +29,13 @@ rm -rf $tmp
sources=`find ./libmv -type f -iname '*.cc' -or -iname '*.cpp' -or -iname '*.c' | grep -v _test.cc | grep -v test_data_sets | sed -r 's/^\.\//\t\t/' | sort -d`
headers=`find ./libmv -type f -iname '*.h' | grep -v test_data_sets | sed -r 's/^\.\//\t\t/' | sort -d`
third_sources=`find ./third_party -type f -iname '*.cc' -or -iname '*.cpp' -or -iname '*.c' | grep -v ceres | sed -r 's/^\.\//\t\t/' | sort -d`
third_headers=`find ./third_party -type f -iname '*.h' | grep -v ceres | sed -r 's/^\.\//\t\t/' | sort -d`
third_sources=`find ./third_party -type f -iname '*.cc' -or -iname '*.cpp' -or -iname '*.c' | sed -r 's/^\.\//\t\t/' | sort -d`
third_headers=`find ./third_party -type f -iname '*.h' | sed -r 's/^\.\//\t\t/' | sort -d`
tests=`find ./libmv -type f -iname '*_test.cc' | sort -d | awk ' { name=gensub(".*/([A-Za-z_]+)_test.cc", "\\\\1", $1); printf("\t\tBLENDER_SRC_GTEST(\"libmv_%s\" \"%s\" \"libmv_test_dataset;extern_libmv;extern_ceres\")\n", name, $1) } '`
src_dir=`find ./libmv -type f -iname '*.cc' -exec dirname {} \; -or -iname '*.cpp' -exec dirname {} \; -or -iname '*.c' -exec dirname {} \; | sed -r 's/^\.\//\t\t/' | sort -d | uniq`
src_third_dir=`find ./third_party -type f -iname '*.cc' -exec dirname {} \; -or -iname '*.cpp' -exec dirname {} \; -or -iname '*.c' -exec dirname {} \; | grep -v ceres | sed -r 's/^\.\//\t\t/' | sort -d | uniq`
src_third_dir=`find ./third_party -type f -iname '*.cc' -exec dirname {} \; -or -iname '*.cpp' -exec dirname {} \; -or -iname '*.c' -exec dirname {} \; | sed -r 's/^\.\//\t\t/' | sort -d | uniq`
src=""
win_src=""
for x in $src_dir $src_third_dir; do
@@ -119,28 +116,13 @@ set(SRC
libmv-capi.h
)
TEST_SHARED_PTR_SUPPORT()
if(SHARED_PTR_FOUND)
if(SHARED_PTR_TR1_MEMORY_HEADER)
add_definitions(-DCERES_TR1_MEMORY_HEADER)
endif()
if(SHARED_PTR_TR1_NAMESPACE)
add_definitions(-DCERES_TR1_SHARED_PTR)
endif()
else()
message(FATAL_ERROR "Unable to find shared_ptr.")
endif()
add_definitions(-DGOOGLE_GLOG_DLL_DECL=)
add_definitions(-DGFLAGS_DLL_DEFINE_FLAG=)
add_definitions(-DGFLAGS_DLL_DECLARE_FLAG=)
add_definitions(-DGFLAGS_DLL_DECL=)
add_subdirectory(third_party)
add_definitions(\${GFLAGS_DEFINES})
add_definitions(\${GLOG_DEFINES})
add_definitions(\${CERES_DEFINES})
if(WITH_LIBMV)
list(APPEND INC
../gflags
../gflags/src
../glog/src
third_party/ceres/include
third_party/ceres/config

View File

@@ -1,26 +0,0 @@
# ***** BEGIN GPL LICENSE BLOCK *****
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# The Original Code is Copyright (C) 2016, Blender Foundation
# All rights reserved.
#
# Contributor(s): Sergey Sharybin.
#
# ***** END GPL LICENSE BLOCK *****
if(WITH_LIBMV)
add_subdirectory(ceres)
endif()