summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorKonstantin Käfer <mail@kkaefer.com>2015-01-29 18:30:46 +0100
committerKonstantin Käfer <mail@kkaefer.com>2015-02-04 10:49:09 +0100
commit29baacf3a5bb773d94d08d16b81c3cda45a44eb6 (patch)
tree1dc3ca456151138ee5e8b7cf88b3afcecc3df1db /bin
parent3d51e116a84ee168975bcee8377e9156f77e2731 (diff)
downloadqtlocation-mapboxgl-29baacf3a5bb773d94d08d16b81c3cda45a44eb6.tar.gz
refactor makefile
Diffstat (limited to 'bin')
-rw-r--r--bin/render.cpp19
-rw-r--r--bin/render.gyp63
2 files changed, 44 insertions, 38 deletions
diff --git a/bin/render.cpp b/bin/render.cpp
index ba17498c88..827f247d6c 100644
--- a/bin/render.cpp
+++ b/bin/render.cpp
@@ -9,7 +9,8 @@
#include <mbgl/platform/default/headless_view.hpp>
#include <mbgl/platform/default/headless_display.hpp>
-#include <mbgl/storage/caching_http_file_source.hpp>
+#include <mbgl/storage/default_file_source.hpp>
+#include <mbgl/storage/default/sqlite_cache.hpp>
#if __APPLE__
#include <mbgl/platform/darwin/log_nslog.hpp>
@@ -35,7 +36,7 @@ int main(int argc, char *argv[]) {
int height = 256;
double pixelRatio = 1.0;
std::string output = "out.png";
- std::string cache = "cache.sqlite";
+ std::string cache_file = "cache.sqlite";
std::vector<std::string> classes;
std::string token;
@@ -51,7 +52,7 @@ int main(int argc, char *argv[]) {
("class,c", po::value(&classes)->value_name("name"), "Class name")
("token,t", po::value(&token)->value_name("key")->default_value(token), "Mapbox access token")
("output,o", po::value(&output)->value_name("file")->default_value(output), "Output file name")
- ("cache,d", po::value(&cache)->value_name("file")->default_value(cache), "Cache database file name")
+ ("cache,d", po::value(&cache_file)->value_name("file")->default_value(cache_file), "Cache database file name")
;
try {
@@ -74,7 +75,8 @@ int main(int argc, char *argv[]) {
Log::Set<StderrLogBackend>();
#endif
- CachingHTTPFileSource fileSource(cache);
+ mbgl::SQLiteCache cache(cache_file);
+ mbgl::DefaultFileSource fileSource(&cache);
// Try to load the token from the environment.
if (!token.size()) {
@@ -84,14 +86,15 @@ int main(int argc, char *argv[]) {
}
}
- // Set access token if present
- if (token.size()) {
- fileSource.setAccessToken(std::string(token));
- }
HeadlessView view;
Map map(view, fileSource);
+ // Set access token if present
+ if (token.size()) {
+ map.setAccessToken(std::string(token));
+ }
+
map.setStyleJSON(style, ".");
map.setClasses(classes);
diff --git a/bin/render.gyp b/bin/render.gyp
index 71b36fba5e..4529cd12ab 100644
--- a/bin/render.gyp
+++ b/bin/render.gyp
@@ -3,51 +3,54 @@
'../gyp/common.gypi',
],
'targets': [
- {
- 'target_name': 'mbgl-render',
+ { 'target_name': 'mbgl-render',
'product_name': 'mbgl-render',
'type': 'executable',
+
+ 'dependencies': [
+ '../mbgl.gyp:core',
+ '../mbgl.gyp:platform-<(platform_lib)',
+ '../mbgl.gyp:headless-<(headless_lib)',
+ '../mbgl.gyp:http-<(http_lib)',
+ '../mbgl.gyp:asset-<(asset_lib)',
+ '../mbgl.gyp:cache-<(cache_lib)',
+ '../mbgl.gyp:copy_certificate_bundle',
+ ],
+
+ 'include_dirs': [
+ '../src',
+ ],
+
'sources': [
'./render.cpp',
],
+
'variables' : {
- 'cflags': [
- '<@(uv_cflags)',
- '<@(png_cflags)',
+ 'cflags_cc': [
+ '<@(glfw3_cflags)',
'-I<(boost_root)/include',
],
'ldflags': [
'<@(glfw3_ldflags)',
- '<@(uv_ldflags)',
- '<@(sqlite3_static_libs)',
- '<@(sqlite3_ldflags)',
- '<@(curl_ldflags)',
- '<@(png_ldflags)',
- '<@(uv_static_libs)',
'-L<(boost_root)/lib',
'-lboost_program_options'
],
+ 'libraries': [
+ '<@(glfw3_static_libs)',
+ ],
},
+
'conditions': [
- # add libuv include path and OpenGL libs
- ['OS == "mac"',
- {
- 'xcode_settings': {
- 'OTHER_CPLUSPLUSFLAGS': ['<@(cflags)'],
- 'OTHER_LDFLAGS': ['<@(ldflags)'],
- },
- },
- {
- 'cflags': ['<@(cflags)'],
- 'libraries': ['<@(ldflags)'],
- }],
- ],
- 'include_dirs': [ '../src' ],
- 'dependencies': [
- '../mbgl.gyp:<(core_library)',
- '../mbgl.gyp:<(headless_library)',
- '../mbgl.gyp:<(platform_library)',
- '../mbgl.gyp:copy_certificate_bundle',
+ ['OS == "mac"', {
+ 'libraries': [ '<@(libraries)' ],
+ 'xcode_settings': {
+ 'OTHER_CPLUSPLUSFLAGS': [ '<@(cflags_cc)' ],
+ 'OTHER_LDFLAGS': [ '<@(ldflags)' ],
+ }
+ }, {
+ 'cflags_cc': [ '<@(cflags_cc)' ],
+ 'libraries': [ '<@(libraries)', '<@(ldflags)' ],
+ }]
],
},
],