diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2014-06-18 16:49:17 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2014-06-18 20:09:16 +0400 |
commit | 306cbb82ecf0d7c1ba4fb0a1240175b1976bd25b (patch) | |
tree | e9eac65bf57126ac233f22fe88cc00df137ec4e5 /extern/libmv/bundle.sh | |
parent | 47ec0394ca3d03e07c07a67e8f8d1625aedd39dd (diff) |
GTest unit testing framework
Currently covers only small set of functionality.
Diffstat (limited to 'extern/libmv/bundle.sh')
-rwxr-xr-x | extern/libmv/bundle.sh | 87 |
1 files changed, 62 insertions, 25 deletions
diff --git a/extern/libmv/bundle.sh b/extern/libmv/bundle.sh index e8e698a89f2..36df51770c5 100755 --- a/extern/libmv/bundle.sh +++ b/extern/libmv/bundle.sh @@ -30,15 +30,20 @@ rm -rf $tmp chmod 664 ./third_party/glog/src/windows/*.cc ./third_party/glog/src/windows/*.h ./third_party/glog/src/windows/glog/*.h -sources=`find ./libmv -type f -iname '*.cc' -or -iname '*.cpp' -or -iname '*.c' | sed -r 's/^\.\//\t\t/' | sort -d` -headers=`find ./libmv -type f -iname '*.h' | sed -r 's/^\.\//\t\t/' | sort -d` +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 glog | grep -v ceres | sed -r 's/^\.\//\t\t/' | sort -d` -third_headers=`find ./third_party -type f -iname '*.h' | grep -v glog | 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' | grep -v glog | grep -v gflags | grep -v ceres | sed -r 's/^\.\//\t\t/' | sort -d` +third_headers=`find ./third_party -type f -iname '*.h' | grep -v glog | grep -v gflags | grep -v ceres | sed -r 's/^\.\//\t\t/' | sort -d` third_glog_sources=`find ./third_party -type f -iname '*.cc' -or -iname '*.cpp' -or -iname '*.c' | grep glog | grep -v windows | sed -r 's/^\.\//\t\t\t/' | sort -d` third_glog_headers=`find ./third_party -type f -iname '*.h' | grep glog | grep -v windows | sed -r 's/^\.\//\t\t\t/' | sort -d` +third_gflags_sources=`find ./third_party -type f -iname '*.cc' -or -iname '*.cpp' -or -iname '*.c' | grep gflags | grep -v windows | sed -r 's/^\.\//\t\t/' | sort -d` +third_gflags_headers=`find ./third_party -type f -iname '*.h' | grep gflags | grep -v windows | 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("\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="" @@ -118,6 +123,9 @@ set(INC . ) +set(INC_SYS +) + set(SRC libmv-capi.h libmv-capi_intern.h @@ -148,9 +156,7 @@ if(WITH_LIBMV) libmv-capi.cc libmv-util.cc ${sources} - ${third_sources} - libmv-util.h ${headers} @@ -158,7 +164,46 @@ ${third_headers} ) if(WIN32) - list(APPEND SRC + list(APPEND INC + third_party/glog/src/windows + ) + + if(NOT MINGW) + list(APPEND INC + third_party/msinttypes + ) + endif() + endif() + + if(WITH_TESTS) + blender_add_lib(libmv_test_dataset "./libmv/multiview/test_data_sets.cc" "${INC}" "${INC_SYS}") + endif() + +${tests} +else() + list(APPEND SRC + libmv-capi_stub.cc + ) +endif() + +blender_add_lib(extern_libmv "\${SRC}" "\${INC}" "\${INC_SYS}") + +if(WITH_LIBMV) + add_subdirectory(third_party) +endif() + +# make GLog a separate target, so it can be used for gtest as well. +if(WITH_LIBMV OR WITH_TESTS) + # We compile GLog together with GFlag so we don't worry about + # adding extra lib to linker. + set(GLOG_SRC +${third_gflags_sources} + +${third_gflags_headers} + ) + + if(WIN32) + list(APPEND GLOG_SRC third_party/glog/src/logging.cc third_party/glog/src/raw_logging.cc third_party/glog/src/utilities.cc @@ -183,33 +228,23 @@ ${third_headers} third_party/glog/src/windows/port.h third_party/glog/src/windows/config.h ) - - list(APPEND INC - third_party/glog/src/windows - ) - - if(NOT MINGW) - list(APPEND INC - third_party/msinttypes - ) - endif() else() - list(APPEND SRC + list(APPEND GLOG_SRC ${third_glog_sources} ${third_glog_headers} ) endif() -else() - list(APPEND SRC - libmv-capi_stub.cc + + set(GLOG_INC + third_party/gflags + third_party/glog/src ) -endif() -blender_add_lib(extern_libmv "\${SRC}" "\${INC}" "\${INC_SYS}") + set(GLOG_INC_SYS + ) -if(WITH_LIBMV) - add_subdirectory(third_party) + blender_add_lib(extern_glog "\${GLOG_SRC}" "\${GLOG_INC}" "\${GLOG_INC_SYS}") endif() EOF @@ -254,6 +289,8 @@ ${win_src} else: src = env.Glob("libmv-capi_stub.cc") +src = [src for src in src if src.find('_test.cc') == -1] + env.BlenderLib ( libname = 'extern_libmv', sources=src, includes=Split(incs), defines=defs, libtype=['extern', 'player'], priority=[20,137] ) if env['WITH_BF_LIBMV']: |