Skip to content

Commit

Permalink
Qt and Node build issues
Browse files Browse the repository at this point in the history
  • Loading branch information
TimSylvester committed Jan 9, 2025
1 parent a4d5ede commit bada477
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 10 deletions.
2 changes: 1 addition & 1 deletion include/mbgl/mtl/uniform_buffer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
3 changes: 3 additions & 0 deletions platform/node/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,15 @@ 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}
)

target_link_libraries(
mbgl-node-loop
PUBLIC
Mapbox::Base
INTERFACE mbgl-vendor-nontype_functional
)

target_sources(
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions platform/node/src/node_map.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1536,8 +1536,8 @@ NodeMap::~NodeMap() {
}
}

std::unique_ptr<mbgl::AsyncRequest> NodeFileSource::request(const mbgl::Resource& resource,
mbgl::FileSource::Callback callback_) {
std::unique_ptr<mbgl::AsyncRequest> NodeFileSource::request(
const mbgl::Resource& resource, mbgl::FileSource::CopyableCallback<void(mbgl::Response)> callback_) {
assert(nodeMap);

Nan::HandleScope scope;
Expand Down
3 changes: 2 additions & 1 deletion platform/node/src/node_map.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,8 @@ struct NodeFileSource : public mbgl::FileSource {
NodeFileSource(NodeMap* nodeMap_)
: nodeMap(nodeMap_) {}
~NodeFileSource() override = default;
std::unique_ptr<mbgl::AsyncRequest> request(const mbgl::Resource&, mbgl::FileSource::Callback) final;
std::unique_ptr<mbgl::AsyncRequest> request(const mbgl::Resource&,
mbgl::FileSource::CopyableCallback<void(mbgl::Response)>) final;
bool canRequest(const mbgl::Resource&) const override;
void setResourceOptions(mbgl::ResourceOptions) override;
mbgl::ResourceOptions getResourceOptions() override;
Expand Down
6 changes: 4 additions & 2 deletions platform/node/src/node_request.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@

namespace node_mbgl {

NodeRequest::NodeRequest(mbgl::FileSource::Callback callback_, NodeAsyncRequest* asyncRequest_)
NodeRequest::NodeRequest(mbgl::FileSource::CopyableCallback<void(mbgl::Response)> callback_,
NodeAsyncRequest* asyncRequest_)
: callback(std::move(callback_)),
asyncRequest(asyncRequest_) {
asyncRequest->request = this;
Expand Down Expand Up @@ -42,7 +43,8 @@ void NodeRequest::Init(v8::Local<v8::Object> target) {

void NodeRequest::New(const Nan::FunctionCallbackInfo<v8::Value>& info) {
auto target = reinterpret_cast<NodeMap*>(info[0].As<v8::External>()->Value());
auto callback = reinterpret_cast<mbgl::FileSource::Callback*>(info[1].As<v8::External>()->Value());
auto callback = reinterpret_cast<mbgl::FileSource::CopyableCallback<void(mbgl::Response)>*>(
info[1].As<v8::External>()->Value());
auto asyncRequest = reinterpret_cast<NodeAsyncRequest*>(info[2].As<v8::External>()->Value());

auto request = new NodeRequest(*callback, asyncRequest);
Expand Down
4 changes: 2 additions & 2 deletions platform/node/src/node_request.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ struct NodeAsyncRequest : public mbgl::AsyncRequest {

class NodeRequest : public Nan::ObjectWrap {
public:
NodeRequest(mbgl::FileSource::Callback, NodeAsyncRequest*);
NodeRequest(mbgl::FileSource::CopyableCallback<void(mbgl::Response)>, NodeAsyncRequest*);
~NodeRequest() override;

static Nan::Persistent<v8::Function> constructor;
Expand All @@ -34,7 +34,7 @@ class NodeRequest : public Nan::ObjectWrap {

void unrefRequest();

mbgl::FileSource::Callback callback;
mbgl::FileSource::CopyableCallback<void(mbgl::Response)> callback;
NodeAsyncRequest* asyncRequest;
Nan::AsyncResource* asyncResource = new Nan::AsyncResource("mbgl:execute");
};
Expand Down
6 changes: 5 additions & 1 deletion platform/qt/src/utils/scheduler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@ Scheduler::~Scheduler() {
MBGL_VERIFY_THREAD(tid);
}

void Scheduler::schedule(std::function<void()>&& 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<std::mutex> lock(m_taskQueueMutex);
m_taskQueue.push(std::move(function));

Expand Down
4 changes: 3 additions & 1 deletion platform/qt/src/utils/scheduler.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#pragma once

#include <mbgl/actor/scheduler.hpp>
#include <mbgl/util/identity.hpp>
#include <mbgl/util/util.hpp>

#include <QObject>
Expand All @@ -20,7 +21,8 @@ class Scheduler : public QObject, public mbgl::Scheduler {
~Scheduler() override;

// mbgl::Scheduler implementation.
void schedule(std::function<void()>&& 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;

Expand Down

0 comments on commit bada477

Please sign in to comment.