From bc62be4922e961139e3cb026e2003cc8f9b99442 Mon Sep 17 00:00:00 2001 From: Vladyslav Usenko Date: Fri, 19 Apr 2019 16:50:12 +0200 Subject: [PATCH 01/10] fixed unitialized jacobian --- include/basalt/vi_estimator/ba_base.h | 40 +++++++++++++++------------ 1 file changed, 23 insertions(+), 17 deletions(-) diff --git a/include/basalt/vi_estimator/ba_base.h b/include/basalt/vi_estimator/ba_base.h index 829aca5..7cc0a72 100644 --- a/include/basalt/vi_estimator/ba_base.h +++ b/include/basalt/vi_estimator/ba_base.h @@ -174,6 +174,7 @@ class BundleAdjustmentBase { if (d_res_d_p) { Eigen::Matrix Jpp; + Jpp.setZero(); Jpp.block<3, 2>(0, 0) = T_t_h.topLeftCorner<3, 4>() * Jup; Jpp.col(2) = T_t_h.col(3); @@ -215,6 +216,7 @@ class BundleAdjustmentBase { if (d_res_d_p) { Eigen::Matrix Jpp; + Jpp.setZero(); Jpp.block<4, 2>(0, 0) = Jup; Jpp.col(2).setZero(); @@ -284,28 +286,32 @@ class BundleAdjustmentBase { continue; accum.template addH( - abs_h_idx, abs_h_idx, rld.d_rel_d_h[i].transpose() * - rel_H.block( - POSE_SIZE * i, POSE_SIZE * j) * - rld.d_rel_d_h[j]); + abs_h_idx, abs_h_idx, + rld.d_rel_d_h[i].transpose() * + rel_H.block(POSE_SIZE * i, + POSE_SIZE * j) * + rld.d_rel_d_h[j]); accum.template addH( - abs_ti_idx, abs_h_idx, rld.d_rel_d_t[i].transpose() * - rel_H.block( - POSE_SIZE * i, POSE_SIZE * j) * - rld.d_rel_d_h[j]); + abs_ti_idx, abs_h_idx, + rld.d_rel_d_t[i].transpose() * + rel_H.block(POSE_SIZE * i, + POSE_SIZE * j) * + rld.d_rel_d_h[j]); accum.template addH( - abs_h_idx, abs_tj_idx, rld.d_rel_d_h[i].transpose() * - rel_H.block( - POSE_SIZE * i, POSE_SIZE * j) * - rld.d_rel_d_t[j]); + abs_h_idx, abs_tj_idx, + rld.d_rel_d_h[i].transpose() * + rel_H.block(POSE_SIZE * i, + POSE_SIZE * j) * + rld.d_rel_d_t[j]); accum.template addH( - abs_ti_idx, abs_tj_idx, rld.d_rel_d_t[i].transpose() * - rel_H.block( - POSE_SIZE * i, POSE_SIZE * j) * - rld.d_rel_d_t[j]); + abs_ti_idx, abs_tj_idx, + rld.d_rel_d_t[i].transpose() * + rel_H.block(POSE_SIZE * i, + POSE_SIZE * j) * + rld.d_rel_d_t[j]); } } } @@ -369,4 +375,4 @@ class BundleAdjustmentBase { basalt::Calibration calib; }; -} +} // namespace basalt From ac80d2ea302354ecca06c9c9d1215c53b2e46628 Mon Sep 17 00:00:00 2001 From: Nikolaus Demmel Date: Wed, 24 Apr 2019 03:55:57 +0200 Subject: [PATCH 02/10] Fix unused constant warning. --- src/mapper_sim.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mapper_sim.cpp b/src/mapper_sim.cpp index 860a99f..4d47b5a 100644 --- a/src/mapper_sim.cpp +++ b/src/mapper_sim.cpp @@ -120,7 +120,7 @@ double alignButton(); void setup_points(); constexpr int UI_WIDTH = 200; -constexpr int NUM_FRAMES = 500; +//constexpr int NUM_FRAMES = 500; basalt::Calibration calib; From 9624f6b391e9c2efa69f28241587144e00565f17 Mon Sep 17 00:00:00 2001 From: Nikolaus Demmel Date: Wed, 24 Apr 2019 13:16:06 +0200 Subject: [PATCH 03/10] add ./scripts/clang-format-all.sh and fix formatting --- .clang-format | 7 +- include/basalt/calibration/vignette.h | 2 +- include/basalt/io/dataset_io.h | 5 +- .../basalt/optimization/spline_linearize.h | 35 ++++---- include/basalt/utils/common_types.h | 4 +- include/basalt/utils/keypoints.h | 2 +- include/basalt/utils/nfr.h | 2 +- include/basalt/utils/sim_utils.h | 6 +- include/basalt/utils/tracks.h | 5 +- scripts/clang-format-all.sh | 43 ++++++++++ src/calibrate.cpp | 1 - src/calibration/vignette.cpp | 1 - src/io/dataset_io.cpp | 1 - src/mapper.cpp | 2 +- src/mapper_sim.cpp | 3 +- src/mapper_sim_naive.cpp | 5 +- src/opt_flow.cpp | 5 +- src/optical_flow/optical_flow.cpp | 1 - src/utils/keypoints.cpp | 2 +- src/vi_estimator/ba_base.cpp | 5 +- src/vio_sim.cpp | 11 ++- test/src/test_image.cpp | 17 ++-- test/src/test_nfr.cpp | 82 +++++++++---------- test/src/test_vio.cpp | 44 +++++----- 24 files changed, 161 insertions(+), 130 deletions(-) create mode 100755 scripts/clang-format-all.sh diff --git a/.clang-format b/.clang-format index dc0134c..1d57c03 100644 --- a/.clang-format +++ b/.clang-format @@ -1,6 +1,7 @@ --- -Language: Cpp -BasedOnStyle: Google -IndentWidth: 2 +Language: Cpp +BasedOnStyle: Google +IndentWidth: 2 +IncludeBlocks: Preserve ... diff --git a/include/basalt/calibration/vignette.h b/include/basalt/calibration/vignette.h index 15b7fb2..70bf97f 100644 --- a/include/basalt/calibration/vignette.h +++ b/include/basalt/calibration/vignette.h @@ -84,4 +84,4 @@ class VignetteEstimator { std::vector irradiance; std::vector> vign_param; }; -} +} // namespace basalt diff --git a/include/basalt/io/dataset_io.h b/include/basalt/io/dataset_io.h index 6909019..9473a55 100644 --- a/include/basalt/io/dataset_io.h +++ b/include/basalt/io/dataset_io.h @@ -179,8 +179,9 @@ template ::type - load(Archive &ar, Eigen::Matrix<_Scalar, _Rows, _Cols, _Options, _MaxRows, - _MaxCols> &matrix) { + load(Archive &ar, + Eigen::Matrix<_Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols> + &matrix) { std::int32_t rows; std::int32_t cols; ar(rows); diff --git a/include/basalt/optimization/spline_linearize.h b/include/basalt/optimization/spline_linearize.h index cf0eb7d..d396aa2 100644 --- a/include/basalt/optimization/spline_linearize.h +++ b/include/basalt/optimization/spline_linearize.h @@ -135,9 +135,9 @@ struct LinearizeSplineOpt : public LinearizeBase { // std::cout << "time " << time << std::endl; // std::cout << "sline.minTime() " << spline.minTime() << std::endl; - BASALT_ASSERT_STREAM(time_ns >= spline->minTimeNs(), - "time " << time_ns << " spline.minTimeNs() " - << spline->minTimeNs()); + BASALT_ASSERT_STREAM( + time_ns >= spline->minTimeNs(), + "time " << time_ns << " spline.minTimeNs() " << spline->minTimeNs()); // Residual from current value of spline Vector3 residual_pos = @@ -207,12 +207,12 @@ struct LinearizeSplineOpt : public LinearizeBase { // std::cout << "time " << t << std::endl; // std::cout << "sline.minTime() " << spline.minTime() << std::endl; - BASALT_ASSERT_STREAM(t >= spline->minTimeNs(), - "t " << t << " spline.minTime() " - << spline->minTimeNs()); - BASALT_ASSERT_STREAM(t <= spline->maxTimeNs(), - "t " << t << " spline.maxTime() " - << spline->maxTimeNs()); + BASALT_ASSERT_STREAM( + t >= spline->minTimeNs(), + "t " << t << " spline.minTime() " << spline->minTimeNs()); + BASALT_ASSERT_STREAM( + t <= spline->maxTimeNs(), + "t " << t << " spline.maxTime() " << spline->maxTimeNs()); Vector3 residual = spline->accelResidual( t, pm.data, this->common_data.calibration->calib_accel_bias, @@ -255,8 +255,9 @@ struct LinearizeSplineOpt : public LinearizeBase { BASALT_ASSERT(start_j < opt_size); accum.template addH( - start_i, start_j, accel_var_inv * J.d_val_d_knot[i].transpose() * - J.d_val_d_knot[j]); + start_i, start_j, + accel_var_inv * J.d_val_d_knot[i].transpose() * + J.d_val_d_knot[j]); } accum.template addH( start_bias, start_i, @@ -497,9 +498,9 @@ struct LinearizeSplineOpt : public LinearizeBase { if (time_ns < spline->minTimeNs() || time_ns >= spline->maxTimeNs()) continue; - BASALT_ASSERT_STREAM(time_ns >= spline->minTimeNs(), - "time " << time_ns << " spline.minTimeNs() " - << spline->minTimeNs()); + BASALT_ASSERT_STREAM( + time_ns >= spline->minTimeNs(), + "time " << time_ns << " spline.minTimeNs() " << spline->minTimeNs()); const SE3 T_moc_w = this->common_data.mocap_calibration->T_moc_w; const SE3 T_i_mark = this->common_data.mocap_calibration->T_i_mark; @@ -563,9 +564,9 @@ struct LinearizeSplineOpt : public LinearizeBase { d_res_d_T_w_i.transpose() * residual); accum.template addH( - start_T_moc_w, start_i, mocap_var_inv * - d_res_d_T_moc_w.transpose() * - d_res_d_T_w_i * J_pose.d_val_d_knot[i]); + start_T_moc_w, start_i, + mocap_var_inv * d_res_d_T_moc_w.transpose() * d_res_d_T_w_i * + J_pose.d_val_d_knot[i]); accum.template addH( start_T_i_mark, start_i, diff --git a/include/basalt/utils/common_types.h b/include/basalt/utils/common_types.h index c9a543e..00526bf 100644 --- a/include/basalt/utils/common_types.h +++ b/include/basalt/utils/common_types.h @@ -238,7 +238,7 @@ using ImageProjections = std::map; /// inlier projections indexed per track using TrackProjections = std::unordered_map>; -} +} // namespace basalt namespace cereal { @@ -251,4 +251,4 @@ template void serialize(Archive& ar, basalt::MatchData& c) { ar(c.T_i_j, c.matches, c.inliers); } -} +} // namespace cereal diff --git a/include/basalt/utils/keypoints.h b/include/basalt/utils/keypoints.h index c556477..3cd3768 100644 --- a/include/basalt/utils/keypoints.h +++ b/include/basalt/utils/keypoints.h @@ -53,7 +53,7 @@ namespace basalt { typedef std::bitset<256> Descriptor; void detectKeypointsMapping(const basalt::Image& img_raw, - KeypointsData& kd, int num_features); + KeypointsData& kd, int num_features); void detectKeypoints(const basalt::Image& img_raw, KeypointsData& kd, int PATCH_SIZE = 32, diff --git a/include/basalt/utils/nfr.h b/include/basalt/utils/nfr.h index 24d9fab..8f8095f 100644 --- a/include/basalt/utils/nfr.h +++ b/include/basalt/utils/nfr.h @@ -117,4 +117,4 @@ inline Sophus::Vector2d rollPitchError( return res.head<2>(); } -} +} // namespace basalt diff --git a/include/basalt/utils/sim_utils.h b/include/basalt/utils/sim_utils.h index dc7dc42..15b5806 100644 --- a/include/basalt/utils/sim_utils.h +++ b/include/basalt/utils/sim_utils.h @@ -43,13 +43,11 @@ struct SimObservations { std::vector id; }; -} +} // namespace basalt namespace cereal { template void serialize(Archive& ar, basalt::SimObservations& c) { ar(c.pos, c.id); } -} - - +} // namespace cereal diff --git a/include/basalt/utils/tracks.h b/include/basalt/utils/tracks.h index b6a4b83..72b2106 100644 --- a/include/basalt/utils/tracks.h +++ b/include/basalt/utils/tracks.h @@ -47,11 +47,8 @@ #include #include - namespace basalt { - - /// TrackBuild class creates feature tracks from matches struct TrackBuilder { std::map map_node_to_index; @@ -222,4 +219,4 @@ bool GetSharedTracks(const TimeCamId& image_id, const FeatureTracks& all_tracks, return !track_ids.empty(); } -} +} // namespace basalt diff --git a/scripts/clang-format-all.sh b/scripts/clang-format-all.sh new file mode 100755 index 0000000..79b7bea --- /dev/null +++ b/scripts/clang-format-all.sh @@ -0,0 +1,43 @@ +#!/usr/bin/env bash + +# Format all source files in the project. +# Optionally take folder as argument; default is full inlude and src dirs. + +set -e + +SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" + +FOLDER="${1:-$SCRIPT_DIR/../include $SCRIPT_DIR/../src $SCRIPT_DIR/../test/src}" + +CLANG_FORMAT_COMMANDS="clang-format-9 clang-format-8 clang-format" + +# find the first available command: +for CMD in $CLANG_FORMAT_COMMANDS; do + if hash $CMD 2>/dev/null; then + CLANG_FORMAT_CMD=$CMD + break + fi +done + +if [ -z $CLANG_FORMAT_CMD ]; then + echo "clang-format not installed..." + exit 1 +fi + +# clang format check version +MAJOR_VERSION_NEEDED=8 + +MAJOR_VERSION_DETECTED=`$CLANG_FORMAT_CMD -version | sed -n -E 's/.*version ([0-9]+).*/\1/p'` +if [ -z $MAJOR_VERSION_DETECTED ]; then + echo "Failed to parse major version (`$CLANG_FORMAT_CMD -version`)" + exit 1 +fi + +echo "clang-format version $MAJOR_VERSION_DETECTED (`$CLANG_FORMAT_CMD -version`)" + +if [ $MAJOR_VERSION_DETECTED -lt $MAJOR_VERSION_NEEDED ]; then + echo "Looks like your clang format is too old; need at least version $MAJOR_VERSION_NEEDED" + exit 1 +fi + +find $FOLDER -iname "*.?pp" -or -iname "*.h" | xargs $CLANG_FORMAT_CMD -verbose -i diff --git a/src/calibrate.cpp b/src/calibrate.cpp index 8555328..00dabca 100644 --- a/src/calibrate.cpp +++ b/src/calibrate.cpp @@ -33,7 +33,6 @@ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - #include #include diff --git a/src/calibration/vignette.cpp b/src/calibration/vignette.cpp index 0a8619a..520c4e4 100644 --- a/src/calibration/vignette.cpp +++ b/src/calibration/vignette.cpp @@ -33,7 +33,6 @@ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - #include namespace basalt { diff --git a/src/io/dataset_io.cpp b/src/io/dataset_io.cpp index ac1a044..f49fbaf 100644 --- a/src/io/dataset_io.cpp +++ b/src/io/dataset_io.cpp @@ -33,7 +33,6 @@ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - #include #include #include diff --git a/src/mapper.cpp b/src/mapper.cpp index 158f4a5..fa6ae57 100644 --- a/src/mapper.cpp +++ b/src/mapper.cpp @@ -323,7 +323,7 @@ int main(int argc, char** argv) { std::this_thread::sleep_for(std::chrono::milliseconds(50)); } } else { - //optimize(); + // optimize(); detect(); match(); tracks(); diff --git a/src/mapper_sim.cpp b/src/mapper_sim.cpp index 4d47b5a..9907870 100644 --- a/src/mapper_sim.cpp +++ b/src/mapper_sim.cpp @@ -33,7 +33,6 @@ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - #include #include #include @@ -120,7 +119,7 @@ double alignButton(); void setup_points(); constexpr int UI_WIDTH = 200; -//constexpr int NUM_FRAMES = 500; +// constexpr int NUM_FRAMES = 500; basalt::Calibration calib; diff --git a/src/mapper_sim_naive.cpp b/src/mapper_sim_naive.cpp index 2f06d76..6a184c8 100644 --- a/src/mapper_sim_naive.cpp +++ b/src/mapper_sim_naive.cpp @@ -33,7 +33,6 @@ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - #include #include #include @@ -492,8 +491,8 @@ void load_data(const std::string& calib_path) { if (os.is_open()) { cereal::JSONInputArchive archive(os); archive(calib); - std::cout << "Loaded camera with " << calib.intrinsics.size() - << " cameras" << std::endl; + std::cout << "Loaded camera with " << calib.intrinsics.size() << " cameras" + << std::endl; } else { std::cerr << "could not load camera calibration " << calib_path diff --git a/src/opt_flow.cpp b/src/opt_flow.cpp index 3cc41b4..ab74b3e 100644 --- a/src/opt_flow.cpp +++ b/src/opt_flow.cpp @@ -33,7 +33,6 @@ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - #include #include #include @@ -321,8 +320,8 @@ void load_data(const std::string& calib_path) { if (os.is_open()) { cereal::JSONInputArchive archive(os); archive(calib); - std::cout << "Loaded camera with " << calib.intrinsics.size() - << " cameras" << std::endl; + std::cout << "Loaded camera with " << calib.intrinsics.size() << " cameras" + << std::endl; } else { std::cerr << "could not load camera calibration " << calib_path diff --git a/src/optical_flow/optical_flow.cpp b/src/optical_flow/optical_flow.cpp index 7861fae..e68d09a 100644 --- a/src/optical_flow/optical_flow.cpp +++ b/src/optical_flow/optical_flow.cpp @@ -33,7 +33,6 @@ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - #include #include diff --git a/src/utils/keypoints.cpp b/src/utils/keypoints.cpp index f7336f1..9d7e768 100644 --- a/src/utils/keypoints.cpp +++ b/src/utils/keypoints.cpp @@ -128,7 +128,7 @@ const static char pattern_31_y_b[256] = { -11}; void detectKeypointsMapping(const basalt::Image& img_raw, - KeypointsData& kd, int num_features) { + KeypointsData& kd, int num_features) { cv::Mat image(img_raw.h, img_raw.w, CV_8U); uint8_t* dst = image.ptr(); diff --git a/src/vi_estimator/ba_base.cpp b/src/vi_estimator/ba_base.cpp index 82b480d..0d93f5b 100644 --- a/src/vi_estimator/ba_base.cpp +++ b/src/vi_estimator/ba_base.cpp @@ -33,8 +33,6 @@ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - - #include #include @@ -354,7 +352,6 @@ void BundleAdjustmentBase::linearizeHelper( } } } - }); for (const auto& rld : rld_vec) error += rld.error; @@ -522,4 +519,4 @@ void BundleAdjustmentBase::marginalizeHelper(Eigen::MatrixXd& abs_H, abs_H.resize(0, 0); abs_b.resize(0); } -} +} // namespace basalt diff --git a/src/vio_sim.cpp b/src/vio_sim.cpp index 10ec81c..4b79f65 100644 --- a/src/vio_sim.cpp +++ b/src/vio_sim.cpp @@ -33,7 +33,6 @@ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - #include #include #include @@ -541,8 +540,8 @@ void load_data(const std::string& calib_path) { if (os.is_open()) { cereal::JSONInputArchive archive(os); archive(calib); - std::cout << "Loaded camera with " << calib.intrinsics.size() - << " cameras" << std::endl; + std::cout << "Loaded camera with " << calib.intrinsics.size() << " cameras" + << std::endl; } else { std::cerr << "could not load camera calibration " << calib_path @@ -595,9 +594,9 @@ void compute_projections() { void gen_data() { for (size_t i = 0; i < calib.intrinsics.size(); i++) { images.emplace_back(); - images.back() = pangolin::TypedImage( - calib.resolution[i][0], calib.resolution[i][1], - pangolin::PixelFormatFromString("GRAY8")); + images.back() = + pangolin::TypedImage(calib.resolution[i][0], calib.resolution[i][1], + pangolin::PixelFormatFromString("GRAY8")); images.back().Fill(200); } diff --git a/test/src/test_image.cpp b/test/src/test_image.cpp index ab47c20..e1f1375 100644 --- a/test/src/test_image.cpp +++ b/test/src/test_image.cpp @@ -27,14 +27,15 @@ TEST(Pattern, ImageInterp) { // std::cerr << "vg\n" << vg << std::endl; - test_jacobian("d_val_d_p", J, - [&](const Eigen::Vector2d &x) { - Eigen::Matrix res; - Eigen::Vector2d p1 = offset + x; - res[0] = img.interpGrad(p1)[0]; - return res; - }, - Eigen::Vector2d::Zero(), 1.0); + test_jacobian( + "d_val_d_p", J, + [&](const Eigen::Vector2d &x) { + Eigen::Matrix res; + Eigen::Vector2d p1 = offset + x; + res[0] = img.interpGrad(p1)[0]; + return res; + }, + Eigen::Vector2d::Zero(), 1.0); } TEST(Image, ImageInterpolate) { diff --git a/test/src/test_nfr.cpp b/test/src/test_nfr.cpp index ebf6fea..7f28686 100644 --- a/test/src/test_nfr.cpp +++ b/test/src/test_nfr.cpp @@ -34,29 +34,29 @@ TEST(PreIntegrationTestSuite, RelPoseTest) { { Sophus::Vector6d x0; x0.setZero(); - test_jacobian("d_res_d_T_w_i", d_res_d_T_w_i, - [&](const Sophus::Vector6d& x) { - auto T_w_i_new = T_w_i; - basalt::PoseState::incPose(x, T_w_i_new); + test_jacobian( + "d_res_d_T_w_i", d_res_d_T_w_i, + [&](const Sophus::Vector6d& x) { + auto T_w_i_new = T_w_i; + basalt::PoseState::incPose(x, T_w_i_new); - return basalt::relPoseError(T_i_j, T_w_i_new, T_w_j); - - }, - x0); + return basalt::relPoseError(T_i_j, T_w_i_new, T_w_j); + }, + x0); } { Sophus::Vector6d x0; x0.setZero(); - test_jacobian("d_res_d_T_w_j", d_res_d_T_w_j, - [&](const Sophus::Vector6d& x) { - auto T_w_j_new = T_w_j; - basalt::PoseState::incPose(x, T_w_j_new); + test_jacobian( + "d_res_d_T_w_j", d_res_d_T_w_j, + [&](const Sophus::Vector6d& x) { + auto T_w_j_new = T_w_j; + basalt::PoseState::incPose(x, T_w_j_new); - return basalt::relPoseError(T_i_j, T_w_i, T_w_j_new); - - }, - x0); + return basalt::relPoseError(T_i_j, T_w_i, T_w_j_new); + }, + x0); } } @@ -71,15 +71,15 @@ TEST(PreIntegrationTestSuite, AbsPositionTest) { { Sophus::Vector6d x0; x0.setZero(); - test_jacobian("d_res_d_T_w_i", d_res_d_T_w_i, - [&](const Sophus::Vector6d& x) { - auto T_w_i_new = T_w_i; - basalt::PoseState::incPose(x, T_w_i_new); + test_jacobian( + "d_res_d_T_w_i", d_res_d_T_w_i, + [&](const Sophus::Vector6d& x) { + auto T_w_i_new = T_w_i; + basalt::PoseState::incPose(x, T_w_i_new); - return basalt::absPositionError(T_w_i_new, pos); - - }, - x0); + return basalt::absPositionError(T_w_i_new, pos); + }, + x0); } } @@ -97,17 +97,17 @@ TEST(PreIntegrationTestSuite, YawTest) { { Sophus::Vector6d x0; x0.setZero(); - test_jacobian("d_res_d_T_w_i", d_res_d_T_w_i, - [&](const Sophus::Vector6d& x) { - auto T_w_i_new = T_w_i; - basalt::PoseState::incPose(x, T_w_i_new); + test_jacobian( + "d_res_d_T_w_i", d_res_d_T_w_i, + [&](const Sophus::Vector6d& x) { + auto T_w_i_new = T_w_i; + basalt::PoseState::incPose(x, T_w_i_new); - double res = basalt::yawError(T_w_i_new, yaw_dir_body); + double res = basalt::yawError(T_w_i_new, yaw_dir_body); - return Eigen::Matrix(res); - - }, - x0); + return Eigen::Matrix(res); + }, + x0); } } @@ -124,14 +124,14 @@ TEST(PreIntegrationTestSuite, RollPitchTest) { { Sophus::Vector6d x0; x0.setZero(); - test_jacobian("d_res_d_T_w_i", d_res_d_T_w_i, - [&](const Sophus::Vector6d& x) { - auto T_w_i_new = T_w_i; - basalt::PoseState::incPose(x, T_w_i_new); + test_jacobian( + "d_res_d_T_w_i", d_res_d_T_w_i, + [&](const Sophus::Vector6d& x) { + auto T_w_i_new = T_w_i; + basalt::PoseState::incPose(x, T_w_i_new); - return basalt::rollPitchError(T_w_i_new, R_w_i); - - }, - x0); + return basalt::rollPitchError(T_w_i_new, R_w_i); + }, + x0); } } diff --git a/test/src/test_vio.cpp b/test/src/test_vio.cpp index ab039fa..68b9a90 100644 --- a/test/src/test_vio.cpp +++ b/test/src/test_vio.cpp @@ -372,37 +372,37 @@ TEST(PreIntegrationTestSuite, LinearizePointsTest) { { Sophus::Vector6d x0; x0.setZero(); - test_jacobian("d_res_d_xi", d_res_d_xi, - [&](const Sophus::Vector6d& x) { - Eigen::Matrix4d T_t_h_new = - (Sophus::expd(x) * T_t_h_sophus).matrix(); + test_jacobian( + "d_res_d_xi", d_res_d_xi, + [&](const Sophus::Vector6d& x) { + Eigen::Matrix4d T_t_h_new = (Sophus::expd(x) * T_t_h_sophus).matrix(); - Eigen::Vector2d res; - basalt::KeypointVioEstimator::linearizePoint( - kpt_obs, kpt_pos, T_t_h_new, cam, res); + Eigen::Vector2d res; + basalt::KeypointVioEstimator::linearizePoint(kpt_obs, kpt_pos, + T_t_h_new, cam, res); - return res; - }, - x0); + return res; + }, + x0); } { Eigen::Vector3d x0; x0.setZero(); - test_jacobian("d_res_d_p", d_res_d_p, - [&](const Eigen::Vector3d& x) { - basalt::KeypointVioEstimator::KeypointPosition kpt_pos_new = - kpt_pos; + test_jacobian( + "d_res_d_p", d_res_d_p, + [&](const Eigen::Vector3d& x) { + basalt::KeypointVioEstimator::KeypointPosition kpt_pos_new = kpt_pos; - kpt_pos_new.dir += x.head<2>(); - kpt_pos_new.id += x[2]; + kpt_pos_new.dir += x.head<2>(); + kpt_pos_new.id += x[2]; - Eigen::Vector2d res; - basalt::KeypointVioEstimator::linearizePoint( - kpt_obs, kpt_pos_new, T_t_h, cam, res); + Eigen::Vector2d res; + basalt::KeypointVioEstimator::linearizePoint(kpt_obs, kpt_pos_new, + T_t_h, cam, res); - return res; - }, - x0); + return res; + }, + x0); } } From 7f705b252555e117e3409fd4e00848aba42be155 Mon Sep 17 00:00:00 2001 From: Nikolaus Demmel Date: Wed, 24 Apr 2019 13:16:50 +0200 Subject: [PATCH 04/10] Update basalt-headers submodule. --- thirdparty/basalt-headers | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/thirdparty/basalt-headers b/thirdparty/basalt-headers index 4a77135..5f9fc49 160000 --- a/thirdparty/basalt-headers +++ b/thirdparty/basalt-headers @@ -1 +1 @@ -Subproject commit 4a771353447a0dd4e47a0041ada6385363a34f3b +Subproject commit 5f9fc492564cb81f51f0b71508c037db712ee5d1 From 2d247ac74c1167af6a8f4867e0a6b83022e12e8c Mon Sep 17 00:00:00 2001 From: Nikolaus Demmel Date: Wed, 24 Apr 2019 13:17:12 +0200 Subject: [PATCH 05/10] fix install_mac_os_deps.sh --- scripts/install_mac_os_deps.sh | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/scripts/install_mac_os_deps.sh b/scripts/install_mac_os_deps.sh index 237c253..88c445b 100755 --- a/scripts/install_mac_os_deps.sh +++ b/scripts/install_mac_os_deps.sh @@ -1,4 +1,15 @@ #!/bin/sh -brew install clang-format tbb glew eigen ccache -brew install --with-toolchain llvm +brew install \ + boost \ + opencv \ + cmake \ + pkgconfig \ + lz4 \ + clang-format \ + tbb \ + glew \ + eigen \ + ccache + +brew install llvm From 6755f08678ddb057befd0b217c0f6c88e6d70eef Mon Sep 17 00:00:00 2001 From: Nikolaus Demmel Date: Wed, 24 Apr 2019 14:21:24 +0200 Subject: [PATCH 06/10] ci and cmake improvements Changes along the line of https://gitlab.com/VladyslavUsenko/basalt-headers/merge_requests/1 and https://gitlab.com/VladyslavUsenko/basalt-headers/merge_requests/2, and more. Warning free builds on macos 10.11 - 10.14, Ubuntu Xenial & Bionic. (macOS 10.14 is not yet in CI, but tested locally.) Changes similar to basalt-headers: - cmake: raise minimum version to 3.10 - cmake: add workarounds to support macOS < 10.14 - cmake: set ccache only if not yet set and print info - cmake: add NDEBUG define (to disable asserts) for release build and EIGEN_INITIALIZE_MATRICES_BY_NAN for others. Add externally supplied CMAKE_CXX_FLAGS at the end to allow overriding the defaults. - tests: add enable_testing() in main CMakeLists.txt, such that we can call 'ctest' from build folder. - tests: simplify gtest / gtest_main linking - tests: use the newer gtest_discover_tests instead of add_test, which adds a separate cmake test for every gtest, even with multiple defined in a single executable. Its not only more reliable and less verbose in the CMakeLists.txt, but also allows to run 'ctest' without -V and still see status for every individual test. - ci: add build jobs for Debug/RelWithDebInfo on Bionic, as well as builds on Xenial and El Capitan. Use templates to simplify .gitlab-ci.yml - ci: clang-format job Additional changes: - cmake: unify formatting - cmake: various diagnostic warnings for situations that are unsupported (should help with gitlab issues). - cmake options to disable openmp, pass custom eigen root, compiler-launcher, additional CXX_FLAGS that can override default flags also for submodules (opengv etc), ... - cmake: moved configuration of submodule libs to `thirdparty/CMakeLists.txt`. This includes various fixes for limiatations of the thirdparty cmake definitions. In particular ensures that correct eigen is used, that opengv respects march and CXX_FLAGS passed from command line. - cmake: simplified linking of executables. Linking `basalt` is enough. - cmake: basalt sources now build with the minimal disabled warnings ("-Wall Wextra -Werror -Wno-unused-parameter -ftemplate-backtrace-limit=0", and additionally "-Wno-exceptions" for clang). Additional flags are now only set for the submodule targets in thirdparty. - tests: Running ctest in build folder now also runs the unit tests from basalt-headers. - ci: in addition to the additional compile jobs and there are now also 'test' jobs, that check that the executables in the deb's work (runs on all branches, not just master). --- .gitlab-ci.yml | 195 +++++++++++++++++++-------- CMakeLists.txt | 271 +++++++++++++++++++++++--------------- test/CMakeLists.txt | 27 ++-- thirdparty/CMakeLists.txt | 106 +++++++++++++++ 4 files changed, 425 insertions(+), 174 deletions(-) create mode 100644 thirdparty/CMakeLists.txt diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index ad908c6..af4dc2c 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,83 +1,173 @@ image: vladyslavusenko/b_image:latest +variables: + GIT_SUBMODULE_STRATEGY: recursive + BUILD_TYPE: Release + CXX_MARCH: native + CMAKE_INSTALL_PREFIX: /usr/ + DEB_DIR: deb + stages: - build - test - - test_results + - eval + - eval_results - deploy -compile: - stage: build - variables: - CXX_MARCH: 'corei7-avx' +# template for docker builds with ccache +.prepare_docker_template: &prepare_docker_definition + tags: + - docker before_script: - mkdir -p ccache - export CCACHE_BASEDIR=${PWD} - export CCACHE_DIR=${PWD}/ccache - tags: - - docker cache: - key: bionic paths: - ccache/ + +# template for build & unit test & make deb configurations +.compile_test_package_template: &compile_test_package_definition + stage: build script: - - ./scripts/update_submodules.sh - mkdir build - cd build - - cmake .. -DCMAKE_BUILD_TYPE=Release -DCXX_MARCH=${CXX_MARCH} -DCMAKE_INSTALL_PREFIX=/usr/ + - cmake .. -DCMAKE_BUILD_TYPE=${BUILD_TYPE} -DCXX_MARCH=${CXX_MARCH} -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} - make -j3 + - ctest - make package - - cd test/ - - ctest -V - - cd ../../ - - mkdir deb_bionic - - cp build/*.deb deb_bionic/ + - cd .. + - mkdir $DEB_DIR + - mv build/*.deb $DEB_DIR/ + - dpkg -i $DEB_DIR/*.deb + # smoke test to see if all executables at least start up + - basalt_calibrate --help + - basalt_calibrate_imu --help + - basalt_mapper --help + - basalt_mapper_sim --help + - basalt_mapper_sim_naive --help + - basalt_opt_flow --help + - basalt_vio --help + - basalt_vio_sim --help + +# template for build & unit test configurations (no deb) +.compile_test_template: &compile_test_definition + stage: build + script: + - mkdir build + - cd build + - cmake .. -DCMAKE_BUILD_TYPE=${BUILD_TYPE} -DCXX_MARCH=${CXX_MARCH} -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} + - make -j3 + - ctest + # smoke test to see if all executables at least start up + - ./basalt_calibrate --help + - ./basalt_calibrate_imu --help + - ./basalt_mapper --help + - ./basalt_mapper_sim --help + - ./basalt_mapper_sim_naive --help + - ./basalt_opt_flow --help + - ./basalt_vio --help + - ./basalt_vio_sim --help + +# template to test debian +.test_deb_template: &test_deb_definition + stage: test + tags: + - docker + variables: + GIT_STRATEGY: none + script: + - dpkg -i $DEB_DIR/*.deb + # smoke test to see if all executables at least start up + - basalt_calibrate --help + - basalt_calibrate_imu --help + - basalt_mapper --help + - basalt_mapper_sim --help + - basalt_mapper_sim_naive --help + - basalt_opt_flow --help + - basalt_vio --help + - basalt_vio_sim --help + +bionic-release-compile: + <<: *prepare_docker_definition + <<: *compile_test_package_definition + cache: + key: bionic-release + variables: + CXX_MARCH: 'corei7-avx' + DEB_DIR: deb_bionic artifacts: paths: - deb_bionic/*.deb - scripts/eval_full/* expire_in: 1 week -compile_16_04: - stage: build +xenial-release-compile: + <<: *prepare_docker_definition + <<: *compile_test_package_definition + image: vladyslavusenko/b_image_xenial:latest + cache: + key: xenial-release variables: CXX_MARCH: 'corei7-avx' - before_script: - - mkdir -p ccache - - export CCACHE_BASEDIR=${PWD} - - export CCACHE_DIR=${PWD}/ccache - tags: - - docker - cache: - key: xenial - paths: - - ccache/ - script: - - ./scripts/update_submodules.sh - - mkdir build - - cd build - - cmake .. -DCMAKE_BUILD_TYPE=Release -DCXX_MARCH=${CXX_MARCH} -DCMAKE_INSTALL_PREFIX=/usr/ - - make -j3 - - make package - - cd test/ - - ctest -V - - cd ../../ - - mkdir deb_xenial - - cp build/*.deb deb_xenial/ + DEB_DIR: deb_xenial artifacts: paths: - deb_xenial/*.deb expire_in: 1 week - only: - - master + +bionic-debug-compile: + <<: *prepare_docker_definition + <<: *compile_test_package_definition + cache: + key: bionic-debug + variables: + BUILD_TYPE: Debug + +bionic-relwithdebinfo-compile: + <<: *prepare_docker_definition + <<: *compile_test_package_definition + cache: + key: bionic-relwithdebinfo + variables: + BUILD_TYPE: RelWithDebInfo + +elcapitan-relwithdebinfo-compile: + <<: *compile_test_definition + tags: [macos, "10.11"] + variables: + BUILD_TYPE: RelWithDebInfo + +# check if clang-format would make any changes +clang-format: + # TODO: add clang-format version >= 8 to "vladyslavusenko/b_image" + image: nikolausdemmel/ubuntu-dev-dbatk:16.04 + tags: + - docker + stage: build + variables: + GIT_SUBMODULE_STRATEGY: none + script: + - ./scripts/clang-format-all.sh + # check if any files are now modified and error if yes + - (if git diff --name-only --diff-filter=M | grep '\..pp$'; then echo $'\n Some files are not properly formatted. You can use "./scripts/clang-format-all.sh".\n'; git diff --diff-filter=M; false; fi) + +bionic-test: + <<: *test_deb_definition + variables: + DEB_DIR: deb_bionic + +xenial-test: + <<: *test_deb_definition image: vladyslavusenko/b_image_xenial:latest + variables: + DEB_DIR: deb_xenial - +# evaluate on EuRoC sequences eval_euroc: - stage: test + stage: eval parallel: 10 - tags: - - dataset-eval + tags: [docker, dataset-eval] variables: GIT_STRATEGY: none only: @@ -91,13 +181,14 @@ eval_euroc: - cd scripts/eval_full - ./run_evaluations.sh +# aggregate results for all EuRoC sequences gen_results_euroc: - stage: test_results + stage: eval_results variables: GIT_STRATEGY: none - when: on_success tags: - docker + when: on_success only: - master artifacts: @@ -109,11 +200,15 @@ gen_results_euroc: - cat euroc_results.txt - mv euroc_results.txt ../../ - +# deploy deb packages deploy: stage: deploy + variables: + GIT_STRATEGY: none tags: - docker + only: + - master before_script: - eval $(ssh-agent -s) - echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add - > /dev/null @@ -121,10 +216,6 @@ deploy: - chmod 700 ~/.ssh - echo "$SSH_KNOWN_HOSTS" > ~/.ssh/known_hosts - chmod 644 ~/.ssh/known_hosts - variables: - GIT_STRATEGY: none - only: - - master script: - scp $SCP_FLAGS deb_xenial/*.deb $REPOSITORY_URL/xenial/ - scp $SCP_FLAGS deb_bionic/*.deb $REPOSITORY_URL/bionic/ diff --git a/CMakeLists.txt b/CMakeLists.txt index 8fe3c7c..209d4fe 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,9 +1,14 @@ -cmake_minimum_required(VERSION 3.8) +cmake_minimum_required(VERSION 3.10) + +include("thirdparty/basalt-headers/cmake_modules/PreProjectWorkarounds.cmake") + project(basalt) set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake_modules/" ${CMAKE_MODULE_PATH}) -set(EIGEN_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/basalt-headers/thirdparty/eigen") +if(NOT EIGEN_ROOT) + set(EIGEN_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/basalt-headers/thirdparty/eigen") +endif() string(TOLOWER "${PROJECT_NAME}" PROJECT_NAME_LOWERCASE) find_program(DPKG_PROGRAM dpkg DOC "dpkg program of Debian-based systems") @@ -11,89 +16,163 @@ if(DPKG_PROGRAM) execute_process( COMMAND ${DPKG_PROGRAM} --print-architecture OUTPUT_VARIABLE CPACK_DEBIAN_PACKAGE_ARCHITECTURE - OUTPUT_STRIP_TRAILING_WHITESPACE - ) + OUTPUT_STRIP_TRAILING_WHITESPACE) endif(DPKG_PROGRAM) find_program(LSB_RELEASE_PROGRAM lsb_release DOC "lsb_release program of Debian-based systems") if(LSB_RELEASE_PROGRAM) -execute_process(COMMAND ${LSB_RELEASE_PROGRAM} -rs + execute_process(COMMAND ${LSB_RELEASE_PROGRAM} -rs OUTPUT_VARIABLE LSB_RELEASE_ID_SHORT - OUTPUT_STRIP_TRAILING_WHITESPACE -) + OUTPUT_STRIP_TRAILING_WHITESPACE) -if(${LSB_RELEASE_ID_SHORT} EQUAL "18.04") + if(${LSB_RELEASE_ID_SHORT} EQUAL "18.04") set(DEBIAN_DEPENDS "libtbb2, liblz4-1, libbz2-1.0, libboost-filesystem1.65.1, libboost-date-time1.65.1, libboost-program-options1.65.1, libboost-regex1.65.1, libopencv-dev, libglew2.0, libjpeg8, libpng16-16") -elseif(${LSB_RELEASE_ID_SHORT} EQUAL "16.04") + + elseif(${LSB_RELEASE_ID_SHORT} EQUAL "16.04") set(DEBIAN_DEPENDS "libtbb2, liblz4-1, libbz2-1.0, libboost-filesystem1.58.0, libboost-date-time1.58.0, libboost-program-options1.58.0, libboost-regex1.58.0, libopencv-dev, libglew1.13, libjpeg8, libpng12-0") -endif(${LSB_RELEASE_ID_SHORT} EQUAL "18.04") + endif() endif(LSB_RELEASE_PROGRAM) string(TIMESTAMP PROJECT_VERSION_REVISION "%Y%m%d%H%M") -SET(CPACK_GENERATOR "DEB") -SET(CPACK_DEBIAN_PACKAGE_MAINTAINER "Vladyslav Usenko ") -SET(CPACK_PACKAGE_VERSION_MAJOR "0") -SET(CPACK_PACKAGE_VERSION_MINOR "1") -SET(CPACK_PACKAGE_VERSION_PATCH "0-${PROJECT_VERSION_REVISION}~${LSB_RELEASE_ID_SHORT}") -SET(CPACK_DEBIAN_PACKAGE_DEPENDS ${DEBIAN_DEPENDS}) -SET(CPACK_PACKAGE_FILE_NAME "${PROJECT_NAME_LOWERCASE}_${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}_${CPACK_DEBIAN_PACKAGE_ARCHITECTURE}") -SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE") +set(CPACK_GENERATOR "DEB") +set(CPACK_DEBIAN_PACKAGE_MAINTAINER "Vladyslav Usenko ") +set(CPACK_PACKAGE_VERSION_MAJOR "0") +set(CPACK_PACKAGE_VERSION_MINOR "1") +set(CPACK_PACKAGE_VERSION_PATCH "0-${PROJECT_VERSION_REVISION}~${LSB_RELEASE_ID_SHORT}") +set(CPACK_DEBIAN_PACKAGE_DEPENDS ${DEBIAN_DEPENDS}) +set(CPACK_PACKAGE_FILE_NAME "${PROJECT_NAME_LOWERCASE}_${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}_${CPACK_DEBIAN_PACKAGE_ARCHITECTURE}") +set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE") include(CPack) # Configure CCache if available -find_program(CCACHE_PROGRAM ccache) -if(CCACHE_PROGRAM) - message(STATUS "Found ccache: ${CCACHE_PROGRAM}") - set(CMAKE_C_COMPILER_LAUNCHER ${CCACHE_PROGRAM}) - set(CMAKE_CXX_COMPILER_LAUNCHER ${CCACHE_PROGRAM}) -endif(CCACHE_PROGRAM) +if (NOT CMAKE_C_COMPILER_LAUNCHER AND NOT CMAKE_CXX_COMPILER_LAUNCHER) + find_program(CCACHE_PROGRAM ccache) + if(CCACHE_PROGRAM) + message(STATUS "Found ccache: ${CCACHE_PROGRAM}") + set(CMAKE_C_COMPILER_LAUNCHER ${CCACHE_PROGRAM}) + set(CMAKE_CXX_COMPILER_LAUNCHER ${CCACHE_PROGRAM}) + else() + message(STATUS "Dind't find ccache") + endif() +else() + message(STATUS "Compiler launcher already set. Not configuring ccache.") + message(STATUS "CMAKE_C_COMPILER_LAUNCHER: ${CMAKE_C_COMPILER_LAUNCHER}") + message(STATUS "CMAKE_CXX_COMPILER_LAUNCHER: ${CMAKE_CXX_COMPILER_LAUNCHER}") +endif() -IF( NOT CMAKE_BUILD_TYPE ) - SET( CMAKE_BUILD_TYPE Release) -ENDIF() +if( NOT CMAKE_BUILD_TYPE ) + set( CMAKE_BUILD_TYPE Release) +endif() + +if(NOT CXX_MARCH) + set(CXX_MARCH native) +endif() -IF(NOT CXX_MARCH) - SET(CXX_MARCH native) -ENDIF() set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_EXTENSIONS OFF) set(CMAKE_POSITION_INDEPENDENT_CODE ON) + # Flags used for CHECK_CXX_SOURCE_COMPILES -set(CMAKE_REQUIRED_FLAGS "-Wno-unused-variable -Wno-unused-value") +set(CMAKE_REQUIRED_FLAGS "-Wno-error") -IF("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") - SET(CMAKE_CXX_FLAGS_DEBUG "-O0 -g") - SET(CMAKE_CXX_FLAGS_RELEASE "-O3 -ftree-vectorize -march=${CXX_MARCH}") - SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O3 -g -ftree-vectorize -march=${CXX_MARCH}") - SET(CMAKE_CXX_FLAGS "-Wall -Werror -Wextra -Wno-deprecated-register -Qunused-arguments -fcolor-diagnostics -fopenmp") -ELSEIF("${CMAKE_CXX_COMPILER_ID}" STREQUAL "AppleClang") - SET(CMAKE_CXX_FLAGS_DEBUG "-O0 -g") - SET(CMAKE_CXX_FLAGS_RELEASE "-O3 -ftree-vectorize -march=${CXX_MARCH}") - SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O3 -g -ftree-vectorize -march=${CXX_MARCH}") - SET(CMAKE_CXX_FLAGS "-Wall -Wextra -Wno-deprecated-register -Wno-deprecated-declarations -Wno-sign-compare -Wno-exceptions -Wno-missing-field-initializers -Wno-unused-parameter -Wno-unused-private-field -Qunused-arguments -fcolor-diagnostics -nostdinc++") - include_directories(/usr/local/opt/llvm/include/c++/v1) - link_directories(/usr/local/opt/llvm/lib) - SET(STD_CXX_FS c++fs) -ELSEIF("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") - SET(CMAKE_CXX_FLAGS_DEBUG "-O0 -g") - SET(CMAKE_CXX_FLAGS_RELEASE "-O3 -ftree-vectorize -march=${CXX_MARCH}") - SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O3 -g -ftree-vectorize -march=${CXX_MARCH}") - SET(CMAKE_CXX_FLAGS "-Wall -Werror -Wextra -std=c++11 -Wno-misleading-indentation -Wno-sign-compare -Wno-maybe-uninitialized -Wno-int-in-bool-context -Wno-implicit-fallthrough -Wno-unused-parameter -Wno-deprecated-declarations -ftemplate-backtrace-limit=0 -fopenmp") - SET(STD_CXX_FS stdc++fs) -ENDIF() +# save flags passed by user +set(BASALT_PASSED_CXX_FLAGS "${CMAKE_CXX_FLAGS}") + +set(CMAKE_CXX_FLAGS_DEBUG "-O0 -g -DEIGEN_INITIALIZE_MATRICES_BY_NAN") # cmake default: "-g" +set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O3 -g -DEIGEN_INITIALIZE_MATRICES_BY_NAN") # cmake default: "-O2 -g -DNDEBUG" +set(CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG") # cmake default: "-O3 -DNDEBUG" + +# base set of compile flags +set(BASALT_CXX_FLAGS "-Wall -Wextra -Werror -Wno-unused-parameter -ftemplate-backtrace-limit=0") + +# clang-specific compile flags +if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang") + set(BASALT_CXX_FLAGS "${BASALT_CXX_FLAGS} -Wno-exceptions -fcolor-diagnostics") +endif() + + +# Set platform / compiler specific compile flags and checks +if(APPLE) + # Need to investigate how to reliably detect and use OpenMP on macOS... + set(USE_OPENMP_DEFAULT Off) + + # Among others, setting CMAKE_FIND_FRAMEWORK to LAST fixed issues + # with installed Mono that contains old headers (libpng, ...). + # See: https://github.com/openMVG/openMVG/issues/1349#issuecomment-401492811 + set(CMAKE_FIND_FRAMEWORK LAST) + + # use brewed llvm's libc++ + add_compile_options("-nostdinc++") + include_directories("/usr/local/opt/llvm/include/c++/v1") + link_directories("/usr/local/opt/llvm/lib") + set(STD_CXX_FS c++fs) + + if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang") + message(STATUS "Detected macOS with non-Apple clang") + + elseif(CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang") + message(STATUS "Detected macOS with Apple clang") + # Apple clang on macOS < 10.14 Mojave is too old + if(CMAKE_SYSTEM_VERSION VERSION_LESS 18.0.0) + message(WARNING "Detected Darwin version ${CMAKE_SYSTEM_VERSION}, which is earlier than macos 10.14 Mojave. Apple clang is too old and not supported. Use clang from homebrew.") + endif() + + else() + message(WARNING "Detected macOS with unsupported compiler ${CMAKE_CXX_COMPILER_ID}") + endif() + +elseif(UNIX) + set(USE_OPENMP_DEFAULT On) + + # assume libstdc++ + set(STD_CXX_FS stdc++fs) + + if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang") + set(LINUX_CLANG 1) + message(STATUS "Detected Linux with clang.") + message(WARNING "Clang on Linux is currently not fully supported. You'll likely need to get a recent version of TBB.") + + elseif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") + message(STATUS "Detected Linux with gcc.") + + else() + message(WARNING "Detected Linux with unsupported compiler ${CMAKE_CXX_COMPILER_ID}") + endif() + +else() + message(WARNING "Only Linux and macOS are currently supported") +endif() + + +# OpenMP option and compile flags +option(USE_OPENMP "Use OpenMP (e.g. for parallel computation in Eigen)" ${USE_OPENMP_DEFAULT}) +if(USE_OPENMP) + message(STATUS "OpenMP Enabled") + set(BASALT_CXX_FLAGS "${BASALT_CXX_FLAGS} -fopenmp") +else() + message(STATUS "OpenMP Disabled") +endif() + + +# setup combined compiler flags +set(CMAKE_CXX_FLAGS "${BASALT_CXX_FLAGS} -march=${CXX_MARCH} ${BASALT_PASSED_CXX_FLAGS}") + set(EIGEN_INCLUDE_DIR_HINTS ${EIGEN_ROOT}) find_package(Eigen3 3.3.7 REQUIRED) include_directories(${EIGEN3_INCLUDE_DIR}) message(STATUS "Found Eigen headers in: ${EIGEN3_INCLUDE_DIR}") +if(NOT EIGEN3_INCLUDE_DIR MATCHES "^${EIGEN_ROOT}") + message(WARNING "Found Eigen headers are outside of specified EIGEN_ROOT '${EIGEN_ROOT}'") +endif() find_package(TBB REQUIRED) include_directories(${TBB_INCLUDE_DIR}) @@ -103,26 +182,9 @@ include_directories(${OpenCV_INCLUDE_DIR}) message(STATUS "Found OpenCV headers in: ${OpenCV_INCLUDE_DIR}") message(STATUS "Found OpenCV_LIBS: ${OpenCV_LIBS}") -add_subdirectory(thirdparty/ros) -add_subdirectory(thirdparty/apriltag) -add_subdirectory(thirdparty/DBoW3) +add_subdirectory(thirdparty) -set(BUILD_SHARED_LIBS OFF CACHE BOOL "Enable BUILD_SHARED_LIBS") -set(BUILD_TESTS OFF CACHE BOOL "Enable BUILD_TESTS") - -set(BUILD_PANGOLIN_LIBOPENEXR OFF CACHE BOOL "Enable BUILD_PANGOLIN_LIBOPENEXR") -set(BUILD_PANGOLIN_PYTHON OFF CACHE BOOL "Enable BUILD_PANGOLIN_PYTHON") -set(BUILD_EXAMPLES OFF CACHE BOOL "Enable BUILD_EXAMPLES") -add_subdirectory(thirdparty/opengv EXCLUDE_FROM_ALL) - -# Hack to disable CPack in Pangolin. -macro(include) - if(NOT ${ARGV0} STREQUAL "CPack") - _include(${ARGN}) - endif() -endmacro() -add_subdirectory(thirdparty/Pangolin EXCLUDE_FROM_ALL) include_directories(thirdparty/basalt-headers/thirdparty/Sophus) include_directories(thirdparty/basalt-headers/thirdparty/cereal/include) @@ -135,76 +197,71 @@ include_directories(include) add_library(basalt SHARED - src/io/dataset_io.cpp - src/io/marg_data_io.cpp - src/calibration/cam_calib.cpp - src/calibration/cam_imu_calib.cpp - src/calibration/calibraiton_helper.cpp - src/calibration/vignette.cpp - src/utils/vio_config.cpp - src/optical_flow/optical_flow.cpp - src/vi_estimator/keypoint_vio.cpp - src/vi_estimator/keypoint_vio_linearize.cpp - src/vi_estimator/vio_estimator.cpp - src/vi_estimator/ba_base.cpp - src/vi_estimator/nfr_mapper.cpp - src/utils/keypoints.cpp) + src/io/dataset_io.cpp + src/io/marg_data_io.cpp + src/calibration/cam_calib.cpp + src/calibration/cam_imu_calib.cpp + src/calibration/calibraiton_helper.cpp + src/calibration/vignette.cpp + src/utils/vio_config.cpp + src/optical_flow/optical_flow.cpp + src/vi_estimator/keypoint_vio.cpp + src/vi_estimator/keypoint_vio_linearize.cpp + src/vi_estimator/vio_estimator.cpp + src/vi_estimator/ba_base.cpp + src/vi_estimator/nfr_mapper.cpp + src/utils/keypoints.cpp) -target_link_libraries(basalt rosbag pangolin apriltag ${OPENGV_LIBS} ${TBB_LIBRARIES} ${OpenCV_LIBS} opengv ${STD_CXX_FS} DBoW3) +target_link_libraries(basalt PUBLIC ${TBB_LIBRARIES} ${STD_CXX_FS} ${OpenCV_LIBS} pangolin PRIVATE rosbag apriltag opengv DBoW3) add_executable(basalt_calibrate src/calibrate.cpp) -target_link_libraries(basalt_calibrate ${Pangolin_LIBRARIES} apriltag ${OPENGV_LIBS} ${TBB_LIBRARIES} ${rosbag_LIBRARIES} basalt) +target_link_libraries(basalt_calibrate basalt) add_executable(basalt_calibrate_imu src/calibrate_imu.cpp) -target_link_libraries(basalt_calibrate_imu ${Pangolin_LIBRARIES} apriltag ${OPENGV_LIBS} ${TBB_LIBRARIES} ${rosbag_LIBRARIES} basalt) +target_link_libraries(basalt_calibrate_imu basalt) -add_executable(basalt_vio_sim src/vio_sim.cpp ) -target_link_libraries(basalt_vio_sim ${Pangolin_LIBRARIES} opengv ${STD_CXX_FS} ${TBB_LIBRARIES} basalt) +add_executable(basalt_vio_sim src/vio_sim.cpp) +target_link_libraries(basalt_vio_sim basalt) -add_executable(basalt_mapper_sim src/mapper_sim.cpp ) -target_link_libraries(basalt_mapper_sim ${Pangolin_LIBRARIES} opengv ${TBB_LIBRARIES} basalt) +add_executable(basalt_mapper_sim src/mapper_sim.cpp) +target_link_libraries(basalt_mapper_sim basalt) add_executable(basalt_mapper_sim_naive src/mapper_sim_naive.cpp) -target_link_libraries(basalt_mapper_sim_naive ${Pangolin_LIBRARIES} opengv ${TBB_LIBRARIES} basalt) +target_link_libraries(basalt_mapper_sim_naive basalt) add_executable(basalt_mapper src/mapper.cpp) -target_link_libraries(basalt_mapper ${Pangolin_LIBRARIES} opengv ${STD_CXX_FS} ${TBB_LIBRARIES} basalt) +target_link_libraries(basalt_mapper basalt) add_executable(basalt_opt_flow src/opt_flow.cpp) -target_link_libraries(basalt_opt_flow ${Pangolin_LIBRARIES} opengv ${STD_CXX_FS} basalt) +target_link_libraries(basalt_opt_flow basalt) add_executable(basalt_vio src/vio.cpp) -target_link_libraries(basalt_vio ${Pangolin_LIBRARIES} opengv ${STD_CXX_FS} basalt) - +target_link_libraries(basalt_vio basalt) install(TARGETS basalt_calibrate basalt_calibrate_imu basalt_vio_sim basalt_mapper_sim basalt_mapper_sim_naive basalt_mapper basalt_opt_flow basalt_vio basalt - EXPORT BasaltTargets - RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin - LIBRARY DESTINATION ${CMAKE_INSTALL_PREFIX}/lib - ARCHIVE DESTINATION ${CMAKE_INSTALL_PREFIX}/lib -) + EXPORT BasaltTargets + RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin + LIBRARY DESTINATION ${CMAKE_INSTALL_PREFIX}/lib + ARCHIVE DESTINATION ${CMAKE_INSTALL_PREFIX}/lib) file(GLOB CONFIG_FILES "${CMAKE_CURRENT_SOURCE_DIR}/data/*.json") -INSTALL(FILES ${CONFIG_FILES} ${CMAKE_CURRENT_SOURCE_DIR}/data/basalt-data/orbvoc.dbow3 - DESTINATION ${CMAKE_INSTALL_PREFIX}/etc/basalt -) +install(FILES ${CONFIG_FILES} ${CMAKE_CURRENT_SOURCE_DIR}/data/basalt-data/orbvoc.dbow3 + DESTINATION ${CMAKE_INSTALL_PREFIX}/etc/basalt) # Replace install() to do-nothing macro. macro(install) endmacro() # Include subproject (or any other CMake code) with "disabled" install(). +enable_testing() add_subdirectory(thirdparty/basalt-headers/test) add_subdirectory(test) # Restore original install() behavior. macro(install) - _install(${ARGN}) + _install(${ARGN}) endmacro() - - - diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 26d576a..b7fe4a4 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -1,31 +1,28 @@ -cmake_minimum_required(VERSION 3.2) - -find_package(TBB REQUIRED) -include_directories(${TBB_INCLUDE_DIR}) - -set(GTEST_MAIN_LIBRARY gtest_main) -set(GTEST_LIBRARY gtest) +cmake_minimum_required(VERSION 3.10) +# Note: add_subdirectory(googletest ...) is called in basalt-headers include_directories(../thirdparty/basalt-headers/test/include) add_executable(test_image src/test_image.cpp) -target_link_libraries(test_image ${GTEST_LIBRARY} ${GTEST_MAIN_LIBRARY} ${OpenCV_LIBS} basalt) +target_link_libraries(test_image gtest gtest_main basalt) add_executable(test_spline_opt src/test_spline_opt.cpp) -target_link_libraries(test_spline_opt ${GTEST_LIBRARY} ${GTEST_MAIN_LIBRARY} ${TBB_LIBRARIES} opengv basalt) +target_link_libraries(test_spline_opt gtest gtest_main basalt) add_executable(test_vio src/test_vio.cpp) -target_link_libraries(test_vio ${GTEST_LIBRARY} ${GTEST_MAIN_LIBRARY} ${TBB_LIBRARIES} opengv basalt) +target_link_libraries(test_vio gtest gtest_main basalt) add_executable(test_nfr src/test_nfr.cpp) -target_link_libraries(test_nfr ${GTEST_LIBRARY} ${GTEST_MAIN_LIBRARY} ${TBB_LIBRARIES} opengv basalt) +target_link_libraries(test_nfr gtest gtest_main basalt) enable_testing() -add_test(test_image test_image COMMAND Test) -add_test(test_spline_opt test_spline_opt COMMAND Test) -add_test(test_vio test_vio COMMAND Test) -add_test(test_nfr test_nfr COMMAND Test) +include(GoogleTest) + +gtest_discover_tests(test_image DISCOVERY_TIMEOUT 30) +gtest_discover_tests(test_spline_opt DISCOVERY_TIMEOUT 30) +gtest_discover_tests(test_vio DISCOVERY_TIMEOUT 30) +gtest_discover_tests(test_nfr DISCOVERY_TIMEOUT 30) diff --git a/thirdparty/CMakeLists.txt b/thirdparty/CMakeLists.txt new file mode 100644 index 0000000..f796651 --- /dev/null +++ b/thirdparty/CMakeLists.txt @@ -0,0 +1,106 @@ +cmake_minimum_required(VERSION 3.10) + +add_subdirectory(ros EXCLUDE_FROM_ALL) +add_subdirectory(apriltag EXCLUDE_FROM_ALL) +add_subdirectory(DBoW3 EXCLUDE_FROM_ALL) + + +set(BUILD_SHARED_LIBS OFF CACHE BOOL "Enable BUILD_SHARED_LIBS") +set(BUILD_TESTS OFF CACHE BOOL "Enable BUILD_TESTS") +set(BUILD_TOOLS OFF CACHE BOOL "Enable BUILD_TOOLS") +set(CMAKE_EXPORT_NO_PACKAGE_REGISTRY ON) + +set(BUILD_PANGOLIN_LIBOPENEXR OFF CACHE BOOL "Enable BUILD_PANGOLIN_LIBOPENEXR") +set(BUILD_PANGOLIN_PYTHON OFF CACHE BOOL "Enable BUILD_PANGOLIN_PYTHON") +set(BUILD_EXAMPLES OFF CACHE BOOL "Enable BUILD_EXAMPLES") + +set(EIGEN_INCLUDE_DIR "${EIGEN3_INCLUDE_DIR}") +set(EIGEN_INCLUDE_DIRS "${EIGEN3_INCLUDE_DIR}") + +add_subdirectory(opengv EXCLUDE_FROM_ALL) + +# Hack to disable CPack in Pangolin. +macro(include) + if(NOT ${ARGV0} STREQUAL "CPack") + _include(${ARGN}) + endif() +endmacro() +add_subdirectory(Pangolin EXCLUDE_FROM_ALL) + + +# fix aprilgrid +target_compile_options(apriltag PRIVATE "-Wno-unused-private-field") + +# fix opengv: c++17 and debug postfix +set_target_properties(opengv PROPERTIES + CXX_STANDARD 17 + DEBUG_POSTFIX "") + +# fix opengv: compile options (CMAKE_CXX_FLAGS is overwritten by Opengv) +target_compile_options(opengv PRIVATE + -Wno-unused-private-field + -march=${CXX_MARCH} + ${BASALT_PASSED_CXX_FLAGS}) + +# TODO: enable once mpark issue is fixed upstream pangolin +#set_target_properties(pangolin PROPERTIES +# CXX_STANDARD 17) + +# fix pangolin: gcc +if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") + target_compile_options(pangolin PRIVATE "-Wno-implicit-fallthrough") +endif() + +# fix pangolin: macOS +if(APPLE) + target_compile_options(pangolin PRIVATE "-Wno-objc-missing-super-calls") +endif() + +# fix pangolin: macOS >= 10.14 Mojave +if(APPLE AND CMAKE_SYSTEM_VERSION VERSION_GREATER_EQUAL 18.0.0) + target_compile_options(pangolin PRIVATE "-Wno-deprecated-declarations") +endif() + +# fix pangolin: clang +if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang") + target_compile_options(pangolin PRIVATE "-Wno-null-pointer-arithmetic") +endif() + +# fix pangolin: clang >= 8.0 +if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 8.0.0) + target_compile_options(pangolin PRIVATE "-Wno-defaulted-function-deleted") +endif() + +# check here the directories for the pangolin and opengv targets, and +# confirm that the eigen-related include dirs match. +foreach(_target opengv pangolin) + get_target_property(_include_dirs ${_target} INTERFACE_INCLUDE_DIRECTORIES) + foreach(_dir IN LISTS _include_dirs) + if("${_dir}" MATCHES ".*/eigen3?(/unsupported)?$") + if(NOT _dir MATCHES "^${EIGEN3_INCLUDE_DIR}.*") + endif() + endif() + endforeach() +endforeach() + +# opengv and pangolin assume that eigen is found outside the source +# directory and thus include it in INTERFACE_INCLUDE_DIRECTORIES, +# which makes cmake complain that that property contains paths in the +# source folder. Thus, we update the property to only include these +# eigen paths in the "BUILD_INTERFACE" (not "INSTALL"). +if (EIGEN3_INCLUDE_DIR MATCHES "^${CMAKE_SOURCE_DIR}.*") + foreach(_target opengv pangolin) + get_target_property(_include_dirs ${_target} INTERFACE_INCLUDE_DIRECTORIES) + set(_include_dirs_new "") + foreach(_dir IN LISTS _include_dirs) + if(_dir MATCHES ".*/eigen(/unsupported)?$") + string(REGEX REPLACE "(^${CMAKE_SOURCE_DIR}.*$)" "$" _dir "${_dir}") + endif() + list(APPEND _include_dirs_new "${_dir}") + endforeach() + set_target_properties(${_target} PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${_include_dirs_new}") + endforeach() +endif() + + + From 6c4fa75430b0607ae28bd9af33615849e64e7937 Mon Sep 17 00:00:00 2001 From: Nikolaus Demmel Date: Wed, 24 Apr 2019 15:49:41 +0200 Subject: [PATCH 07/10] test: increase gtest discover timeouts --- test/CMakeLists.txt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index b7fe4a4..052b543 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -22,7 +22,7 @@ enable_testing() include(GoogleTest) -gtest_discover_tests(test_image DISCOVERY_TIMEOUT 30) -gtest_discover_tests(test_spline_opt DISCOVERY_TIMEOUT 30) -gtest_discover_tests(test_vio DISCOVERY_TIMEOUT 30) -gtest_discover_tests(test_nfr DISCOVERY_TIMEOUT 30) +gtest_discover_tests(test_image DISCOVERY_TIMEOUT 60) +gtest_discover_tests(test_spline_opt DISCOVERY_TIMEOUT 60) +gtest_discover_tests(test_vio DISCOVERY_TIMEOUT 60) +gtest_discover_tests(test_nfr DISCOVERY_TIMEOUT 60) From a53f3126d5754b58492d0124e90bf1e21a0db1fe Mon Sep 17 00:00:00 2001 From: Nikolaus Demmel Date: Wed, 24 Apr 2019 16:48:18 +0200 Subject: [PATCH 08/10] Update readme to reflect macOS compatibility --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index ca95e55..8d4d4dc 100644 --- a/README.md +++ b/README.md @@ -42,7 +42,7 @@ Update the Ubuntu package index and install Basalt: sudo apt-get update sudo apt-get install basalt ``` -### Source installation for Ubuntu 18.04 and MacOS 10.14 Mojave +### Source installation for Ubuntu 18.04 and MacOS >= 10.11 El Capitan Clone the source code for the project and build it. For MacOS you should have [Homebrew](https://brew.sh/) installed. ``` git clone --recursive https://gitlab.com/VladyslavUsenko/basalt.git From db8655b3d8fd76333652f4d751f9b8ea18b092be Mon Sep 17 00:00:00 2001 From: Nikolaus Demmel Date: Wed, 24 Apr 2019 17:03:39 +0200 Subject: [PATCH 09/10] ci: fix caching --- .gitlab-ci.yml | 13 +++++-------- thirdparty/basalt-headers | 2 +- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index af4dc2c..da223a9 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -25,6 +25,7 @@ stages: cache: paths: - ccache/ + key: ${CACHE_KEY} # template for build & unit test & make deb configurations .compile_test_package_template: &compile_test_package_definition @@ -91,11 +92,10 @@ stages: bionic-release-compile: <<: *prepare_docker_definition <<: *compile_test_package_definition - cache: - key: bionic-release variables: CXX_MARCH: 'corei7-avx' DEB_DIR: deb_bionic + CACHE_KEY: bionic-release artifacts: paths: - deb_bionic/*.deb @@ -106,11 +106,10 @@ xenial-release-compile: <<: *prepare_docker_definition <<: *compile_test_package_definition image: vladyslavusenko/b_image_xenial:latest - cache: - key: xenial-release variables: CXX_MARCH: 'corei7-avx' DEB_DIR: deb_xenial + CACHE_KEY: xenial-release artifacts: paths: - deb_xenial/*.deb @@ -119,18 +118,16 @@ xenial-release-compile: bionic-debug-compile: <<: *prepare_docker_definition <<: *compile_test_package_definition - cache: - key: bionic-debug variables: BUILD_TYPE: Debug + CACHE_KEY: bionic-debug bionic-relwithdebinfo-compile: <<: *prepare_docker_definition <<: *compile_test_package_definition - cache: - key: bionic-relwithdebinfo variables: BUILD_TYPE: RelWithDebInfo + CACHE_KEY: bionic-relwithdebinfo elcapitan-relwithdebinfo-compile: <<: *compile_test_definition diff --git a/thirdparty/basalt-headers b/thirdparty/basalt-headers index 5f9fc49..292ee34 160000 --- a/thirdparty/basalt-headers +++ b/thirdparty/basalt-headers @@ -1 +1 @@ -Subproject commit 5f9fc492564cb81f51f0b71508c037db712ee5d1 +Subproject commit 292ee346506b73f691b96108cafc53d589e8b7b3 From cdd557809253b71883728d055f57382c24508591 Mon Sep 17 00:00:00 2001 From: Nikolaus Demmel Date: Wed, 24 Apr 2019 17:48:13 +0200 Subject: [PATCH 10/10] ci: use base image for clang-format --- .gitlab-ci.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index da223a9..137ff45 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -137,8 +137,6 @@ elcapitan-relwithdebinfo-compile: # check if clang-format would make any changes clang-format: - # TODO: add clang-format version >= 8 to "vladyslavusenko/b_image" - image: nikolausdemmel/ubuntu-dev-dbatk:16.04 tags: - docker stage: build