Skip to content

Commit 8183414

Browse files
vnlitvinovanmyachev
authored andcommitted
Implement --with-debugging-symbols switch in setup.py (pandas-dev#25822)
1 parent ad6e391 commit 8183414

File tree

1 file changed

+18
-3
lines changed

1 file changed

+18
-3
lines changed

setup.py

+18-3
Original file line numberDiff line numberDiff line change
@@ -413,6 +413,11 @@ def run(self):
413413
# ----------------------------------------------------------------------
414414
# Preparation of compiler arguments
415415

416+
debugging_symbols_requested = '--with-debugging-symbols' in sys.argv
417+
if debugging_symbols_requested:
418+
sys.argv.remove('--with-debugging-symbols')
419+
420+
416421
if sys.byteorder == 'big':
417422
endian_macro = [('__BIG_ENDIAN__', '1')]
418423
else:
@@ -421,10 +426,16 @@ def run(self):
421426

422427
if is_platform_windows():
423428
extra_compile_args = []
429+
extra_link_args = []
430+
if debugging_symbols_requested:
431+
extra_compile_args.append('/Z7')
432+
extra_link_args.append('/DEBUG')
424433
else:
425434
# args to ignore warnings
426435
extra_compile_args = ['-Wno-unused-function']
427-
436+
extra_link_args = []
437+
if debugging_symbols_requested:
438+
extra_compile_args.append('-g')
428439

429440
# For mac, ensure extensions are built for macos 10.9 when compiling on a
430441
# 10.9 system or above, overriding distuitls behaviour which is to target
@@ -683,7 +694,8 @@ def srcpath(name=None, suffix='.pyx', subdir='src'):
683694
include_dirs=include,
684695
language=data.get('language', 'c'),
685696
define_macros=data.get('macros', macros),
686-
extra_compile_args=extra_compile_args)
697+
extra_compile_args=extra_compile_args,
698+
extra_link_args=extra_link_args)
687699

688700
extensions.append(obj)
689701

@@ -710,6 +722,7 @@ def srcpath(name=None, suffix='.pyx', subdir='src'):
710722
'pandas/_libs/src/datetime'],
711723
extra_compile_args=(['-D_GNU_SOURCE'] +
712724
extra_compile_args),
725+
extra_link_args=extra_link_args,
713726
define_macros=macros)
714727

715728

@@ -721,7 +734,9 @@ def srcpath(name=None, suffix='.pyx', subdir='src'):
721734
_move_ext = Extension('pandas.util._move',
722735
depends=[],
723736
sources=['pandas/util/move.c'],
724-
define_macros=macros)
737+
define_macros=macros,
738+
extra_compile_args=extra_compile_args,
739+
extra_link_args=extra_link_args)
725740
extensions.append(_move_ext)
726741

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

0 commit comments

Comments
 (0)