Skip to content

Implement --with-debugging-symbols switch in setup.py #25822

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

Merged
merged 1 commit into from
Mar 21, 2019
Merged
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
21 changes: 18 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -413,6 +413,11 @@ def run(self):
# ----------------------------------------------------------------------
# Preparation of compiler arguments

debugging_symbols_requested = '--with-debugging-symbols' in sys.argv
if debugging_symbols_requested:
sys.argv.remove('--with-debugging-symbols')


if sys.byteorder == 'big':
endian_macro = [('__BIG_ENDIAN__', '1')]
else:
Expand All @@ -421,10 +426,16 @@ def run(self):

if is_platform_windows():
extra_compile_args = []
extra_link_args = []
if debugging_symbols_requested:
extra_compile_args.append('/Z7')
extra_link_args.append('/DEBUG')
else:
# args to ignore warnings
extra_compile_args = ['-Wno-unused-function']

extra_link_args = []
if debugging_symbols_requested:
extra_compile_args.append('-g')

# For mac, ensure extensions are built for macos 10.9 when compiling on a
# 10.9 system or above, overriding distuitls behaviour which is to target
Expand Down Expand Up @@ -688,7 +699,8 @@ def srcpath(name=None, suffix='.pyx', subdir='src'):
include_dirs=include,
language=data.get('language', 'c'),
define_macros=data.get('macros', macros),
extra_compile_args=extra_compile_args)
extra_compile_args=extra_compile_args,
extra_link_args=extra_link_args)

extensions.append(obj)

Expand All @@ -715,6 +727,7 @@ def srcpath(name=None, suffix='.pyx', subdir='src'):
'pandas/_libs/src/datetime'],
extra_compile_args=(['-D_GNU_SOURCE'] +
extra_compile_args),
extra_link_args=extra_link_args,
define_macros=macros)


Expand All @@ -726,7 +739,9 @@ def srcpath(name=None, suffix='.pyx', subdir='src'):
_move_ext = Extension('pandas.util._move',
depends=[],
sources=['pandas/util/move.c'],
define_macros=macros)
define_macros=macros,
extra_compile_args=extra_compile_args,
extra_link_args=extra_link_args)
extensions.append(_move_ext)

# The build cache system does string matching below this point.
Expand Down