2013-03-25 12:04:10 +00:00
|
|
|
#!/usr/bin/env python
|
|
|
|
|
|
|
|
from distutils.core import setup, Extension
|
2016-07-13 16:34:38 +00:00
|
|
|
import os
|
|
|
|
import sys
|
2013-03-25 12:04:10 +00:00
|
|
|
|
2016-07-13 16:48:20 +00:00
|
|
|
import numpy
|
|
|
|
# Obtain the numpy include directory. This logic works across numpy versions.
|
|
|
|
try:
|
|
|
|
numpy_include = numpy.get_include()
|
|
|
|
except AttributeError:
|
|
|
|
numpy_include = numpy.get_numpy_include()
|
2013-03-25 12:04:10 +00:00
|
|
|
|
2018-07-27 12:39:12 +00:00
|
|
|
# See ECC-644
|
|
|
|
extra_compile_args = []
|
|
|
|
cmake_c_compiler_id='@CMAKE_C_COMPILER_ID@'
|
|
|
|
if cmake_c_compiler_id == 'PGI':
|
|
|
|
extra_compile_args.append('-noswitcherror')
|
2013-03-25 12:04:10 +00:00
|
|
|
|
2016-07-13 16:48:20 +00:00
|
|
|
attdict = dict(sources=['@CMAKE_CURRENT_SOURCE_DIR@/swig_wrap_numpy.c',
|
2016-07-13 16:34:38 +00:00
|
|
|
'@CMAKE_CURRENT_SOURCE_DIR@/grib_interface.c'],
|
|
|
|
swig_opts=[],
|
|
|
|
include_dirs=['.', '@CMAKE_CURRENT_BINARY_DIR@/../src',
|
2016-07-13 16:48:20 +00:00
|
|
|
'@CMAKE_CURRENT_SOURCE_DIR@/../src',
|
|
|
|
numpy_include],
|
2016-07-13 16:34:38 +00:00
|
|
|
library_dirs=['@CMAKE_BINARY_DIR@/lib'],
|
2016-09-07 11:57:10 +00:00
|
|
|
runtime_library_dirs=[],
|
2016-07-13 16:34:38 +00:00
|
|
|
libraries=['eccodes'],
|
2018-07-27 12:39:12 +00:00
|
|
|
extra_compile_args=extra_compile_args,
|
2016-09-07 11:52:24 +00:00
|
|
|
extra_objects=[])
|
2013-03-25 12:04:10 +00:00
|
|
|
|
2016-07-29 17:03:54 +00:00
|
|
|
shared_libs='@BUILD_SHARED_LIBS@'
|
|
|
|
if shared_libs == 'OFF':
|
2016-09-07 11:42:33 +00:00
|
|
|
|
|
|
|
add_attribute = lambda **args: [list.append(attdict[key], value)
|
|
|
|
for key, value in args.items()]
|
|
|
|
|
2016-09-07 11:50:49 +00:00
|
|
|
if @HAVE_LIBJASPER@:
|
2016-09-07 11:42:33 +00:00
|
|
|
jasper_dir = '@JASPER_DIR@'
|
|
|
|
if jasper_dir and jasper_dir != 'system':
|
2016-09-07 11:50:49 +00:00
|
|
|
add_attribute(library_dirs=os.path.join(jasper_dir, 'lib'),
|
2016-09-07 11:52:24 +00:00
|
|
|
runtime_library_dirs=os.path.join(jasper_dir, 'lib'))
|
2016-09-07 11:42:33 +00:00
|
|
|
add_attribute(libraries='jasper')
|
|
|
|
|
2016-11-11 11:56:01 +00:00
|
|
|
if @HAVE_LIBOPENJPEG@:
|
|
|
|
openjpeg_lib_dir = '@OPENJPEG_LIB_DIR@'
|
|
|
|
openjpeg_libname = '@OJ_WITHOUT_LIB@'
|
|
|
|
if openjpeg_lib_dir:
|
|
|
|
add_attribute(library_dirs=openjpeg_lib_dir,
|
|
|
|
runtime_library_dirs=openjpeg_lib_dir)
|
|
|
|
add_attribute(libraries=openjpeg_libname)
|
|
|
|
|
2016-09-07 11:42:33 +00:00
|
|
|
# assumes png is supplied by system paths -- may not be true
|
2016-09-07 11:50:49 +00:00
|
|
|
if @HAVE_LIBPNG@:
|
2016-09-07 11:42:33 +00:00
|
|
|
add_attribute(libraries='png')
|
2014-10-10 17:09:04 +00:00
|
|
|
|
2016-12-16 18:31:59 +00:00
|
|
|
if @HAVE_MEMFS@:
|
|
|
|
add_attribute(libraries='eccodes_memfs')
|
|
|
|
|
2016-09-07 11:50:49 +00:00
|
|
|
if @HAVE_AEC@:
|
2016-09-07 11:42:33 +00:00
|
|
|
aec_dir = '@AEC_DIR@'
|
|
|
|
if aec_dir and aec_dir != 'system':
|
2016-09-07 11:50:49 +00:00
|
|
|
add_attribute(library_dirs=os.path.join(aec_dir, 'lib'),
|
2016-09-07 11:52:24 +00:00
|
|
|
runtime_library_dirs=os.path.join(aec_dir, 'lib'))
|
2016-09-07 11:42:33 +00:00
|
|
|
add_attribute(libraries='aec')
|
2013-03-25 12:04:10 +00:00
|
|
|
|
|
|
|
|
2016-07-13 16:34:38 +00:00
|
|
|
setup(name='eccodes',
|
2020-08-24 14:10:45 +00:00
|
|
|
version='@eccodes_VERSION_STR@',
|
2016-07-13 16:34:38 +00:00
|
|
|
author='ECMWF',
|
2016-07-18 16:06:07 +00:00
|
|
|
author_email='Software.Support@ecmwf.int',
|
|
|
|
description="""Python interface for ecCodes""",
|
|
|
|
license='Apache License, Version 2.0',
|
2019-01-28 12:47:22 +00:00
|
|
|
url='https://confluence.ecmwf.int/display/ECC/ecCodes+Home',
|
|
|
|
download_url='https://confluence.ecmwf.int/display/ECC/Releases',
|
2016-07-13 16:34:38 +00:00
|
|
|
ext_modules=[Extension('gribapi._gribapi_swig', **attdict)],
|
2016-12-14 09:53:20 +00:00
|
|
|
packages=['eccodes', 'eccodes.high_level', 'gribapi'])
|