fixes for linux
This commit is contained in:
committed by
Konstantin Käfer
parent
bf629c97db
commit
92a7f73bbe
@@ -53,6 +53,7 @@ before_install:
|
||||
- if [[ ${TRAVIS_OS_NAME} == "linux" ]]; then sudo service postgresql stop; fi
|
||||
- source ./scripts/local_mason.sh
|
||||
- source ./scripts/travis_helper.sh
|
||||
- source ./scripts/install_node.sh
|
||||
- source ./scripts/flags.sh
|
||||
- ./scripts/travis_before_install.sh
|
||||
- if [[ ${TRAVIS_OS_NAME} == "linux" && ${MASON_PLATFORM} != "android" ]]; then export LD_LIBRARY_PATH=`mason prefix mesa 10.4.3`/lib; fi
|
||||
|
||||
2
Makefile
2
Makefile
@@ -105,8 +105,6 @@ android:
|
||||
|
||||
test: build/test/Makefile
|
||||
$(MAKE) -C build/test BUILDTYPE=$(BUILDTYPE) V=$(V) test
|
||||
./scripts/run_tests.sh
|
||||
|
||||
|
||||
test-%: build/test/Makefile
|
||||
$(MAKE) -C build/test BUILDTYPE=$(BUILDTYPE) V=$(V) test
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
#define GL_GLEXT_PROTOTYPES
|
||||
#include <mbgl/platform/default/glx.h>
|
||||
#define MBGL_USE_GLX 1
|
||||
#undef Status
|
||||
#endif
|
||||
|
||||
#include <mbgl/map/view.hpp>
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
#include <mbgl/util/noncopyable.hpp>
|
||||
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
|
||||
namespace mbgl {
|
||||
|
||||
|
||||
@@ -4,7 +4,8 @@
|
||||
#include <mbgl/platform/default/settings_json.hpp>
|
||||
#include <mbgl/platform/default/glfw_view.hpp>
|
||||
#include <mbgl/platform/default/log_stderr.hpp>
|
||||
#include <mbgl/storage/caching_http_file_source.hpp>
|
||||
#include <mbgl/storage/default/default_file_source.hpp>
|
||||
#include <mbgl/storage/default/sqlite_cache.hpp>
|
||||
|
||||
#include <signal.h>
|
||||
#include <getopt.h>
|
||||
@@ -64,7 +65,9 @@ int main(int argc, char *argv[]) {
|
||||
sigaction(SIGINT, &sigIntHandler, NULL);
|
||||
|
||||
view = new GLFWView();
|
||||
mbgl::CachingHTTPFileSource fileSource();
|
||||
|
||||
mbgl::SQLiteCache cache("/tmp/mbgl-cache.db");
|
||||
mbgl::DefaultFileSource fileSource(&cache);
|
||||
mbgl::Map map(*view, fileSource);
|
||||
|
||||
// Load settings
|
||||
@@ -78,12 +81,13 @@ int main(int argc, char *argv[]) {
|
||||
if (token == nullptr) {
|
||||
mbgl::Log::Warning(mbgl::Event::Setup, "no access token set. mapbox.com tiles won't work.");
|
||||
} else {
|
||||
fileSource.setAccessToken(std::string(token));
|
||||
map.setAccessToken(std::string(token));
|
||||
}
|
||||
|
||||
// Load style
|
||||
if (style.empty())
|
||||
if (style.empty()) {
|
||||
style = std::string("asset://") + std::string("styles/bright-v7.json");
|
||||
}
|
||||
|
||||
map.setStyleURL(style);
|
||||
|
||||
|
||||
@@ -111,7 +111,11 @@ void AssetRequestImpl::fileStated(uv_fs_t *req) {
|
||||
uv_fs_close(req->loop, req, self->fd, fileClosed);
|
||||
} else {
|
||||
self->response = util::make_unique<Response>();
|
||||
#ifdef __APPLE__
|
||||
self->response->modified = stat->st_mtimespec.tv_sec;
|
||||
#else
|
||||
self->response->modified = stat->st_mtime;
|
||||
#endif
|
||||
self->response->etag = std::to_string(stat->st_ino);
|
||||
const auto size = (unsigned int)(stat->st_size);
|
||||
self->response->data.resize(size);
|
||||
@@ -185,8 +189,8 @@ void AssetRequestImpl::cleanup(uv_fs_t *req) {
|
||||
|
||||
// -------------------------------------------------------------------------------------------------
|
||||
|
||||
AssetRequest::AssetRequest(DefaultFileSource *source, const Resource &resource)
|
||||
: SharedRequestBase(source, resource) {
|
||||
AssetRequest::AssetRequest(DefaultFileSource *source_, const Resource &resource_)
|
||||
: SharedRequestBase(source_, resource_) {
|
||||
assert(algo::starts_with(resource.url, "asset://"));
|
||||
}
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#include <queue>
|
||||
#include <map>
|
||||
#include <cassert>
|
||||
|
||||
#include <cstring>
|
||||
|
||||
void handleError(CURLMcode code) {
|
||||
if (code != CURLM_OK) {
|
||||
@@ -599,8 +599,8 @@ void HTTPRequestImpl::handleResult(CURLcode code) {
|
||||
|
||||
// -------------------------------------------------------------------------------------------------
|
||||
|
||||
HTTPRequest::HTTPRequest(DefaultFileSource *source, const Resource &resource)
|
||||
: SharedRequestBase(source, resource) {
|
||||
HTTPRequest::HTTPRequest(DefaultFileSource *source_, const Resource &resource_)
|
||||
: SharedRequestBase(source_, resource_) {
|
||||
}
|
||||
|
||||
HTTPRequest::~HTTPRequest() {
|
||||
|
||||
4
scripts/install_node.sh
Executable file
4
scripts/install_node.sh
Executable file
@@ -0,0 +1,4 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
mason install node 0.10.35
|
||||
export PATH="`mason prefix node 0.10.35`/bin":"$PATH"
|
||||
@@ -16,6 +16,9 @@ if [[ ${TRAVIS_OS_NAME} == "linux" ]]; then
|
||||
sysctl kernel.core_pattern
|
||||
fi
|
||||
|
||||
# install test server dependencies
|
||||
(cd test; npm install express@4.11)
|
||||
|
||||
RESULT=0
|
||||
${CMD} "$@" || RESULT=$?
|
||||
|
||||
|
||||
@@ -96,28 +96,28 @@ SharedRequestBase *DefaultFileSource::find(const Resource &resource) {
|
||||
}
|
||||
|
||||
Request *DefaultFileSource::request(const Resource &resource, uv_loop_t *l, Callback callback) {
|
||||
auto request = new Request(resource, l, std::move(callback));
|
||||
auto req = new Request(resource, l, std::move(callback));
|
||||
|
||||
// This function can be called from any thread. Make sure we're executing the actual call in the
|
||||
// file source loop by sending it over the queue. It will be processed in processAction().
|
||||
queue->send(AddRequestAction{ request });
|
||||
return request;
|
||||
queue->send(AddRequestAction{ req });
|
||||
return req;
|
||||
}
|
||||
|
||||
void DefaultFileSource::request(const Resource &resource, Callback callback) {
|
||||
auto request = new Request(resource, nullptr, std::move(callback));
|
||||
auto req = new Request(resource, nullptr, std::move(callback));
|
||||
|
||||
// This function can be called from any thread. Make sure we're executing the actual call in the
|
||||
// file source loop by sending it over the queue. It will be processed in processAction().
|
||||
queue->send(AddRequestAction{ request });
|
||||
queue->send(AddRequestAction{ req });
|
||||
}
|
||||
|
||||
void DefaultFileSource::cancel(Request *request) {
|
||||
request->cancel();
|
||||
void DefaultFileSource::cancel(Request *req) {
|
||||
req->cancel();
|
||||
|
||||
// This function can be called from any thread. Make sure we're executing the actual call in the
|
||||
// file source loop by sending it over the queue. It will be processed in processAction().
|
||||
queue->send(RemoveRequestAction{ request });
|
||||
queue->send(RemoveRequestAction{ req });
|
||||
}
|
||||
|
||||
void DefaultFileSource::process(AddRequestAction &action) {
|
||||
|
||||
@@ -49,6 +49,7 @@
|
||||
'<@(glfw3_static_libs)',
|
||||
'<@(sqlite3_static_libs)',
|
||||
'<@(zlib_static_libs)',
|
||||
'<@(curl_static_libs)',
|
||||
],
|
||||
'variables': {
|
||||
'cxxflags': [
|
||||
@@ -60,16 +61,22 @@
|
||||
'<@(glfw3_ldflags)',
|
||||
'<@(sqlite3_ldflags)',
|
||||
'<@(zlib_ldflags)',
|
||||
'<@(curl_ldflags)',
|
||||
],
|
||||
},
|
||||
'xcode_settings': {
|
||||
'OTHER_CFLAGS': [ '<@(cxxflags)' ],
|
||||
'OTHER_CPLUSPLUSFLAGS': [ '<@(cxxflags)' ],
|
||||
'OTHER_LDFLAGS': [ '<@(ldflags)' ],
|
||||
},
|
||||
'cflags': [ '<@(cxxflags)' ],
|
||||
'cxxflags': [ '<@(cxxflags)' ],
|
||||
'ldflags': [ '<@(ldflags)' ],
|
||||
'conditions': [
|
||||
['OS == "mac"', {
|
||||
'xcode_settings': {
|
||||
'OTHER_CFLAGS': [ '<@(cxxflags)' ],
|
||||
'OTHER_CPLUSPLUSFLAGS': [ '<@(cxxflags)' ],
|
||||
'OTHER_LDFLAGS': [ '<@(ldflags)' ],
|
||||
},
|
||||
}, {
|
||||
'cflags': [ '<@(cxxflags)' ],
|
||||
'cxxflags': [ '<@(cxxflags)' ],
|
||||
'libraries': [ '<@(ldflags)' ],
|
||||
}],
|
||||
],
|
||||
},
|
||||
]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user