1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
|
#define CATCH_CONFIG_RUNNER
#include "catch.hpp"
#include <string>
#include <mapnik/mapnik.hpp>
#include <mapnik/filesystem.hpp>
#include <mapnik/util/fs.hpp>
#include <mapnik/datasource_cache.hpp>
#include "cleanup.hpp" // run_cleanup()
int main(int argc, char** argv)
{
Catch::Session session;
std::string plugin_path;
std::string working_dir;
auto cli =
session.cli() | Catch::clara::Opt(plugin_path, "plugins")["-p"]["--plugins"]("path to mapnik plugins") |
Catch::clara::Opt(working_dir, "working directory")["-C"]["--working-directory"]("change working directory");
session.cli(cli);
int result = session.applyCommandLine(argc, argv);
mapnik::setup();
if (!plugin_path.empty())
{
if (!mapnik::util::exists(plugin_path))
{
std::clog << "Could not find " << plugin_path << "\n";
return -1;
}
mapnik::datasource_cache::instance().register_datasources(plugin_path);
}
else
{
mapnik::datasource_cache::instance().register_datasources("plugins/input/");
}
if (!working_dir.empty())
{
if (!mapnik::util::exists(working_dir))
{
std::clog << "Could not find " << working_dir << "\n";
return -1;
}
mapnik::fs::current_path(working_dir);
}
if (result == 0)
{
result = session.run();
}
testing::run_cleanup();
return result;
}
|