bundle.sh 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  1. #!/bin/sh
  2. if [ "x$1" = "x--i-really-know-what-im-doing" ] ; then
  3. echo Proceeding as requested by command line ...
  4. else
  5. echo "*** Please run again with --i-really-know-what-im-doing ..."
  6. exit 1
  7. fi
  8. repo="https://ceres-solver.googlesource.com/ceres-solver"
  9. branch="master"
  10. #tag="1.4.0"
  11. tag=""
  12. tmp=`mktemp -d`
  13. checkout="$tmp/ceres"
  14. GIT="git --git-dir $tmp/ceres/.git --work-tree $checkout"
  15. git clone $repo $checkout
  16. if [ $branch != "master" ]; then
  17. $GIT checkout -t remotes/origin/$branch
  18. else
  19. if [ "x$tag" != "x" ]; then
  20. $GIT checkout $tag
  21. fi
  22. fi
  23. $GIT log -n 50 > ChangeLog
  24. for p in `cat ./patches/series`; do
  25. echo "Applying patch $p..."
  26. cat ./patches/$p | patch -d $tmp/ceres -p1
  27. done
  28. find include -type f -not -iwholename '*.svn*' -exec rm -rf {} \;
  29. find internal -type f -not -iwholename '*.svn*' -exec rm -rf {} \;
  30. cat "files.txt" | while read f; do
  31. mkdir -p `dirname $f`
  32. cp $tmp/ceres/$f $f
  33. done
  34. rm -rf $tmp
  35. sources=`find ./include ./internal -type f -iname '*.cc' -or -iname '*.cpp' -or -iname '*.c' | sed -r 's/^\.\//\t/' | \
  36. grep -v -E 'schur_eliminator_[0-9]_[0-9d]_[0-9d].cc' | \
  37. grep -v -E 'partitioned_matrix_view_[0-9]_[0-9d]_[0-9d].cc' | sort -d`
  38. generated_sources=`find ./include ./internal -type f -iname '*.cc' -or -iname '*.cpp' -or -iname '*.c' | sed -r 's/^\.\//\t\t/' | \
  39. grep -E 'schur_eliminator_[0-9]_[0-9d]_[0-9d].cc|partitioned_matrix_view_[0-9]_[0-9d]_[0-9d].cc' | sort -d`
  40. headers=`find ./include ./internal -type f -iname '*.h' | sed -r 's/^\.\//\t/' | sort -d`
  41. src_dir=`find ./internal -type f -iname '*.cc' -exec dirname {} \; -or -iname '*.cpp' -exec dirname {} \; -or -iname '*.c' -exec dirname {} \; | sed -r 's/^\.\//\t/' | sort -d | uniq`
  42. src=""
  43. for x in $src_dir $src_third_dir; do
  44. t=""
  45. if test `echo "$x" | grep -c glog ` -eq 1; then
  46. continue;
  47. fi
  48. if test `echo "$x" | grep -c generated` -eq 1; then
  49. continue;
  50. fi
  51. if stat $x/*.cpp > /dev/null 2>&1; then
  52. t="src += env.Glob('`echo $x'/*.cpp'`')"
  53. fi
  54. if stat $x/*.c > /dev/null 2>&1; then
  55. if [ -z "$t" ]; then
  56. t="src += env.Glob('`echo $x'/*.c'`')"
  57. else
  58. t="$t + env.Glob('`echo $x'/*.c'`')"
  59. fi
  60. fi
  61. if stat $x/*.cc > /dev/null 2>&1; then
  62. if [ -z "$t" ]; then
  63. t="src += env.Glob('`echo $x'/*.cc'`')"
  64. else
  65. t="$t + env.Glob('`echo $x'/*.cc'`')"
  66. fi
  67. fi
  68. if [ -z "$src" ]; then
  69. src=$t
  70. else
  71. src=`echo "$src\n$t"`
  72. fi
  73. done
  74. cat > CMakeLists.txt << EOF
  75. # ***** BEGIN GPL LICENSE BLOCK *****
  76. #
  77. # This program is free software; you can redistribute it and/or
  78. # modify it under the terms of the GNU General Public License
  79. # as published by the Free Software Foundation; either version 2
  80. # of the License, or (at your option) any later version.
  81. #
  82. # This program is distributed in the hope that it will be useful,
  83. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  84. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  85. # GNU General Public License for more details.
  86. #
  87. # You should have received a copy of the GNU General Public License
  88. # along with this program; if not, write to the Free Software Foundation,
  89. # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  90. #
  91. # The Original Code is Copyright (C) 2012, Blender Foundation
  92. # All rights reserved.
  93. #
  94. # Contributor(s): Blender Foundation,
  95. # Sergey Sharybin
  96. #
  97. # ***** END GPL LICENSE BLOCK *****
  98. # NOTE: This file is automatically generated by bundle.sh script
  99. # If you're doing changes in this file, please update template
  100. # in that script too
  101. set(INC
  102. .
  103. include
  104. internal
  105. config
  106. ../gflags/src
  107. )
  108. set(INC_SYS
  109. \${EIGEN3_INCLUDE_DIRS}
  110. )
  111. set(SRC
  112. ${sources}
  113. ${headers}
  114. )
  115. if(WITH_LIBMV_SCHUR_SPECIALIZATIONS)
  116. list(APPEND SRC
  117. ${generated_sources}
  118. )
  119. else()
  120. add_definitions(-DCERES_RESTRICT_SCHUR_SPECIALIZATION)
  121. endif()
  122. if(WIN32)
  123. list(APPEND INC
  124. ../glog/src/windows
  125. )
  126. else()
  127. list(APPEND INC
  128. ../glog/src
  129. )
  130. endif()
  131. add_definitions(\${GFLAGS_DEFINES})
  132. add_definitions(\${GLOG_DEFINES})
  133. add_definitions(\${CERES_DEFINES})
  134. add_definitions(
  135. -DCERES_HAVE_PTHREAD
  136. -DCERES_NO_SUITESPARSE
  137. -DCERES_NO_CXSPARSE
  138. -DCERES_NO_LAPACK
  139. -DCERES_HAVE_RWLOCK
  140. )
  141. if(WITH_OPENMP)
  142. add_definitions(
  143. -DCERES_USE_OPENMP
  144. )
  145. endif()
  146. blender_add_lib(extern_ceres "\${SRC}" "\${INC}" "\${INC_SYS}")
  147. EOF