refactor makefile
This commit is contained in:
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user