Files
opm-common/python/setup.py

97 lines
2.6 KiB
Python
Raw Normal View History

2019-06-27 14:08:22 +02:00
from setuptools import setup, find_packages
from setuptools import Extension
from setuptools.command.build_ext import build_ext
import sys
import setuptools
import glob
import os
2019-08-09 13:02:04 +02:00
import subprocess
try:
from importlib.machinery import EXTENSION_SUFFIXES
suffix = EXTENSION_SUFFIXES[0]
except ImportError:
suffix = ".so"
setupdir = os.path.dirname(__file__)
if setupdir != '':
os.chdir( setupdir )
2019-08-09 13:02:04 +02:00
try:
2019-09-17 14:16:55 +02:00
subprocess.call(['ccache', '--version'])
cc = os.environ.get("CC", "c++")
os.environ['CC'] = 'ccache {}'.format(cc)
print("Using 'ccache {}' as compiler".format(cc))
2019-08-09 13:02:04 +02:00
except OSError as e:
2019-09-17 14:16:55 +02:00
print('\nNOTE: please install ccache for faster compilation of python bindings.\n')
2019-06-27 14:08:22 +02:00
if 'build' in sys.argv:
2019-09-17 14:16:55 +02:00
if not 'build_ext' in sys.argv:
raise TypeError("Missing option 'build_ext'.")
2019-06-27 14:08:22 +02:00
ext_modules = [
Extension(
'libopmcommon_python',
2019-06-27 14:08:22 +02:00
[
2019-10-11 16:29:09 +02:00
'cxx/unit_system.cpp',
2019-06-27 14:08:22 +02:00
'cxx/connection.cpp',
2019-10-30 22:34:37 +01:00
'cxx/converters.cpp',
2019-06-27 14:08:22 +02:00
'cxx/deck.cpp',
'cxx/deck_keyword.cpp',
'cxx/eclipse_io.cpp',
'cxx/field_props.cpp',
2019-06-27 14:08:22 +02:00
'cxx/eclipse_config.cpp',
'cxx/eclipse_grid.cpp',
'cxx/eclipse_state.cpp',
'cxx/group.cpp',
2019-09-16 18:33:50 +02:00
'cxx/log.cpp',
'cxx/parsecontext.cpp',
2019-06-27 14:08:22 +02:00
'cxx/parser.cpp',
'cxx/schedule.cpp',
2019-12-27 10:08:46 +01:00
'cxx/summary_state.cpp',
2019-06-27 14:08:22 +02:00
'cxx/table_manager.cpp',
'cxx/well.cpp',
'cxx/export.cpp'
2019-06-27 14:08:22 +02:00
],
libraries=['opmcommon', 'boost_filesystem', 'boost_regex'],
2019-06-27 14:08:22 +02:00
language='c++',
undef_macros=["NDEBUG"],
include_dirs=["pybind11/include"]
),
2019-10-26 17:33:43 +02:00
Extension(
'libopmioecl_python',
[
'cxx/eclipse_io.cpp',
],
libraries=['opmcommon', 'boost_filesystem', 'boost_regex'],
language='c++',
undef_macros=["NDEBUG"],
include_dirs=["pybind11/include"]
)
2019-06-27 14:08:22 +02:00
]
setup(
name='Opm',
2019-06-27 14:08:22 +02:00
package_dir = {'': 'python'},
packages=[
'opm',
2019-08-23 10:25:54 +02:00
'opm.io',
'opm.io.deck',
'opm.io.ecl_state',
2019-08-23 11:44:41 +02:00
'opm.io.parser',
'opm.io.schedule',
2019-10-26 17:33:43 +02:00
'opm.io.ecl',
'opm.tools'
2019-06-27 14:08:22 +02:00
],
ext_modules=ext_modules,
2019-10-26 17:33:43 +02:00
package_data={'opm': ['libopmcommon_python{}'.format(suffix), 'libopmioecl_python'.format(suffix)]},
include_package_data=True,
2019-06-27 14:08:22 +02:00
license='Open Source',
zip_safe=False,
tests_suite='tests',
2019-06-27 14:08:22 +02:00
setup_requires=["pytest-runner", 'setuptools_scm'],
)