Skip to content

Commit

Permalink
Merge commit '24048fe232bca15801857cf5a2de1f703155cf77' into sync_ext…
Browse files Browse the repository at this point in the history
…ernals
  • Loading branch information
JonathanMeans committed Oct 7, 2019
2 parents ff1462a + 24048fe commit 346236c
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 35 deletions.
5 changes: 5 additions & 0 deletions externals/coda-oss/build/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -1298,6 +1298,11 @@ def configure(self):
env['PLATFORM'] = sys_platform

env['LIB_TYPE'] = Options.options.shared_libs and 'shlib' or 'stlib'
env['declspec_decoration'] = ''
env['windows_dll'] = False
if Options.options.shared_libs and env['COMPILER_CXX'] == 'msvc':
env['declspec_decoration'] = '__declspec(dllexport)'
env['windows_dll'] = True

env['install_headers'] = Options.options.install_headers
env['install_libs'] = Options.options.install_libs
Expand Down
85 changes: 52 additions & 33 deletions externals/coda-oss/modules/drivers/jpeg/wscript
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,30 @@ def options(opt):

from build import writeConfig

def configure(conf):

def toggleSharedBuild(conf, driverNode):
decoration = conf.env['declspec_decoration']

jmorecfg = os.path.join(driverNode.relpath(), 'jmorecfg.h')
with open(jmorecfg, 'r') as f:
contents = f.readlines()
with open(jmorecfg, 'w') as f:
for line in contents:
if line.startswith('#define EXTERN(type)'):
f.write('#define EXTERN(type) extern {0} type\n'.format(decoration))
elif line.startswith('#define GLOBAL(type)'):
f.write('#define GLOBAL(type) {0} type\n'.format(decoration))
else:
f.write(line)


def configure(conf):
if Options.options.enable_jpeg:

