Skip to content

Commit

Permalink
perf: add a macro for apple-clang build error
Browse files Browse the repository at this point in the history
  • Loading branch information
MistEO committed Oct 10, 2023
1 parent 59bf6f8 commit d4e532a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
7 changes: 5 additions & 2 deletions source/MaaRpc/implement/Controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -303,9 +303,12 @@ Status ControllerImpl::create_custom(
return Status(NOT_FOUND, "id not exists");
}

// build error on macOS
// auto info = std::make_shared<CustomControllerInfo>(stream, image_impl_);
#if defined(__APPLE__) && defined(__clang__) && __clang_major__ < 16
std::shared_ptr<CustomControllerInfo> info(new CustomControllerInfo{ stream, image_impl_ });
#else
// build error of Apple clang version 15.0.0 (clang-1500.0.40.1) on macOS
auto info = std::make_shared<CustomControllerInfo>(stream, image_impl_);
#endif

auto id = make_uuid();

Expand Down
14 changes: 10 additions & 4 deletions source/MaaRpc/implement/Instance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,12 @@ Status InstanceImpl::register_custom_recognizer(

MAA_GRPC_GET_HANDLE_FROM(this, handle, init().handle)

// build error on macOS
// auto info = std::make_shared<CustomRecognizerInfo>(request->init().name(), stream, image_impl_, syncctx_impl_);
#if defined(__APPLE__) && defined(__clang__) && __clang_major__ < 16
std::shared_ptr<CustomRecognizerInfo> info(new CustomRecognizerInfo{ request->init().name(), stream, image_impl_, syncctx_impl_ });
#else
// build error of Apple clang version 15.0.0 (clang-1500.0.40.1) on macOS
auto info = std::make_shared<CustomRecognizerInfo>(request->init().name(), stream, image_impl_, syncctx_impl_);
#endif

::maarpc::CustomRecognizerResponse response;
stream->Write(response);
Expand Down Expand Up @@ -232,9 +235,12 @@ Status InstanceImpl::register_custom_action(

MAA_GRPC_GET_HANDLE_FROM(this, handle, init().handle)

// build error on macOS
// auto info = std::make_shared<CustomActionInfo>(request->init().name(), stream, syncctx_impl_);
#if defined(__APPLE__) && defined(__clang__) && __clang_major__ < 16
std::shared_ptr<CustomActionInfo> info(new CustomActionInfo{ request->init().name(), stream, syncctx_impl_ });
#else
// build error of Apple clang version 15.0.0 (clang-1500.0.40.1) on macOS
auto info = std::make_shared<CustomActionInfo>(request->init().name(), stream, syncctx_impl_);
#endif

::maarpc::CustomActionResponse response;
stream->Write(response);
Expand Down

0 comments on commit d4e532a

Please sign in to comment.