mapnik/test/unit/run.cpp
Mathis Logemann 42f465f842 refactor datasource plugins
fix merge

remove old DATASOURCE_PLUGIN call

fix memory_datasource

wip

wip

fix temp return

fix install

wip before_unload

linux

remove docker

remove docker

comments

add windows error message if libmapnik=static and plugins=dynamic

fix false plugin macro

plugin default de/constructor to remove UB

simplyfy plugin targets - add fpic

fix makro

simplyfy

use unique_ptr for plugin handle

rename option static plugins

replace local init with fnc call

call setup everywhere

init datasource_static
2022-02-07 15:35:09 +01:00

57 lines
1.4 KiB
C++

#define CATCH_CONFIG_RUNNER
#include "catch.hpp"
#include <string>
#include <mapnik/mapnik.hpp>
#include <mapnik/util/fs.hpp>
#include <mapnik/datasource_cache.hpp>
#include <boost/filesystem/convenience.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;
}
boost::filesystem::current_path(working_dir);
}
if (result == 0)
{
result = session.run();
}
testing::run_cleanup();
return result;
}