From 0128869c2c5ad2619c25ab777bf41f9cb4e5e94d Mon Sep 17 00:00:00 2001 From: Daven Quinn Date: Thu, 4 Jun 2015 02:04:24 -0700 Subject: [PATCH 1/3] Fix thread-local variables to use cross-platform Boost version --- src/mapnik_python.cpp | 3 ++- src/mapnik_threads.hpp | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/mapnik_python.cpp b/src/mapnik_python.cpp index 6880c81f3..adaefd3d3 100644 --- a/src/mapnik_python.cpp +++ b/src/mapnik_python.cpp @@ -29,6 +29,7 @@ #pragma GCC diagnostic ignored "-Wunused-local-typedef" #pragma GCC diagnostic ignored "-Wmissing-field-initializers" #include "python_to_value.hpp" +#include #include // for keywords, arg, etc #include #include // for def @@ -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 python_thread::state; +boost::thread_specific_ptr python_thread::state; struct agg_renderer_visitor_1 { diff --git a/src/mapnik_threads.hpp b/src/mapnik_threads.hpp index 53f972ffc..c18f090fa 100644 --- a/src/mapnik_threads.hpp +++ b/src/mapnik_threads.hpp @@ -22,7 +22,7 @@ #ifndef MAPNIK_THREADS_HPP #define MAPNIK_THREADS_HPP -#include +#include #include namespace mapnik { @@ -70,7 +70,7 @@ class python_thread } private: - static thread_local std::unique_ptr state; + static boost::thread_specific_ptr state; #ifdef MAPNIK_DEBUG static bool thread_support; #endif From 55de6d8d765516423cf8961e4847f5ec0987b82b Mon Sep 17 00:00:00 2001 From: Daven Quinn Date: Thu, 4 Jun 2015 11:53:37 -0700 Subject: [PATCH 2/3] Added test to link pycairo if needed. --- setup.py | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 29804714b..8aa4fce35 100755 --- a/setup.py +++ b/setup.py @@ -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') @@ -215,7 +234,7 @@ 'mapnik', 'mapnik-wkt', 'mapnik-json', - 'boost_thread', + 'boost_thread-mt', 'boost_system', boost_python_lib, ], From e89d25c8672ebdf68e6b07fdc2de94b23b9d74e1 Mon Sep 17 00:00:00 2001 From: Daven Quinn Date: Thu, 4 Jun 2015 12:11:18 -0700 Subject: [PATCH 3/3] Got rid of extra -mt specifier on boost-thread --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 8aa4fce35..c8e1f64ca 100755 --- a/setup.py +++ b/setup.py @@ -234,7 +234,7 @@ 'mapnik', 'mapnik-wkt', 'mapnik-json', - 'boost_thread-mt', + 'boost_thread', 'boost_system', boost_python_lib, ],