Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python linkage enhancements #419

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 15 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,13 @@
import copy, os, platform, shutil
import distutils.sysconfig

CONFIGURE_ARGS = ['--disable-shared', '--enable-static', '--with-pic',
build_shared = os.environ.get('WALLY_ABI_PY_WHEEL_USE_DSO', '').lower() not in ['', '0', 'false', 'no', 'n', 'off']
if build_shared:
CONFIGURE_ARGS = ['--enable-shared', '--disable-static']
else:
CONFIGURE_ARGS = ['--disable-shared', '--enable-static', '--with-pic']

CONFIGURE_ARGS += [
'--enable-swig-python', '--enable-python-manylinux',
'--disable-swig-java', '--disable-tests', '--disable-dependency-tracking']

Expand Down Expand Up @@ -67,25 +73,30 @@ def call(args):
include_dirs=[
'./',
'./src',
'./src/ccan',
'./src/secp256k1/include',
]
if is_windows:
shutil.copyfile('./src/amalgamation/windows_config/libsecp256k1-config.h', 'src/secp256k1/src/libsecp256k1-config.h')
include_dirs = ['./src/amalgamation/windows_config'] + include_dirs
include_dirs = ['./src/amalgamation/windows_config'] + include_dirs + ['./src/ccan']

extra_compile_args = ['-flax-vector-conversions']

wally_ext = Extension(
'_wallycore',
define_macros=define_macros,
include_dirs=include_dirs,
library_dirs=[] if is_windows else
['src/.libs'] + ([] if build_shared else ['src/secp256k1/.libs']),
libraries=[] if is_windows else
['wallycore'] + ([] if build_shared else ['secp256k1']),
extra_compile_args=extra_compile_args,
sources=[
'src/swig_python/swig_wrap.c' if is_windows else 'src/swig_python/swig_python_wrap.c',
'src/swig_python/swig_wrap.c',
'src/amalgamation/combined.c',
'src/amalgamation/combined_ccan.c',
'src/amalgamation/combined_ccan2.c',
] if is_windows else [
'src/swig_python/swig_python_wrap.c',
],
)

Expand Down
Loading