scons: make libjpeg dependency optional (still required by default)
This commit is contained in:
parent
7d8bdb2f94
commit
9804e7e90d
9 changed files with 51 additions and 9 deletions
|
@ -14,6 +14,8 @@ For a complete change history, see the SVN log.
|
||||||
Mapnik Trunk
|
Mapnik Trunk
|
||||||
------------
|
------------
|
||||||
|
|
||||||
|
- Made libjpeg dependency optional at compile time and added mapnik2.has_jpeg() method to check for support in python (#545).
|
||||||
|
|
||||||
- Fixed reading of PostGIS data on Big Endian systems (#515)
|
- Fixed reading of PostGIS data on Big Endian systems (#515)
|
||||||
|
|
||||||
- PostGIS: Added better support for alterative schemas (#500)
|
- PostGIS: Added better support for alterative schemas (#500)
|
||||||
|
|
|
@ -258,6 +258,7 @@ opts.AddVariables(
|
||||||
('ICU_LIB_NAME', 'The library name for icu (such as icuuc, sicuuc, or icucore)', 'icuuc'),
|
('ICU_LIB_NAME', 'The library name for icu (such as icuuc, sicuuc, or icucore)', 'icuuc'),
|
||||||
PathVariable('PNG_INCLUDES', 'Search path for libpng include files', '/usr/include', PathVariable.PathAccept),
|
PathVariable('PNG_INCLUDES', 'Search path for libpng include files', '/usr/include', PathVariable.PathAccept),
|
||||||
PathVariable('PNG_LIBS','Search path for libpng include files','/usr/' + LIBDIR_SCHEMA, PathVariable.PathAccept),
|
PathVariable('PNG_LIBS','Search path for libpng include files','/usr/' + LIBDIR_SCHEMA, PathVariable.PathAccept),
|
||||||
|
BoolVariable('JPEG', 'Build Mapnik with JPEG read and write support', 'True'),
|
||||||
PathVariable('JPEG_INCLUDES', 'Search path for libjpeg include files', '/usr/include', PathVariable.PathAccept),
|
PathVariable('JPEG_INCLUDES', 'Search path for libjpeg include files', '/usr/include', PathVariable.PathAccept),
|
||||||
PathVariable('JPEG_LIBS', 'Search path for libjpeg library files', '/usr/' + LIBDIR_SCHEMA, PathVariable.PathAccept),
|
PathVariable('JPEG_LIBS', 'Search path for libjpeg library files', '/usr/' + LIBDIR_SCHEMA, PathVariable.PathAccept),
|
||||||
PathVariable('TIFF_INCLUDES', 'Search path for libtiff include files', '/usr/include', PathVariable.PathAccept),
|
PathVariable('TIFF_INCLUDES', 'Search path for libtiff include files', '/usr/include', PathVariable.PathAccept),
|
||||||
|
@ -779,6 +780,7 @@ if not preconfigured:
|
||||||
else:
|
else:
|
||||||
env['SKIPPED_DEPS'].extend(['cairo','cairomm'])
|
env['SKIPPED_DEPS'].extend(['cairo','cairomm'])
|
||||||
|
|
||||||
|
|
||||||
# allow for mac osx /usr/lib/libicucore.dylib compatibility
|
# allow for mac osx /usr/lib/libicucore.dylib compatibility
|
||||||
# requires custom supplied headers since Apple does not include them
|
# requires custom supplied headers since Apple does not include them
|
||||||
# details: http://lists.apple.com/archives/xcode-users/2005/Jun/msg00633.html
|
# details: http://lists.apple.com/archives/xcode-users/2005/Jun/msg00633.html
|
||||||
|
@ -797,11 +799,16 @@ if not preconfigured:
|
||||||
['png', 'png.h', True,'C'],
|
['png', 'png.h', True,'C'],
|
||||||
['tiff', 'tiff.h', True,'C'],
|
['tiff', 'tiff.h', True,'C'],
|
||||||
['z', 'zlib.h', True,'C'],
|
['z', 'zlib.h', True,'C'],
|
||||||
['jpeg', ['stdio.h', 'jpeglib.h'], True,'C'],
|
|
||||||
['proj', 'proj_api.h', True,'C'],
|
['proj', 'proj_api.h', True,'C'],
|
||||||
[env['ICU_LIB_NAME'],'unicode/unistr.h',True,'C++'],
|
[env['ICU_LIB_NAME'],'unicode/unistr.h',True,'C++'],
|
||||||
]
|
]
|
||||||
|
|
||||||
|
if env['JPEG']:
|
||||||
|
env.Append(CXXFLAGS = '-DHAVE_JPEG')
|
||||||
|
LIBSHEADERS.append(['jpeg', ['stdio.h', 'jpeglib.h'], True,'C'])
|
||||||
|
else:
|
||||||
|
env['SKIPPED_DEPS'].extend(['jpeg'])
|
||||||
|
|
||||||
|
|
||||||
# if requested, sort LIBPATH and CPPPATH before running CheckLibWithHeader tests
|
# if requested, sort LIBPATH and CPPPATH before running CheckLibWithHeader tests
|
||||||
if env['PRIORITIZE_LINKING']:
|
if env['PRIORITIZE_LINKING']:
|
||||||
|
|
|
@ -30,13 +30,19 @@ extern "C"
|
||||||
#include <boost/python.hpp>
|
#include <boost/python.hpp>
|
||||||
#include <boost/python/module.hpp>
|
#include <boost/python/module.hpp>
|
||||||
#include <boost/python/def.hpp>
|
#include <boost/python/def.hpp>
|
||||||
|
|
||||||
// mapnik
|
// mapnik
|
||||||
#include <mapnik/graphics.hpp>
|
#include <mapnik/graphics.hpp>
|
||||||
#include <mapnik/image_util.hpp>
|
#include <mapnik/image_util.hpp>
|
||||||
#include <mapnik/jpeg_io.hpp>
|
|
||||||
#include <mapnik/png_io.hpp>
|
#include <mapnik/png_io.hpp>
|
||||||
#include <mapnik/image_reader.hpp>
|
#include <mapnik/image_reader.hpp>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|
||||||
|
// jpeg
|
||||||
|
#if defined(HAVE_JPEG)
|
||||||
|
#include <mapnik/jpeg_io.hpp>
|
||||||
|
#endif
|
||||||
|
|
||||||
// cairo
|
// cairo
|
||||||
#if defined(HAVE_CAIRO) && defined(HAVE_PYCAIRO)
|
#if defined(HAVE_CAIRO) && defined(HAVE_PYCAIRO)
|
||||||
#include <cairomm/surface.h>
|
#include <cairomm/surface.h>
|
||||||
|
|
|
@ -29,10 +29,14 @@ extern "C"
|
||||||
#include <boost/python.hpp>
|
#include <boost/python.hpp>
|
||||||
#include <mapnik/image_util.hpp>
|
#include <mapnik/image_util.hpp>
|
||||||
#include <mapnik/image_view.hpp>
|
#include <mapnik/image_view.hpp>
|
||||||
#include <mapnik/jpeg_io.hpp>
|
|
||||||
#include <mapnik/png_io.hpp>
|
#include <mapnik/png_io.hpp>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|
||||||
|
// jpeg
|
||||||
|
#if defined(HAVE_JPEG)
|
||||||
|
#include <mapnik/jpeg_io.hpp>
|
||||||
|
#endif
|
||||||
|
|
||||||
using mapnik::image_data_32;
|
using mapnik::image_data_32;
|
||||||
using mapnik::image_view;
|
using mapnik::image_view;
|
||||||
using mapnik::save_to_file;
|
using mapnik::save_to_file;
|
||||||
|
|
|
@ -256,6 +256,16 @@ unsigned mapnik_svn_revision()
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// indicator for jpeg read/write support within libmapnik
|
||||||
|
bool has_jpeg()
|
||||||
|
{
|
||||||
|
#if defined(HAVE_JPEG)
|
||||||
|
return true;
|
||||||
|
#else
|
||||||
|
return false;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
// indicator for cairo rendering support inside libmapnik
|
// indicator for cairo rendering support inside libmapnik
|
||||||
bool has_cairo()
|
bool has_cairo()
|
||||||
{
|
{
|
||||||
|
@ -495,6 +505,7 @@ BOOST_PYTHON_MODULE(_mapnik2)
|
||||||
def("save_map_to_string", & save_map_to_string, save_map_to_string_overloads());
|
def("save_map_to_string", & save_map_to_string, save_map_to_string_overloads());
|
||||||
def("mapnik_version", &mapnik_version,"Get the Mapnik version number");
|
def("mapnik_version", &mapnik_version,"Get the Mapnik version number");
|
||||||
def("mapnik_svn_revision", &mapnik_svn_revision,"Get the Mapnik svn revision");
|
def("mapnik_svn_revision", &mapnik_svn_revision,"Get the Mapnik svn revision");
|
||||||
|
def("has_jpeg", &has_jpeg, "Get jpeg read/write support status");
|
||||||
def("has_cairo", &has_cairo, "Get cairo library status");
|
def("has_cairo", &has_cairo, "Get cairo library status");
|
||||||
def("has_pycairo", &has_pycairo, "Get pycairo module status");
|
def("has_pycairo", &has_pycairo, "Get pycairo module status");
|
||||||
|
|
||||||
|
|
|
@ -77,10 +77,12 @@ template <typename T>
|
||||||
void save_as_png(T const& image,
|
void save_as_png(T const& image,
|
||||||
std::string const& filename);
|
std::string const& filename);
|
||||||
|
|
||||||
|
#if defined(HAVE_JPEG)
|
||||||
template <typename T>
|
template <typename T>
|
||||||
void save_as_jpeg(std::string const& filename,
|
void save_as_jpeg(std::string const& filename,
|
||||||
int quality,
|
int quality,
|
||||||
T const& image);
|
T const& image);
|
||||||
|
#endif
|
||||||
|
|
||||||
inline bool is_png (std::string const& filename)
|
inline bool is_png (std::string const& filename)
|
||||||
{
|
{
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
//$Id$
|
//$Id$
|
||||||
|
#if defined(HAVE_JPEG)
|
||||||
|
|
||||||
#include <mapnik/global.hpp>
|
#include <mapnik/global.hpp>
|
||||||
|
|
||||||
|
@ -125,3 +126,5 @@ void save_as_jpeg(T1 & file,int quality, T2 const& image)
|
||||||
jpeg_destroy_compress(&cinfo);
|
jpeg_destroy_compress(&cinfo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
|
@ -30,11 +30,15 @@ extern "C"
|
||||||
// mapnik
|
// mapnik
|
||||||
#include <mapnik/image_util.hpp>
|
#include <mapnik/image_util.hpp>
|
||||||
#include <mapnik/png_io.hpp>
|
#include <mapnik/png_io.hpp>
|
||||||
#include <mapnik/jpeg_io.hpp>
|
|
||||||
#include <mapnik/graphics.hpp>
|
#include <mapnik/graphics.hpp>
|
||||||
#include <mapnik/memory.hpp>
|
#include <mapnik/memory.hpp>
|
||||||
#include <mapnik/image_view.hpp>
|
#include <mapnik/image_view.hpp>
|
||||||
|
|
||||||
|
// jpeg
|
||||||
|
#if defined(HAVE_JPEG)
|
||||||
|
#include <mapnik/jpeg_io.hpp>
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_CAIRO
|
#ifdef HAVE_CAIRO
|
||||||
#include <mapnik/cairo_renderer.hpp>
|
#include <mapnik/cairo_renderer.hpp>
|
||||||
#endif
|
#endif
|
||||||
|
@ -149,6 +153,7 @@ void save_to_stream(T const& image,
|
||||||
else
|
else
|
||||||
save_as_png256_hex(stream, image, colors, trans_mode, gamma);
|
save_as_png256_hex(stream, image, colors, trans_mode, gamma);
|
||||||
}
|
}
|
||||||
|
#if defined(HAVE_JPEG)
|
||||||
else if (boost::algorithm::istarts_with(type,std::string("jpeg")))
|
else if (boost::algorithm::istarts_with(type,std::string("jpeg")))
|
||||||
{
|
{
|
||||||
int quality = 85;
|
int quality = 85;
|
||||||
|
@ -167,6 +172,7 @@ void save_to_stream(T const& image,
|
||||||
throw ImageWriterException("invalid jpeg quality: " + type.substr(4) + " not a number");
|
throw ImageWriterException("invalid jpeg quality: " + type.substr(4) + " not a number");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
else throw ImageWriterException("unknown file type: " + type);
|
else throw ImageWriterException("unknown file type: " + type);
|
||||||
}
|
}
|
||||||
else throw ImageWriterException("Could not write to empty stream" );
|
else throw ImageWriterException("Could not write to empty stream" );
|
||||||
|
|
|
@ -31,7 +31,8 @@ def test_render_image_to_file():
|
||||||
|
|
||||||
i.background = mapnik2.Color('black')
|
i.background = mapnik2.Color('black')
|
||||||
|
|
||||||
i.save('test.jpg')
|
if mapnik2.has_jpeg():
|
||||||
|
i.save('test.jpg')
|
||||||
i.save('test.png', 'png')
|
i.save('test.png', 'png')
|
||||||
|
|
||||||
if os.path.exists('test.jpg'):
|
if os.path.exists('test.jpg'):
|
||||||
|
|
Loading…
Reference in a new issue