jpegHome = Options.options.jpeg_home
if jpegHome:
if conf.check(lib='jpeg' if sys.platform != 'win32' else 'libjpeg',
uselib_store='JPEG',
if conf.check(lib='jpeg' if sys.platform != 'win32' else 'libjpeg',
uselib_store='JPEG',
header_name='jpeglib.h', fragment=frag,
libpath=join(jpegHome, 'lib'),
includes=join(jpegHome, 'include'),
Expand All @@ -54,34 +71,36 @@ def configure(conf):
# Build is off by default when tarfile not found, fail if forced on
if not os.path.exists(join(conf.path.abspath(), tarfile)):
conf.fatal('Missing libjpeg tarfile')

# callback function to check for all #defines used by the jpeg driver
def jpeg_callback(conf):
# These are needed by jmorecfg.h. We could just set these defines
# rather than bothering with the conf check.
conf.define('HAVE_PROTOTYPES', 1)
conf.check_cc(fragment='int main(){unsigned short; return 0;}',
define_name='HAVE_UNSIGNED_SHORT', msg='Checking for unsigned short',
define_name='HAVE_UNSIGNED_SHORT', msg='Checking for unsigned short',
mandatory=False)
conf.check_cc(fragment='int main(){unsigned char i; return 0;}',
define_name='HAVE_UNSIGNED_CHAR', msg='Checking for unsigned char',
define_name='HAVE_UNSIGNED_CHAR', msg='Checking for unsigned char',
mandatory=False)
conf.check_cc(header_name="stddef.h", mandatory=False)
conf.check_cc(header_name="stdlib.h", mandatory=False)
conf.check_cc(header_name="locale.h", mandatory=False)

conf.env['MAKE_JPEG'] = True
conf.msg('Building local lib', 'jpeg (libjpeg)')

untarFile(path=conf.path, fname=tarfile)

# make jconfig.h
driverNode = conf.path.make_node(sourcepath)
writeConfig(conf, jpeg_callback, 'jpeg', infile='jconfig.cfg',
outfile='jconfig.h', path=driverNode, feature='handleDefs')


toggleSharedBuild(conf, driverNode)

else:
if conf.check(lib='jpeg' if sys.platform != 'win32' else 'libjpeg',
if conf.check(lib='jpeg' if sys.platform != 'win32' else 'libjpeg',
uselib_store='JPEG',
header_name='jpeglib.h', fragment=frag,
msg='Checking for library libjpeg',
Expand All @@ -93,28 +112,28 @@ def configure(conf):
def build(bld):
variant = bld.env['VARIANT']
env = bld.all_envs[variant]

driversNode = bld.path
sourceFiles = []
driverNode = driversNode.make_node(sourcepath)

if 'MAKE_JPEG' in env:
sources = ('cdjpeg.c', 'jaricom.c', 'jcapimin.c', 'jcapistd.c',
'jcarith.c', 'jccoefct.c', 'jccolor.c', 'jcdctmgr.c',
'jchuff.c', 'jcinit.c', 'jcmainct.c', 'jcmarker.c',
'jcmaster.c', 'jcomapi.c', 'jcparam.c', 'jcprepct.c',
'jcsample.c', 'jctrans.c', 'jdapimin.c', 'jdapistd.c',
'jdarith.c', 'jdatadst.c', 'jdatasrc.c', 'jdcoefct.c',
'jdcolor.c', 'jddctmgr.c', 'jdhuff.c', 'jdinput.c',
'jdmainct.c', 'jdmarker.c', 'jdmaster.c', 'jdmerge.c',
'jdpostct.c', 'jdsample.c', 'jdtrans.c', 'jerror.c',
'jfdctflt.c', 'jfdctfst.c', 'jfdctint.c', 'jidctflt.c',
'jidctfst.c', 'jidctint.c', 'jmemmgr.c', 'jmemnobs.c',
'jquant1.c', 'jquant2.c', 'jutils.c', 'rdbmp.c',
'rdcolmap.c', 'rdgif.c', 'rdppm.c', 'rdrle.c',
'rdswitch.c', 'rdtarga.c', 'transupp.c', 'wrbmp.c',
sources = ('cdjpeg.c', 'jaricom.c', 'jcapimin.c', 'jcapistd.c',
'jcarith.c', 'jccoefct.c', 'jccolor.c', 'jcdctmgr.c',
'jchuff.c', 'jcinit.c', 'jcmainct.c', 'jcmarker.c',
'jcmaster.c', 'jcomapi.c', 'jcparam.c', 'jcprepct.c',
'jcsample.c', 'jctrans.c', 'jdapimin.c', 'jdapistd.c',
'jdarith.c', 'jdatadst.c', 'jdatasrc.c', 'jdcoefct.c',
'jdcolor.c', 'jddctmgr.c', 'jdhuff.c', 'jdinput.c',
'jdmainct.c', 'jdmarker.c', 'jdmaster.c', 'jdmerge.c',
'jdpostct.c', 'jdsample.c', 'jdtrans.c', 'jerror.c',
'jfdctflt.c', 'jfdctfst.c', 'jfdctint.c', 'jidctflt.c',
'jidctfst.c', 'jidctint.c', 'jmemmgr.c', 'jmemnobs.c',
'jquant1.c', 'jquant2.c', 'jutils.c', 'rdbmp.c',
'rdcolmap.c', 'rdgif.c', 'rdppm.c', 'rdrle.c',
'rdswitch.c', 'rdtarga.c', 'transupp.c', 'wrbmp.c',
'wrgif.c', 'wrppm.c', 'wrrle.c', 'wrtarga.c')

jpeglib = bld(features='c c%s add_targets' % env['LIB_TYPE'] or 'stlib',
includes=['.'],
export_includes=['.'],
Expand All @@ -126,16 +145,16 @@ def build(bld):
env=env.derive(),
name='JPEG',
targets_to_add=[])

if env['install_libs']:
jpeglib.install_path = env['install_libdir']

if env['install_headers']:
bld(features='install_tgt', install_path=env['install_includedir'],
dir=driverNode, pattern=('jpeglib.h', 'jconfig.h', 'jmorecfg.h'),
dir=driverNode, pattern=('jpeglib.h', 'jconfig.h', 'jmorecfg.h'),
name='JPEG_HEADERS_INSTALL')
jpeglib.targets_to_add += ['JPEG_HEADERS_INSTALL']

if env['install_source']:
sourceFiles.append(tarfile)
jpeglib.targets_to_add += ['JPEG_SOURCE_INSTALL']
Expand All @@ -150,7 +169,7 @@ def build(bld):
def distclean(context):
# remove the untarred directories
import shutil
dirs = filter(lambda x: exists(join(context.path.abspath(), x)),
dirs = filter(lambda x: exists(join(context.path.abspath(), x)),
[sourcepath])
for d in dirs:
try:
Expand Down
6 changes: 4 additions & 2 deletions externals/coda-oss/modules/drivers/xml/xerces/wscript
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ def configure(conf):
conf.define('HAVE_STD_NAMESPACE', 1)

conf.define('XERCES_AUTOCONF', 1)
conf.define('XERCES_PLATFORM_EXPORT', '', quote=False)
conf.define('XERCES_PLATFORM_EXPORT', conf.env['declspec_decoration'], quote=False)
conf.define('XERCES_PLATFORM_IMPORT', '', quote=False)
conf.define('XERCES_HAS_CPP_NAMESPACE', 1)
conf.define('XERCES_STD_NAMESPACE', 1)
Expand Down Expand Up @@ -295,7 +295,9 @@ def build(bld):

# build the library
libType = env['LIB_TYPE'] or 'stlib'
xercesDefines = env['DEFINES'] + ['HAVE_CONFIG_H']
xercesDefines = env['DEFINES'] + ['HAVE_CONFIG_H', 'XERCES_BUILDING_LIBRARY']
if libType == 'shlib':
xercesDefines.append('DLL_EXPORT')
xerces = bld(features='c c%s add_targets' % env['LIB_TYPE'] or 'stlib',
source=sources,
includes=['.', 'src'], export_includes=['src'],
Expand Down

0 comments on commit 346236c

Please sign in to comment.