Skip to content

Commit

Permalink
[Fix] fix clang build (#677)
Browse files Browse the repository at this point in the history
* fix clang build

* fix ndk build

* fix ndk build

* switch to `std::filesystem` for clang-7 and later
  • Loading branch information
lzhangzz authored Jun 29, 2022
1 parent e49e8a1 commit 8f1508e
Show file tree
Hide file tree
Showing 22 changed files with 23 additions and 15 deletions.
2 changes: 1 addition & 1 deletion csrc/mmdeploy/codebase/mmocr/contour_expand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#include <vector>

#include "mmdeploy/core/tensor.h"
#include "opencv2/opencv.hpp"
#include "opencv2/imgproc/imgproc.hpp"

namespace mmdeploy::mmocr {

Expand Down
1 change: 0 additions & 1 deletion csrc/mmdeploy/codebase/mmocr/cpu/dbnet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
#include "mmdeploy/codebase/mmocr/dbnet.h"

#include "mmdeploy/core/utils/device_utils.h"
#include "opencv2/imgcodecs.hpp"
#include "opencv2/imgproc.hpp"

namespace mmdeploy::mmocr {
Expand Down
1 change: 0 additions & 1 deletion csrc/mmdeploy/codebase/mmocr/cuda/dbnet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
#include "mmdeploy/codebase/mmocr/cuda/utils.h"
#include "mmdeploy/core/utils/device_utils.h"
#include "mmdeploy/device/cuda/cuda_device.h"
#include "opencv2/imgcodecs.hpp"
#include "opencv2/imgproc.hpp"

namespace mmdeploy::mmocr {
Expand Down
2 changes: 1 addition & 1 deletion csrc/mmdeploy/codebase/mmocr/panet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
#include "mmdeploy/codebase/mmocr/panet.h"

#include <algorithm>
#include <opencv2/opencv.hpp>

#include "mmdeploy/codebase/mmocr/mmocr.h"
#include "mmdeploy/core/device.h"
#include "mmdeploy/core/registry.h"
#include "mmdeploy/core/serialization.h"
#include "mmdeploy/core/utils/device_utils.h"
#include "opencv2/imgproc/imgproc.hpp"

namespace mmdeploy {

Expand Down
2 changes: 1 addition & 1 deletion csrc/mmdeploy/codebase/mmocr/pixel_group.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#include <vector>

#include "mmdeploy/core/tensor.h"
#include "opencv2/opencv.hpp"
#include "opencv2/imgproc/imgproc.hpp"

namespace mmdeploy::mmocr {

Expand Down
2 changes: 1 addition & 1 deletion csrc/mmdeploy/codebase/mmocr/psenet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
#include "mmdeploy/codebase/mmocr/psenet.h"

#include <algorithm>
#include <opencv2/opencv.hpp>

#include "mmdeploy/codebase/mmocr/mmocr.h"
#include "mmdeploy/core/device.h"
#include "mmdeploy/core/registry.h"
#include "mmdeploy/core/serialization.h"
#include "mmdeploy/core/utils/device_utils.h"
#include "opencv2/imgproc/imgproc.hpp"

namespace mmdeploy {
namespace mmocr {
Expand Down
5 changes: 3 additions & 2 deletions csrc/mmdeploy/codebase/mmocr/warp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include "mmdeploy/core/utils/formatter.h"
#include "mmdeploy/core/value.h"
#include "mmdeploy/experimental/module_adapter.h"
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv_utils.h"

namespace mmdeploy {
Expand Down Expand Up @@ -40,9 +41,9 @@ class WarpBoxes {
auto w = static_cast<float>(std::max(e0, e1));
auto h = static_cast<float>(std::min(e0, e1));
std::vector<cv::Point2f> dst{{0, 0}, {w, 0}, {w, h}, {0, h}};
auto m = getAffineTransform(src.data(), dst.data());
auto m = cv::getAffineTransform(src.data(), dst.data());
cv::Mat warped;
warpAffine(img, warped, m, {static_cast<int>(w), static_cast<int>(h)});
cv::warpAffine(img, warped, m, {static_cast<int>(w), static_cast<int>(h)});
return warped;
}

Expand Down
1 change: 0 additions & 1 deletion csrc/mmdeploy/codebase/mmpose/keypoints_from_heatmap.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Copyright (c) OpenMMLab. All rights reserved.

#include <cctype>
#include <opencv2/imgcodecs.hpp>
#include <opencv2/imgproc.hpp>

#include "mmdeploy/core/device.h"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// Copyright (c) OpenMMLab. All rights reserved.

#include <opencv2/imgcodecs.hpp>
#include <opencv2/imgproc.hpp>

#include "mmdeploy/core/device.h"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// Copyright (c) OpenMMLab. All rights reserved.

#include <opencv2/imgcodecs.hpp>
#include <opencv2/imgproc.hpp>

#include "mmdeploy/core/device.h"
Expand Down
3 changes: 1 addition & 2 deletions csrc/mmdeploy/core/utils/filesystem.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
#ifndef MMDEPLOY_CSRC_CORE_UTILS_FILESYSTEM_H_
#define MMDEPLOY_CSRC_CORE_UTILS_FILESYSTEM_H_

// TODO: what about clang?
#if __GNUC__ >= 8 || _MSC_VER
#if __GNUC__ >= 8 || _MSC_VER || __clang_major__ >= 7
#include <filesystem>
namespace fs = std::filesystem;
#else
Expand Down
2 changes: 1 addition & 1 deletion csrc/mmdeploy/execution/schedulers/schedulers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Scheduler CreateFromContext(std::unique_ptr<Context> context) {
using EraseType = _type_erased::TypeErasedSchedulerImpl<SchedType, Value>;
auto sched = new EraseType(context->GetScheduler());
return Scheduler{std::shared_ptr<Scheduler::Impl>(
sched, [context = std::move(context)](EraseType* p) { delete p; })};
sched, [context = std::shared_ptr<Context>(std::move(context))](EraseType* p) { delete p; })};
}

} // namespace
Expand Down
1 change: 1 addition & 0 deletions csrc/mmdeploy/utils/opencv/opencv_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

#include "mmdeploy/core/logger.h"
#include "mmdeploy/core/utils/formatter.h"
#include "opencv2/imgproc/imgproc.hpp"

namespace mmdeploy {
namespace cpu {
Expand Down
2 changes: 1 addition & 1 deletion csrc/mmdeploy/utils/opencv/opencv_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#include "mmdeploy/core/mpl/type_traits.h"
#include "mmdeploy/core/serialization.h"
#include "mmdeploy/core/tensor.h"
#include "opencv2/opencv.hpp"
#include "opencv2/core/core.hpp"

namespace mmdeploy {
namespace cpu {
Expand Down
1 change: 1 addition & 0 deletions tests/test_csrc/preprocess/test_compose.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include "mmdeploy/core/mat.h"
#include "mmdeploy/core/registry.h"
#include "mmdeploy/core/utils/formatter.h"
#include "opencv2/imgcodecs/imgcodecs.hpp"
#include "opencv_utils.h"
#include "test_resource.h"
#include "test_utils.h"
Expand Down
1 change: 1 addition & 0 deletions tests/test_csrc/preprocess/test_crop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include "mmdeploy/core/mat.h"
#include "mmdeploy/core/utils/device_utils.h"
#include "mmdeploy/preprocess/transform/transform.h"
#include "opencv2/imgcodecs/imgcodecs.hpp"
#include "opencv_utils.h"
#include "test_resource.h"
#include "test_utils.h"
Expand Down
1 change: 1 addition & 0 deletions tests/test_csrc/preprocess/test_default_format_bundle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include "mmdeploy/core/tensor.h"
#include "mmdeploy/core/utils/device_utils.h"
#include "mmdeploy/preprocess/transform/transform.h"
#include "opencv2/imgcodecs/imgcodecs.hpp"
#include "opencv_utils.h"
#include "test_resource.h"
#include "test_utils.h"
Expand Down
1 change: 1 addition & 0 deletions tests/test_csrc/preprocess/test_image2tensor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include "mmdeploy/core/tensor.h"
#include "mmdeploy/core/utils/device_utils.h"
#include "mmdeploy/preprocess/transform/transform.h"
#include "opencv2/imgcodecs/imgcodecs.hpp"
#include "opencv_utils.h"
#include "test_resource.h"
#include "test_utils.h"
Expand Down
2 changes: 2 additions & 0 deletions tests/test_csrc/preprocess/test_load.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
#include "mmdeploy/core/tensor.h"
#include "mmdeploy/core/utils/device_utils.h"
#include "mmdeploy/preprocess/transform/transform.h"
#include "opencv2/imgcodecs/imgcodecs.hpp"
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv_utils.h"
#include "test_resource.h"
#include "test_utils.h"
Expand Down
2 changes: 2 additions & 0 deletions tests/test_csrc/preprocess/test_normalize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
#include "mmdeploy/core/mat.h"
#include "mmdeploy/core/utils/device_utils.h"
#include "mmdeploy/preprocess/transform/transform.h"
#include "opencv2/imgcodecs/imgcodecs.hpp"
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv_utils.h"
#include "test_resource.h"
#include "test_utils.h"
Expand Down
2 changes: 2 additions & 0 deletions tests/test_csrc/preprocess/test_pad.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
#include "mmdeploy/core/mat.h"
#include "mmdeploy/core/utils/device_utils.h"
#include "mmdeploy/preprocess/transform/transform.h"
#include "opencv2/imgcodecs/imgcodecs.hpp"
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv_utils.h"
#include "test_resource.h"
#include "test_utils.h"
Expand Down
2 changes: 2 additions & 0 deletions tests/test_csrc/preprocess/test_resize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
#include "mmdeploy/core/mat.h"
#include "mmdeploy/core/utils/device_utils.h"
#include "mmdeploy/preprocess/transform/transform.h"
#include "opencv2/imgcodecs/imgcodecs.hpp"
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv_utils.h"
#include "test_resource.h"
#include "test_utils.h"
Expand Down

0 comments on commit 8f1508e

Please sign in to comment.