Merge pull request #295 from mapbox/linux-stylesheet-gyp

Linux stylesheet gyp
This commit is contained in:
Konstantin Käfer
2014-06-02 13:35:51 +02:00
4 changed files with 47 additions and 23 deletions

View File

@@ -53,7 +53,7 @@ linux: config.gypi linux/llmr-app.gyp node
# Executes the Linux binary
run-linux: linux
build/$(BUILDTYPE)/mapbox-gl
(cd build/$(BUILDTYPE) && ./mapbox-gl)

View File

@@ -190,32 +190,27 @@ void curl_perform(uv_poll_t *req, int /*status*/, int events) {
}
int handle_socket(CURL * /*easy*/, curl_socket_t s, int action, void * /*userp*/, void *socketp) {
curl_context *context;
if (action == CURL_POLL_IN || action == CURL_POLL_OUT) {
if (socketp) {
context = (curl_context *)socketp;
} else {
context = create_curl_context(s);
}
curl_multi_assign(curl_multi, s, (void *)context);
curl_context *context = nullptr;
if (socketp) {
context = (curl_context *)socketp;
} else if (action != CURL_POLL_REMOVE) {
context = create_curl_context(s);
}
switch (action) {
case CURL_POLL_IN:
uv_poll_start(&context->poll_handle, UV_READABLE, curl_perform);
break;
case CURL_POLL_OUT:
uv_poll_start(&context->poll_handle, UV_WRITABLE, curl_perform);
break;
case CURL_POLL_REMOVE:
if (socketp) {
uv_poll_stop(&((curl_context *)socketp)->poll_handle);
destroy_curl_context((curl_context *)socketp);
if (context) {
curl_multi_assign(curl_multi, s, (void *)context);
if (action == CURL_POLL_IN || action == CURL_POLL_INOUT) {
uv_poll_start(&context->poll_handle, UV_READABLE, curl_perform);
}
if (action == CURL_POLL_OUT || action == CURL_POLL_INOUT) {
uv_poll_start(&context->poll_handle, UV_WRITABLE, curl_perform);
}
if (action == CURL_POLL_REMOVE && socketp) {
uv_poll_stop(&context->poll_handle);
destroy_curl_context(context);
curl_multi_assign(curl_multi, s, NULL);
}
break;
default:
abort();
}
return 0;

View File

@@ -51,7 +51,22 @@
],
'dependencies': [
'../llmr.gyp:llmr-x86',
'default_stylesheet',
],
},
{
'target_name': 'default_stylesheet',
'type': 'none',
'hard_dependency': 1,
'dependencies': [
'../llmr.gyp:build_stylesheet'
],
'copies': [
{
'files': [ '<(SHARED_INTERMEDIATE_DIR)/bin/style.min.js' ],
'destination': '<(PRODUCT_DIR)'
}
]
}
],
}

View File

@@ -3,6 +3,8 @@
#include <signal.h>
#include <getopt.h>
#include <fstream>
#include <sstream>
#include "../common/settings_json.hpp"
#include "../common/glfw_view.hpp"
@@ -40,6 +42,15 @@ int main(int argc, char *argv[]) {
sigIntHandler.sa_flags = 0;
sigaction(SIGINT, &sigIntHandler, NULL);
// read default stylesheet from disk
std::ifstream stylefile("./style.min.js");
if (!stylefile.good()) {
fprintf(stderr, "Cannot read style file\n");
return 1;
}
std::stringstream stylejson;
stylejson << stylefile.rdbuf();
view = new GLFWView();
llmr::Map map(*view);
@@ -49,6 +60,9 @@ int main(int argc, char *argv[]) {
map.setAngle(settings.angle);
map.setDebug(settings.debug);
// Load style
map.setStyleJSON(stylejson.str());
int ret = view->run();
// Save settings