From bada4771a1b2bb024f6229cd0793ef5f83ce93eb Mon Sep 17 00:00:00 2001 From: Tim Sylvester Date: Thu, 9 Jan 2025 10:09:22 -0800 Subject: [PATCH] Qt and Node build issues --- include/mbgl/mtl/uniform_buffer.hpp | 2 +- platform/node/CMakeLists.txt | 3 +++ platform/node/src/node_map.cpp | 4 ++-- platform/node/src/node_map.hpp | 3 ++- platform/node/src/node_request.cpp | 6 ++++-- platform/node/src/node_request.hpp | 4 ++-- platform/qt/src/utils/scheduler.cpp | 6 +++++- platform/qt/src/utils/scheduler.hpp | 4 +++- 8 files changed, 22 insertions(+), 10 deletions(-) diff --git a/include/mbgl/mtl/uniform_buffer.hpp b/include/mbgl/mtl/uniform_buffer.hpp index 9dfbdb1a8ab..9352bfedc47 100644 --- a/include/mbgl/mtl/uniform_buffer.hpp +++ b/include/mbgl/mtl/uniform_buffer.hpp @@ -43,7 +43,7 @@ class UniformBufferArray final : public gfx::UniformBufferArray { } void bind(RenderPass& renderPass) const noexcept; - void unbind(RenderPass& renderPass) const noexcept {}; + void unbind(RenderPass&) const noexcept {} private: gfx::UniqueUniformBuffer copy(const gfx::UniformBuffer& buffer) override { diff --git a/platform/node/CMakeLists.txt b/platform/node/CMakeLists.txt index c7eedf18702..4626784688b 100644 --- a/platform/node/CMakeLists.txt +++ b/platform/node/CMakeLists.txt @@ -37,6 +37,7 @@ target_include_directories( ${PROJECT_SOURCE_DIR}/include ${PROJECT_SOURCE_DIR}/platform/default/include ${PROJECT_SOURCE_DIR}/src + ${PROJECT_SOURCE_DIR}/vendor/nontype_functional/include PRIVATE ${LIBUV_INCLUDE_DIRS} ) @@ -44,6 +45,7 @@ target_link_libraries( mbgl-node-loop PUBLIC Mapbox::Base + INTERFACE mbgl-vendor-nontype_functional ) target_sources( @@ -68,6 +70,7 @@ target_link_libraries( mbgl-node INTERFACE mbgl-node-loop INTERFACE Mapbox::Map + INTERFACE mbgl-vendor-nontype_functional ) # FIXME: Node bindings only run fully on Linux now because it requires libuv RunLoop (which is the default on Linux). Also, Sanitizer will diff --git a/platform/node/src/node_map.cpp b/platform/node/src/node_map.cpp index b67ed90a19d..91cbc75dc41 100644 --- a/platform/node/src/node_map.cpp +++ b/platform/node/src/node_map.cpp @@ -1536,8 +1536,8 @@ NodeMap::~NodeMap() { } } -std::unique_ptr NodeFileSource::request(const mbgl::Resource& resource, - mbgl::FileSource::Callback callback_) { +std::unique_ptr NodeFileSource::request( + const mbgl::Resource& resource, mbgl::FileSource::CopyableCallback callback_) { assert(nodeMap); Nan::HandleScope scope; diff --git a/platform/node/src/node_map.hpp b/platform/node/src/node_map.hpp index 9f170d32750..26a72420925 100644 --- a/platform/node/src/node_map.hpp +++ b/platform/node/src/node_map.hpp @@ -103,7 +103,8 @@ struct NodeFileSource : public mbgl::FileSource { NodeFileSource(NodeMap* nodeMap_) : nodeMap(nodeMap_) {} ~NodeFileSource() override = default; - std::unique_ptr request(const mbgl::Resource&, mbgl::FileSource::Callback) final; + std::unique_ptr request(const mbgl::Resource&, + mbgl::FileSource::CopyableCallback) final; bool canRequest(const mbgl::Resource&) const override; void setResourceOptions(mbgl::ResourceOptions) override; mbgl::ResourceOptions getResourceOptions() override; diff --git a/platform/node/src/node_request.cpp b/platform/node/src/node_request.cpp index 916c7edc2ed..e7bfe165bef 100644 --- a/platform/node/src/node_request.cpp +++ b/platform/node/src/node_request.cpp @@ -7,7 +7,8 @@ namespace node_mbgl { -NodeRequest::NodeRequest(mbgl::FileSource::Callback callback_, NodeAsyncRequest* asyncRequest_) +NodeRequest::NodeRequest(mbgl::FileSource::CopyableCallback callback_, + NodeAsyncRequest* asyncRequest_) : callback(std::move(callback_)), asyncRequest(asyncRequest_) { asyncRequest->request = this; @@ -42,7 +43,8 @@ void NodeRequest::Init(v8::Local target) { void NodeRequest::New(const Nan::FunctionCallbackInfo& info) { auto target = reinterpret_cast(info[0].As()->Value()); - auto callback = reinterpret_cast(info[1].As()->Value()); + auto callback = reinterpret_cast*>( + info[1].As()->Value()); auto asyncRequest = reinterpret_cast(info[2].As()->Value()); auto request = new NodeRequest(*callback, asyncRequest); diff --git a/platform/node/src/node_request.hpp b/platform/node/src/node_request.hpp index fa8f8752e0d..d744855b43b 100644 --- a/platform/node/src/node_request.hpp +++ b/platform/node/src/node_request.hpp @@ -22,7 +22,7 @@ struct NodeAsyncRequest : public mbgl::AsyncRequest { class NodeRequest : public Nan::ObjectWrap { public: - NodeRequest(mbgl::FileSource::Callback, NodeAsyncRequest*); + NodeRequest(mbgl::FileSource::CopyableCallback, NodeAsyncRequest*); ~NodeRequest() override; static Nan::Persistent constructor; @@ -34,7 +34,7 @@ class NodeRequest : public Nan::ObjectWrap { void unrefRequest(); - mbgl::FileSource::Callback callback; + mbgl::FileSource::CopyableCallback callback; NodeAsyncRequest* asyncRequest; Nan::AsyncResource* asyncResource = new Nan::AsyncResource("mbgl:execute"); }; diff --git a/platform/qt/src/utils/scheduler.cpp b/platform/qt/src/utils/scheduler.cpp index 7ab5364c562..a457d438363 100644 --- a/platform/qt/src/utils/scheduler.cpp +++ b/platform/qt/src/utils/scheduler.cpp @@ -13,7 +13,11 @@ Scheduler::~Scheduler() { MBGL_VERIFY_THREAD(tid); } -void Scheduler::schedule(std::function&& function) { +void Scheduler::schedule(Task&& function) { + this->Scheduler::schedule(mbgl::util::SimpleIdentity::Empty, std::move(function)); +} + +void Scheduler::schedule(mbgl::util::SimpleIdentity, Task&& function) { const std::lock_guard lock(m_taskQueueMutex); m_taskQueue.push(std::move(function)); diff --git a/platform/qt/src/utils/scheduler.hpp b/platform/qt/src/utils/scheduler.hpp index 99b26b7b757..d9f5c6dce7d 100644 --- a/platform/qt/src/utils/scheduler.hpp +++ b/platform/qt/src/utils/scheduler.hpp @@ -1,6 +1,7 @@ #pragma once #include +#include #include #include @@ -20,7 +21,8 @@ class Scheduler : public QObject, public mbgl::Scheduler { ~Scheduler() override; // mbgl::Scheduler implementation. - void schedule(std::function&& function) final; + void schedule(Task&&) final; + void schedule(mbgl::util::SimpleIdentity, Task&&) final; void waitForEmpty(const mbgl::util::SimpleIdentity tag = mbgl::util::SimpleIdentity::Empty) override;