Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updates to configure pycairo if available #24

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,25 @@

extra_comp_args = subprocess.check_output([mapnik_config, '--cflags']).rstrip('\n').split(' ')

# Test to build with pycairo (has been moved out of mapnik proper)
include_pycairo = False
if "-DHAVE_CAIRO" in extra_comp_args:
# Mapnik was built with Cairo
try:
from cairo import CAPI
include_pycairo = True
except ImportError:
pass

if include_pycairo:
# Get compiler flags for pycairo (PKG_CONFIG_PATH must be correct)
extra_comp_args.append('-DHAVE_PYCAIRO')
lib = "pycairo"
if sys.version_info[0] > 3:
lib = "py3cairo"
args = subprocess.check_output(["pkg-config","--cflags",lib]).rstrip('\n').split(' ')
extra_comp_args += args

if sys.platform == 'darwin':
extra_comp_args.append('-mmacosx-version-min=10.8')
linkflags.append('-mmacosx-version-min=10.8')
Expand Down
3 changes: 2 additions & 1 deletion src/mapnik_python.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#pragma GCC diagnostic ignored "-Wunused-local-typedef"
#pragma GCC diagnostic ignored "-Wmissing-field-initializers"
#include "python_to_value.hpp"
#include <boost/thread/tss.hpp>
#include <boost/python/args.hpp> // for keywords, arg, etc
#include <boost/python/converter/from_python.hpp>
#include <boost/python/def.hpp> // for def
Expand Down Expand Up @@ -190,7 +191,7 @@ using mapnik::python_unblock_auto_block;
#ifdef MAPNIK_DEBUG
bool python_thread::thread_support = true;
#endif
thread_local std::unique_ptr<PyThreadState> python_thread::state;
boost::thread_specific_ptr<PyThreadState> python_thread::state;

struct agg_renderer_visitor_1
{
Expand Down
4 changes: 2 additions & 2 deletions src/mapnik_threads.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#ifndef MAPNIK_THREADS_HPP
#define MAPNIK_THREADS_HPP

#include <thread>
#include <boost/thread/tss.hpp>
#include <Python.h>

namespace mapnik {
Expand Down Expand Up @@ -70,7 +70,7 @@ class python_thread
}

private:
static thread_local std::unique_ptr<PyThreadState> state;
static boost::thread_specific_ptr<PyThreadState> state;
#ifdef MAPNIK_DEBUG
static bool thread_support;
#endif
Expand Down