diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 000000000..f4022ff79 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,109 @@ +name: MVE GitHub Actions CI + +on: + push: + branches: [ "master" ] + pull_request: + branches: [ "master" ] + +jobs: + build: + name: ${{ matrix.platform.name }} + runs-on: ${{ matrix.platform.os }} + + strategy: + fail-fast: false + + matrix: + platform: + - { name: "Ubuntu 20.04, GCC, x86_64", os: ubuntu-20.04, cpp_compiler: g++, qmake_spec: linux-g++ } + - { name: "Ubuntu 20.04, Clang, x86_64", os: ubuntu-20.04, cpp_compiler: clang++, qmake_spec: linux-clang } + - { name: "Ubuntu 22.04, GCC, x86_64", os: ubuntu-22.04, cpp_compiler: g++, qmake_spec: linux-g++ } + - { name: "Ubuntu 22.04, Clang, x86_64", os: ubuntu-22.04, cpp_compiler: clang++, qmake_spec: linux-clang } + - { name: "Ubuntu 24.04, GCC, x86_64", os: ubuntu-24.04, cpp_compiler: g++, qmake_spec: linux-g++ } + - { name: "Ubuntu 24.04, Clang, x86_64", os: ubuntu-24.04, cpp_compiler: clang++, qmake_spec: linux-clang } + - { name: "macOS 12, Clang, x86_64", os: macos-12, cpp_compiler: clang++, qmake_spec: macx-clang } + - { name: "macOS 13, Clang, x86_64", os: macos-13, cpp_compiler: clang++, qmake_spec: macx-clang } + - { name: "macOS 14, Clang, arm64", os: macos-14, cpp_compiler: clang++, qmake_spec: macx-clang } + + env: + CXX: ${{ matrix.platform.cpp_compiler }} + QMAKE_SPEC: ${{ matrix.platform.qmake_spec }} + + steps: + - uses: actions/checkout@v4 + + - name: Install Ubuntu dependencies + if: runner.os == 'Linux' + run: | + echo "::group::apt-get update" + sudo apt-get update + echo "::endgroup::" + + echo "::group::apt-get upgrade" + sudo apt-get upgrade -y + echo "::endgroup::" + + echo "::group::apt-get install" + sudo apt-get install \ + build-essential \ + clang \ + libgl-dev \ + libgtest-dev \ + libjpeg-turbo8-dev \ + libomp-dev \ + libpng-dev \ + libqt5opengl5-dev \ + libtiff-dev \ + pkg-config \ + zlib1g-dev + echo "::endgroup::" + + - name: Install macOS dependencies + if: runner.os == 'macOS' + run: | + echo "::group::brew update" + brew update + echo "::endgroup::" + + echo "::group::brew install" + brew install -q \ + googletest \ + jpeg-turbo \ + libpng \ + libtiff \ + qt@5 + echo "::endgroup::" + + echo "::group::brew link" + brew link qt@5 + echo "::endgroup::" + + - name: Build (U)MVE on Linux/macOS + run: | + ${CXX} --version + if [ "`uname`" = "Darwin" ]; then + export NUM_CPU_CORES="`sysctl -n hw.ncpu`" + else + export NUM_CPU_CORES="`nproc`" + fi + + echo "::group::Build MVE" + make -j${NUM_CPU_CORES} + echo "::endgroup":: + + echo "::group::Build UMVE" + qmake -v + pushd apps/umve + qmake -spec ${QMAKE_SPEC} + make -j${NUM_CPU_CORES} + popd + echo "::endgroup::" + + echo "::group::Build tests" + make -j${NUM_CPU_CORES} test + echo "::endgroup::" + + - name: Run tests + run: ./tests/test + diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 6a66c6997..000000000 --- a/.travis.yml +++ /dev/null @@ -1,37 +0,0 @@ -os: linux -language: cpp -compiler: gcc -sudo: false - -branches: - only: - - master - -before_install: - - if [ "$CXX" = "g++" ]; then export CXX="g++-6"; fi - -addons: - apt: - sources: - - ubuntu-toolchain-r-test - packages: - - g++-6 - - cmake - -before_script: - - wget https://github.com/google/googletest/archive/master.zip -O /tmp/gtest.zip - - unzip /tmp/gtest.zip - - export GTEST_PATH=$PWD/googletest-master - - mkdir $GTEST_PATH/build - - pushd $GTEST_PATH/build - - cmake .. - - make gtest_main - - popd - -script: - - make -j4 -Clibs/util - - make -j4 -Clibs/mve - - make -j4 -Clibs/sfm - - make -j4 -Clibs/fssr - - make -j4 test - - ./tests/test diff --git a/Makefile.inc b/Makefile.inc index ef268da05..9a7638b25 100644 --- a/Makefile.inc +++ b/Makefile.inc @@ -2,7 +2,7 @@ CXX ?= g++ CXXWARNINGS ?= -Wall -Wextra -Wundef -pedantic CXXINTRINSICS ?= -march=native -CXXFEATURES ?= -funsafe-math-optimizations -fno-math-errno -std=c++11 +CXXFEATURES ?= -funsafe-math-optimizations -fno-math-errno -std=c++14 CXXFLAGS ?= ${CXXWARNINGS} ${CXXINTRINSICS} ${CXXFEATURES} -g -O3 # Delete this if OpenMP is not available (e.g., OS X without gcc) @@ -13,9 +13,19 @@ CXXFLAGS += -pthread UNAME = $(shell uname) ifeq (${UNAME},Darwin) + CXXFLAGS += -DGL_SILENCE_DEPRECATION=1 OPENMP = endif +LIBJPEG_CFLAGS = `pkg-config --cflags libjpeg` +LIBJPEG_LDFLAGS = `pkg-config --libs libjpeg` + +LIBPNG_CFLAGS = `pkg-config --cflags libpng` +LIBPNG_LDFLAGS = `pkg-config --libs libpng` + +LIBTIFF_CFLAGS = `pkg-config --cflags libtiff-4` +LIBTIFF_LDFLAGS = `pkg-config --libs libtiff-4` + COMPILE.cc = ${CXX} ${CXXFLAGS} ${CPPFLAGS} -c LINK.o = ${CXX} ${LDFLAGS} .DEFAULT_GOAL := ${TARGET} diff --git a/README.md b/README.md index 3d448bbbd..c3dcfddc0 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # MVE -- The Multi-View Environemnt -![Build Status](https://travis-ci.org/simonfuhrmann/mve.svg?branch=master) +[![Build Status](https://github.com/simonfuhrmann/mve/actions/workflows/main.yml/badge.svg)](https://github.com/simonfuhrmann/mve/actions/workflows/main.yml) The Multi-View Environment, MVE, is an implementation of a complete end-to-end pipeline for image-based geometry reconstruction. It features diff --git a/apps/bundle2pset/Makefile b/apps/bundle2pset/Makefile index 0021acfb3..c5c1a027a 100644 --- a/apps/bundle2pset/Makefile +++ b/apps/bundle2pset/Makefile @@ -3,7 +3,7 @@ TARGET := $(shell basename `pwd`) include ${MVE_ROOT}/Makefile.inc CXXFLAGS += -I${MVE_ROOT}/libs ${OPENMP} -LDLIBS += -lpng -ltiff -ljpeg ${OPENMP} +LDLIBS += ${LIBJPEG_LDFLAGS} ${LIBPNG_LDFLAGS} ${LIBTIFF_LDFLAGS} ${OPENMP} SOURCES := $(wildcard [^_]*.cc) ${TARGET}: ${SOURCES:.cc=.o} libmve.a libmve_util.a diff --git a/apps/dmrecon/Makefile b/apps/dmrecon/Makefile index 0f6a9d334..da17dba89 100644 --- a/apps/dmrecon/Makefile +++ b/apps/dmrecon/Makefile @@ -3,7 +3,7 @@ TARGET := $(shell basename `pwd`) include ${MVE_ROOT}/Makefile.inc CXXFLAGS += -I${MVE_ROOT}/libs ${OPENMP} -LDLIBS += -lpng -ltiff -ljpeg ${OPENMP} +LDLIBS += ${LIBJPEG_LDFLAGS} ${LIBPNG_LDFLAGS} ${LIBTIFF_LDFLAGS} ${OPENMP} SOURCES := $(wildcard [^_]*.cc) ${TARGET}: ${SOURCES:.cc=.o} libmve_dmrecon.a libmve.a libmve_util.a diff --git a/apps/featurerecon/Makefile b/apps/featurerecon/Makefile index 3c0e6bf6d..c7ed81115 100644 --- a/apps/featurerecon/Makefile +++ b/apps/featurerecon/Makefile @@ -3,7 +3,7 @@ TARGET := $(shell basename `pwd`) include ${MVE_ROOT}/Makefile.inc CXXFLAGS += -I${MVE_ROOT}/libs ${OPENMP} -LDLIBS += -lpng -ltiff -ljpeg ${OPENMP} +LDLIBS += ${LIBJPEG_LDFLAGS} ${LIBPNG_LDFLAGS} ${LIBTIFF_LDFLAGS} ${OPENMP} SOURCES := $(wildcard [^_]*.cc) ${TARGET}: ${SOURCES:.cc=.o} libmve_sfm.a libmve.a libmve_util.a diff --git a/apps/fssrecon/Makefile b/apps/fssrecon/Makefile index e7138569a..d36446d2c 100644 --- a/apps/fssrecon/Makefile +++ b/apps/fssrecon/Makefile @@ -3,7 +3,7 @@ TARGET := $(shell basename `pwd`) include ${MVE_ROOT}/Makefile.inc CXXFLAGS += -I${MVE_ROOT}/libs ${OPENMP} -LDLIBS += -lpng -ltiff -ljpeg ${OPENMP} +LDLIBS += ${LIBJPEG_LDFLAGS} ${LIBPNG_LDFLAGS} ${LIBTIFF_LDFLAGS} ${OPENMP} SOURCES := $(wildcard [^_]*.cc) ${TARGET}: ${SOURCES:.cc=.o} libmve_fssr.a libmve.a libmve_util.a diff --git a/apps/makescene/Makefile b/apps/makescene/Makefile index 0021acfb3..c5c1a027a 100644 --- a/apps/makescene/Makefile +++ b/apps/makescene/Makefile @@ -3,7 +3,7 @@ TARGET := $(shell basename `pwd`) include ${MVE_ROOT}/Makefile.inc CXXFLAGS += -I${MVE_ROOT}/libs ${OPENMP} -LDLIBS += -lpng -ltiff -ljpeg ${OPENMP} +LDLIBS += ${LIBJPEG_LDFLAGS} ${LIBPNG_LDFLAGS} ${LIBTIFF_LDFLAGS} ${OPENMP} SOURCES := $(wildcard [^_]*.cc) ${TARGET}: ${SOURCES:.cc=.o} libmve.a libmve_util.a diff --git a/apps/mesh2pset/Makefile b/apps/mesh2pset/Makefile index e7138569a..d36446d2c 100644 --- a/apps/mesh2pset/Makefile +++ b/apps/mesh2pset/Makefile @@ -3,7 +3,7 @@ TARGET := $(shell basename `pwd`) include ${MVE_ROOT}/Makefile.inc CXXFLAGS += -I${MVE_ROOT}/libs ${OPENMP} -LDLIBS += -lpng -ltiff -ljpeg ${OPENMP} +LDLIBS += ${LIBJPEG_LDFLAGS} ${LIBPNG_LDFLAGS} ${LIBTIFF_LDFLAGS} ${OPENMP} SOURCES := $(wildcard [^_]*.cc) ${TARGET}: ${SOURCES:.cc=.o} libmve_fssr.a libmve.a libmve_util.a diff --git a/apps/meshalign/Makefile b/apps/meshalign/Makefile index e7138569a..d36446d2c 100644 --- a/apps/meshalign/Makefile +++ b/apps/meshalign/Makefile @@ -3,7 +3,7 @@ TARGET := $(shell basename `pwd`) include ${MVE_ROOT}/Makefile.inc CXXFLAGS += -I${MVE_ROOT}/libs ${OPENMP} -LDLIBS += -lpng -ltiff -ljpeg ${OPENMP} +LDLIBS += ${LIBJPEG_LDFLAGS} ${LIBPNG_LDFLAGS} ${LIBTIFF_LDFLAGS} ${OPENMP} SOURCES := $(wildcard [^_]*.cc) ${TARGET}: ${SOURCES:.cc=.o} libmve_fssr.a libmve.a libmve_util.a diff --git a/apps/meshclean/Makefile b/apps/meshclean/Makefile index e7138569a..d36446d2c 100644 --- a/apps/meshclean/Makefile +++ b/apps/meshclean/Makefile @@ -3,7 +3,7 @@ TARGET := $(shell basename `pwd`) include ${MVE_ROOT}/Makefile.inc CXXFLAGS += -I${MVE_ROOT}/libs ${OPENMP} -LDLIBS += -lpng -ltiff -ljpeg ${OPENMP} +LDLIBS += ${LIBJPEG_LDFLAGS} ${LIBPNG_LDFLAGS} ${LIBTIFF_LDFLAGS} ${OPENMP} SOURCES := $(wildcard [^_]*.cc) ${TARGET}: ${SOURCES:.cc=.o} libmve_fssr.a libmve.a libmve_util.a diff --git a/apps/meshconvert/Makefile b/apps/meshconvert/Makefile index 0021acfb3..c5c1a027a 100644 --- a/apps/meshconvert/Makefile +++ b/apps/meshconvert/Makefile @@ -3,7 +3,7 @@ TARGET := $(shell basename `pwd`) include ${MVE_ROOT}/Makefile.inc CXXFLAGS += -I${MVE_ROOT}/libs ${OPENMP} -LDLIBS += -lpng -ltiff -ljpeg ${OPENMP} +LDLIBS += ${LIBJPEG_LDFLAGS} ${LIBPNG_LDFLAGS} ${LIBTIFF_LDFLAGS} ${OPENMP} SOURCES := $(wildcard [^_]*.cc) ${TARGET}: ${SOURCES:.cc=.o} libmve.a libmve_util.a diff --git a/apps/prebundle/Makefile b/apps/prebundle/Makefile index 3c0e6bf6d..c7ed81115 100644 --- a/apps/prebundle/Makefile +++ b/apps/prebundle/Makefile @@ -3,7 +3,7 @@ TARGET := $(shell basename `pwd`) include ${MVE_ROOT}/Makefile.inc CXXFLAGS += -I${MVE_ROOT}/libs ${OPENMP} -LDLIBS += -lpng -ltiff -ljpeg ${OPENMP} +LDLIBS += ${LIBJPEG_LDFLAGS} ${LIBPNG_LDFLAGS} ${LIBTIFF_LDFLAGS} ${OPENMP} SOURCES := $(wildcard [^_]*.cc) ${TARGET}: ${SOURCES:.cc=.o} libmve_sfm.a libmve.a libmve_util.a diff --git a/apps/scene2pset/Makefile b/apps/scene2pset/Makefile index 0021acfb3..c5c1a027a 100644 --- a/apps/scene2pset/Makefile +++ b/apps/scene2pset/Makefile @@ -3,7 +3,7 @@ TARGET := $(shell basename `pwd`) include ${MVE_ROOT}/Makefile.inc CXXFLAGS += -I${MVE_ROOT}/libs ${OPENMP} -LDLIBS += -lpng -ltiff -ljpeg ${OPENMP} +LDLIBS += ${LIBJPEG_LDFLAGS} ${LIBPNG_LDFLAGS} ${LIBTIFF_LDFLAGS} ${OPENMP} SOURCES := $(wildcard [^_]*.cc) ${TARGET}: ${SOURCES:.cc=.o} libmve.a libmve_util.a diff --git a/apps/sceneupgrade/Makefile b/apps/sceneupgrade/Makefile index 3c0e6bf6d..c7ed81115 100644 --- a/apps/sceneupgrade/Makefile +++ b/apps/sceneupgrade/Makefile @@ -3,7 +3,7 @@ TARGET := $(shell basename `pwd`) include ${MVE_ROOT}/Makefile.inc CXXFLAGS += -I${MVE_ROOT}/libs ${OPENMP} -LDLIBS += -lpng -ltiff -ljpeg ${OPENMP} +LDLIBS += ${LIBJPEG_LDFLAGS} ${LIBPNG_LDFLAGS} ${LIBTIFF_LDFLAGS} ${OPENMP} SOURCES := $(wildcard [^_]*.cc) ${TARGET}: ${SOURCES:.cc=.o} libmve_sfm.a libmve.a libmve_util.a diff --git a/apps/sfmrecon/Makefile b/apps/sfmrecon/Makefile index 3c0e6bf6d..c7ed81115 100644 --- a/apps/sfmrecon/Makefile +++ b/apps/sfmrecon/Makefile @@ -3,7 +3,7 @@ TARGET := $(shell basename `pwd`) include ${MVE_ROOT}/Makefile.inc CXXFLAGS += -I${MVE_ROOT}/libs ${OPENMP} -LDLIBS += -lpng -ltiff -ljpeg ${OPENMP} +LDLIBS += ${LIBJPEG_LDFLAGS} ${LIBPNG_LDFLAGS} ${LIBTIFF_LDFLAGS} ${OPENMP} SOURCES := $(wildcard [^_]*.cc) ${TARGET}: ${SOURCES:.cc=.o} libmve_sfm.a libmve.a libmve_util.a diff --git a/apps/umve/umve.pro b/apps/umve/umve.pro index a6c4227c3..850ee6954 100644 --- a/apps/umve/umve.pro +++ b/apps/umve/umve.pro @@ -1,6 +1,7 @@ MVE_ROOT = ../.. -CONFIG += qt release c++11 +CONFIG += link_pkgconfig qt release c++11 +PKGCONFIG += libjpeg libpng libtiff-4 QT += concurrent opengl QMAKE_LFLAGS += -rdynamic -fopenmp @@ -13,7 +14,7 @@ TARGET = umve INCLUDEPATH += $${MVE_ROOT}/libs DEPENDPATH += $${MVE_ROOT}/libs -LIBS = $${MVE_ROOT}/libs/dmrecon/libmve_dmrecon.a $${MVE_ROOT}/libs/mve/libmve.a $${MVE_ROOT}/libs/ogl/libmve_ogl.a $${MVE_ROOT}/libs/util/libmve_util.a -lpng -ljpeg -ltiff +LIBS = $${MVE_ROOT}/libs/dmrecon/libmve_dmrecon.a $${MVE_ROOT}/libs/mve/libmve.a $${MVE_ROOT}/libs/ogl/libmve_ogl.a $${MVE_ROOT}/libs/util/libmve_util.a QMAKE_LIBDIR_QT = OBJECTS_DIR = build diff --git a/libs/dmrecon/patch_optimization.cc b/libs/dmrecon/patch_optimization.cc index e1862276b..32065d236 100644 --- a/libs/dmrecon/patch_optimization.cc +++ b/libs/dmrecon/patch_optimization.cc @@ -313,7 +313,6 @@ PatchOptimization::optimizeDepthAndNormal() math::Vec3d ATb(0.f); Samples const & mCol = sampler->getMasterColorSamples(); IndexSet::const_iterator id; - std::size_t row = 0; for (id = neighIDs.begin(); id != neighIDs.end(); ++id) { Samples nCol, nDeriv; @@ -341,7 +340,6 @@ PatchOptimization::optimizeDepthAndNormal() ATA(1,2) += a_i[1] * a_i[2]; ATA(2,2) += a_i[2] * a_i[2]; ATb += a_i * b_i; - ++row; } } } diff --git a/libs/fssr/Makefile b/libs/fssr/Makefile index 63ba5a838..a1fcf087b 100644 --- a/libs/fssr/Makefile +++ b/libs/fssr/Makefile @@ -3,7 +3,7 @@ TARGET := libmve_fssr.a include ${MVE_ROOT}/Makefile.inc CXXFLAGS += -fPIC -I${MVE_ROOT}/libs ${OPENMP} -LDLIBS += -lpng -ltiff -ljpeg ${OPENMP} +LDLIBS += ${LIBJPEG_LDFLAGS} ${LIBPNG_LDFLAGS} ${LIBTIFF_LDFLAGS} ${OPENMP} SOURCES := $(wildcard [^_]*.cc) ${TARGET}: ${SOURCES:.cc=.o} diff --git a/libs/mve/Makefile b/libs/mve/Makefile index 6240ddab2..b583e9576 100644 --- a/libs/mve/Makefile +++ b/libs/mve/Makefile @@ -3,8 +3,8 @@ TARGET := libmve.a include ${MVE_ROOT}/Makefile.inc # Position independent code (-fPIC) is required for the UMVE plugin system. -CXXFLAGS += -fPIC -I${MVE_ROOT}/libs -LDLIBS += -lpng -ltiff -ljpeg +CXXFLAGS += -fPIC -I${MVE_ROOT}/libs ${LIBJPEG_CFLAGS} ${LIBPNG_CFLAGS} ${LIBTIFF_CFLAGS} +LDLIBS += ${LIBJPEG_LDFLAGS} ${LIBPNG_LDFLAGS} ${LIBTIFF_LDFLAGS} SOURCES := $(wildcard [^_]*.cc) ${TARGET}: ${SOURCES:.cc=.o} diff --git a/libs/mve/bundle_io.cc b/libs/mve/bundle_io.cc index c3fcd9bf4..f7bf153b3 100644 --- a/libs/mve/bundle_io.cc +++ b/libs/mve/bundle_io.cc @@ -740,7 +740,6 @@ load_colmap_points_3D_txt(std::string const& points3D_filename, Bundle::Features& features = bundle->get_features(); std::size_t num_views = bundle->get_cameras().size(); - int num_points_3d = 0; std::string point_3d_line; while (std::getline(in_points3D, point_3d_line)) { @@ -798,7 +797,6 @@ load_colmap_points_3D_txt(std::string const& points3D_filename, } feature_3d.refs = refs; features.push_back(feature_3d); - ++num_points_3d; } in_points3D.close(); } diff --git a/libs/mve/image_io.cc b/libs/mve/image_io.cc index 6e0273d53..2d953a25b 100644 --- a/libs/mve/image_io.cc +++ b/libs/mve/image_io.cc @@ -631,7 +631,7 @@ void tiff_error_handler (char const* /*module*/, char const* fmt, va_list ap) { char msg[2048]; - ::vsprintf(msg, fmt, ap); + ::vsnprintf(msg, 2048, fmt, ap); throw util::Exception(msg); } diff --git a/libs/sfm/Makefile b/libs/sfm/Makefile index a42670f3b..6e44527f2 100644 --- a/libs/sfm/Makefile +++ b/libs/sfm/Makefile @@ -3,7 +3,7 @@ TARGET := libmve_sfm.a include ${MVE_ROOT}/Makefile.inc CXXFLAGS += -I${MVE_ROOT}/libs ${OPENMP} -LDLIBS += -lpng -ltiff -ljpeg +LDLIBS += ${LIBJPEG_LDFLAGS} ${LIBPNG_LDFLAGS} ${LIBTIFF_LDFLAGS} SOURCES := $(wildcard [^_]*.cc) ${TARGET}: ${SOURCES:.cc=.o} diff --git a/libs/sfm/cascade_hashing.h b/libs/sfm/cascade_hashing.h index 048330925..8b63cc1cb 100644 --- a/libs/sfm/cascade_hashing.h +++ b/libs/sfm/cascade_hashing.h @@ -357,7 +357,7 @@ CascadeHashing::oneway_match (Matching::Options const& matching_opts, top_candidates.reserve(max_num_candidates); - std::unique_ptr tmp(new T[max_num_candidates * descriptor_length]); + std::unique_ptr tmp(new T[max_num_candidates * descriptor_length]); NearestNeighbor nn; nn.set_elements(tmp.get()); nn.set_element_dimensions(descriptor_length); diff --git a/libs/util/string_utils.h b/libs/util/string_utils.h index 9eb126307..dd3bb196d 100644 --- a/libs/util/string_utils.h +++ b/libs/util/string_utils.h @@ -158,6 +158,26 @@ convert (std::string const& str, bool strict_conversion) return ret; } +#if defined(_LIBCPP_VERSION) +/* LLVM's libc++'s behavior when parsing a double from a stream is different + * than GCC's libstdc++, see the following issue: + * https://www.github.com/llvm/llvm-project/issues/18156 + * + * This is why the following workaround is needed when compiling against + * libc++. + */ +template <> +inline double +convert (std::string const& str, bool strict_conversion) +{ + std::size_t pos = 0; + double ret = std::stod(str, &pos); + if (strict_conversion && pos != str.length()) + throw std::invalid_argument("Invalid string conversion: " + str); + return ret; +} +#endif + template inline char const* for_type (void) diff --git a/tests/Makefile b/tests/Makefile index 497136cb8..9964f8863 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -1,16 +1,17 @@ MVE_ROOT := .. TARGET := test include ${MVE_ROOT}/Makefile.inc -vpath libgtest_main.a ${GTEST_PATH}/build/lib -vpath libgtest.a ${GTEST_PATH}/build/lib + +GTEST_CFLAGS = `pkg-config --cflags gtest_main` +GTEST_LDFLAGS = `pkg-config --libs gtest_main` SOURCES = $(wildcard math/gtest_*.cc) $(wildcard mve/gtest_*.cc) $(wildcard sfm/gtest_*.cc) $(wildcard util/gtest_*.cc) $(wildcard fssr/gtest_*.cc) -INCLUDES = -I${MVE_ROOT}/libs -I${GTEST_PATH}/googletest/include +INCLUDES = -I${MVE_ROOT}/libs ${GTEST_CFLAGS} CXXWARNINGS = -Wall -Wextra -pedantic -Wno-sign-compare -CXXFLAGS = -std=c++11 -pthread ${CXXWARNINGS} ${INCLUDES} -LDLIBS += -lpng -ltiff -ljpeg +CXXFLAGS = -std=c++14 -pthread ${CXXWARNINGS} ${INCLUDES} +LDLIBS += ${GTEST_LDFLAGS} ${LIBJPEG_LDFLAGS} ${LIBPNG_LDFLAGS} ${LIBTIFF_LDFLAGS} -test: ${SOURCES:.cc=.o} libmve_fssr.a libmve_sfm.a libmve.a libmve_util.a libgtest_main.a libgtest.a +test: ${SOURCES:.cc=.o} libmve_fssr.a libmve_sfm.a libmve.a libmve_util.a ${LINK.cc} -o $@ $^ ${LDLIBS} clean: diff --git a/tests/sfm/gtest_surf.cc b/tests/sfm/gtest_surf.cc index 17cfb7f6c..7a89f25c4 100644 --- a/tests/sfm/gtest_surf.cc +++ b/tests/sfm/gtest_surf.cc @@ -148,7 +148,7 @@ TEST_F(SurfTest, TestHaarWaveletsLargerKernel) this->set_image(create_incrementing_image(6)); this->filter_dx_dy(3, 3, 2, &dx, &dy); EXPECT_EQ(1.0f, dx); - EXPECT_EQ(6.0f, dy); + EXPECT_FLOAT_EQ(6.0f, dy); } TEST_F(SurfTest, TestHaarWaveletsHugeKernel)