scons: fix the build in the case that one of the optional imaging libraries is not found

This commit is contained in:
Dane Springmeyer 2013-07-19 12:13:17 -04:00
parent f999615cec
commit 7796ea65d6

View file

@ -1182,14 +1182,15 @@ if not preconfigured:
else: else:
env['MISSING_DEPS'].append('libxml2') env['MISSING_DEPS'].append('libxml2')
LIBSHEADERS = [ REQUIRED_LIBSHEADERS = [
['z', 'zlib.h', True,'C'], ['z', 'zlib.h', True,'C'],
[env['ICU_LIB_NAME'],'unicode/unistr.h',True,'C++'], [env['ICU_LIB_NAME'],'unicode/unistr.h',True,'C++'],
] ]
OPTIONAL_LIBSHEADERS = []
if env['JPEG']: if env['JPEG']:
env.Append(CPPDEFINES = '-DHAVE_JPEG') OPTIONAL_LIBSHEADERS.append(['jpeg', ['stdio.h', 'jpeglib.h'], False,'C','-DHAVE_JPEG'])
LIBSHEADERS.append(['jpeg', ['stdio.h', 'jpeglib.h'], False,'C'])
inc_path = env['%s_INCLUDES' % 'JPEG'] inc_path = env['%s_INCLUDES' % 'JPEG']
lib_path = env['%s_LIBS' % 'JPEG'] lib_path = env['%s_LIBS' % 'JPEG']
env.AppendUnique(CPPPATH = os.path.realpath(inc_path)) env.AppendUnique(CPPPATH = os.path.realpath(inc_path))
@ -1198,8 +1199,7 @@ if not preconfigured:
env['SKIPPED_DEPS'].extend(['jpeg']) env['SKIPPED_DEPS'].extend(['jpeg'])
if env['PROJ']: if env['PROJ']:
env.Append(CPPDEFINES = '-DMAPNIK_USE_PROJ4') OPTIONAL_LIBSHEADERS.append(['proj', 'proj_api.h', False,'C','-DMAPNIK_USE_PROJ4'])
LIBSHEADERS.append(['proj', 'proj_api.h', False,'C'])
inc_path = env['%s_INCLUDES' % 'PROJ'] inc_path = env['%s_INCLUDES' % 'PROJ']
lib_path = env['%s_LIBS' % 'PROJ'] lib_path = env['%s_LIBS' % 'PROJ']
env.AppendUnique(CPPPATH = os.path.realpath(inc_path)) env.AppendUnique(CPPPATH = os.path.realpath(inc_path))
@ -1208,8 +1208,7 @@ if not preconfigured:
env['SKIPPED_DEPS'].extend(['proj']) env['SKIPPED_DEPS'].extend(['proj'])
if env['PNG']: if env['PNG']:
env.Append(CPPDEFINES = '-DHAVE_PNG') OPTIONAL_LIBSHEADERS.append(['png', 'png.h', False,'C','-DHAVE_PNG'])
LIBSHEADERS.append(['png', 'png.h', False,'C'])
inc_path = env['%s_INCLUDES' % 'PNG'] inc_path = env['%s_INCLUDES' % 'PNG']
lib_path = env['%s_LIBS' % 'PNG'] lib_path = env['%s_LIBS' % 'PNG']
env.AppendUnique(CPPPATH = os.path.realpath(inc_path)) env.AppendUnique(CPPPATH = os.path.realpath(inc_path))
@ -1218,8 +1217,7 @@ if not preconfigured:
env['SKIPPED_DEPS'].extend(['png']) env['SKIPPED_DEPS'].extend(['png'])
if env['WEBP']: if env['WEBP']:
env.Append(CPPDEFINES = '-DHAVE_WEBP') OPTIONAL_LIBSHEADERS.append(['webp', 'webp/decode.h', False,'C','-DHAVE_WEBP'])
LIBSHEADERS.append(['webp', 'webp/decode.h', False,'C'])
inc_path = env['%s_INCLUDES' % 'WEBP'] inc_path = env['%s_INCLUDES' % 'WEBP']
lib_path = env['%s_LIBS' % 'WEBP'] lib_path = env['%s_LIBS' % 'WEBP']
env.AppendUnique(CPPPATH = os.path.realpath(inc_path)) env.AppendUnique(CPPPATH = os.path.realpath(inc_path))
@ -1228,8 +1226,7 @@ if not preconfigured:
env['SKIPPED_DEPS'].extend(['webp']) env['SKIPPED_DEPS'].extend(['webp'])
if env['TIFF']: if env['TIFF']:
env.Append(CPPDEFINES = '-DHAVE_TIFF') OPTIONAL_LIBSHEADERS.append(['tiff', 'tiff.h', False,'C','-DHAVE_TIFF'])
LIBSHEADERS.append(['tiff', 'tiff.h', False,'C'])
inc_path = env['%s_INCLUDES' % 'TIFF'] inc_path = env['%s_INCLUDES' % 'TIFF']
lib_path = env['%s_LIBS' % 'TIFF'] lib_path = env['%s_LIBS' % 'TIFF']
env.AppendUnique(CPPPATH = os.path.realpath(inc_path)) env.AppendUnique(CPPPATH = os.path.realpath(inc_path))
@ -1242,7 +1239,7 @@ if not preconfigured:
conf.prioritize_paths(silent=True) conf.prioritize_paths(silent=True)
if not env['HOST']: if not env['HOST']:
for libname, headers, required, lang in LIBSHEADERS: for libname, headers, required, lang in REQUIRED_LIBSHEADERS:
if not conf.CheckLibWithHeader(libname, headers, lang): if not conf.CheckLibWithHeader(libname, headers, lang):
if required: if required:
color_print(1, 'Could not find required header or shared library for %s' % libname) color_print(1, 'Could not find required header or shared library for %s' % libname)
@ -1330,6 +1327,18 @@ if not preconfigured:
else: else:
env['SKIPPED_DEPS'].append('boost_regex_icu') env['SKIPPED_DEPS'].append('boost_regex_icu')
if not env['HOST']:
for libname, headers, required, lang, define in OPTIONAL_LIBSHEADERS:
if not conf.CheckLibWithHeader(libname, headers, lang):
if required:
color_print(1, 'Could not find required header or shared library for %s' % libname)
env['MISSING_DEPS'].append(libname)
else:
color_print(4, 'Could not find optional header or shared library for %s' % libname)
env['SKIPPED_DEPS'].append(libname)
else:
env.Append(CPPDEFINES = define)
env['REQUESTED_PLUGINS'] = [ driver.strip() for driver in Split(env['INPUT_PLUGINS'])] env['REQUESTED_PLUGINS'] = [ driver.strip() for driver in Split(env['INPUT_PLUGINS'])]
SQLITE_HAS_RTREE = None SQLITE_HAS_RTREE = None