diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index f23ba7fa..944ac35f 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -46,7 +46,7 @@ clang-format: - clang-format -Werror --dry-run $(find . -regextype posix-extended -regex ".*\.(cpp|hpp|h)") #----- build stage --------------------------------------------------------------------------------- -cpp_api: +cpp_api:gcc: image: ubuntu:22.04 stage: build before_script: @@ -55,6 +55,15 @@ cpp_api: - cmake -Bbuild src/cpp/kiss_icp/ - cmake --build build -j$(nproc --all) +cpp_api:clang: + image: ubuntu:22.04 + stage: build + before_script: + - apt-get update && apt-get install --no-install-recommends -y clang cmake make + script: + - cmake cmake -DCMAKE_CXX_COMPILER=clang++ -Bbuild src/cpp/kiss_icp/ + - cmake --build build -j$(nproc --all) + pip_package: image: python:3.8 stage: build diff --git a/src/cpp/kiss_icp/core/Deskew.cpp b/src/cpp/kiss_icp/core/Deskew.cpp index 424385e0..eb1932db 100644 --- a/src/cpp/kiss_icp/core/Deskew.cpp +++ b/src/cpp/kiss_icp/core/Deskew.cpp @@ -53,7 +53,11 @@ Vector3dVector MotionCompensator::DeSkewScan(const std::vector const Eigen::Isometry3d &start_pose, const Eigen::Isometry3d &finish_pose) { // Estimate linear and angular velocities - const auto [lvel, avel] = VelocityEstimation(start_pose, finish_pose, scan_duration_); + const auto [lv, av] = VelocityEstimation(start_pose, finish_pose, scan_duration_); + + // Compile in clang for macOS: https://stackoverflow.com/questions/46114214 + const auto &linear_velocity = lv; + const auto &angular_velocity = av; // TODO(Nacho) Add explanation of this std::vector timestamps_ = timestamps; @@ -63,8 +67,8 @@ Vector3dVector MotionCompensator::DeSkewScan(const std::vector std::vector corrected_frame(frame.size()); tbb::parallel_for(size_t(0), frame.size(), [&](size_t i) { - const auto &dt = timestamps_[i]; - const auto motion = MakeTransform(dt * lvel, dt * avel); + const auto dt = timestamps_[i]; + const auto motion = MakeTransform(dt * linear_velocity, dt * angular_velocity); corrected_frame[i] = motion * frame[i]; }); return corrected_frame; diff --git a/src/cpp/kiss_icp/core/VoxelHashMap.cpp b/src/cpp/kiss_icp/core/VoxelHashMap.cpp index 1d52b682..9bf557fe 100644 --- a/src/cpp/kiss_icp/core/VoxelHashMap.cpp +++ b/src/cpp/kiss_icp/core/VoxelHashMap.cpp @@ -134,8 +134,9 @@ VoxelHashMap::Vector3dVectorTuple VoxelHashMap::GetCorrespondences( // 1st lambda: Paralell computation [&](const tbb::blocked_range &r, ResultTuple res) -> ResultTuple { auto &[src, tgt] = res; - auto &source_private = src; // compile on clang - auto &target_private = tgt; // compile on clang + // Compile in clang for macOS: https://stackoverflow.com/questions/46114214 + auto &source_private = src; + auto &target_private = tgt; source_private.reserve(r.size()); target_private.reserve(r.size()); std::for_each(r.begin(), r.end(), [&](const auto &point) { @@ -150,12 +151,13 @@ VoxelHashMap::Vector3dVectorTuple VoxelHashMap::GetCorrespondences( // 2st lambda: Parallell reduction [&](ResultTuple a, const ResultTuple &b) -> ResultTuple { auto &[src, tgt] = a; - auto &source = src; // compile on clang - auto &target = tgt; // compile on clang const auto &[srcp, tgtp] = b; - auto &source_private = srcp; // compile on clang - auto &target_private = tgtp; // compile on clang - source.insert(source.end(), // + // Compile in clang for macOS: https://stackoverflow.com/questions/46114214 + auto &source = src; + auto &target = tgt; + auto &source_private = srcp; + auto &target_private = tgtp; + source.insert(source.end(), // std::make_move_iterator(source_private.begin()), std::make_move_iterator(source_private.end())); target.insert(target.end(), //