Skip to content

Commit e31b4f4

Browse files
vnlitvinovjreback
authored andcommitted
Implement --with-debugging-symbols switch in setup.py (#25822)
1 parent f39a9ce commit e31b4f4

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
@@ -688,7 +699,8 @@ def srcpath(name=None, suffix='.pyx', subdir='src'):
688699
include_dirs=include,
689700
language=data.get('language', 'c'),
690701
define_macros=data.get('macros', macros),
691-
extra_compile_args=extra_compile_args)
702+
extra_compile_args=extra_compile_args,
703+
extra_link_args=extra_link_args)
692704

693705
extensions.append(obj)
694706

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

720733

@@ -726,7 +739,9 @@ def srcpath(name=None, suffix='.pyx', subdir='src'):
726739
_move_ext = Extension('pandas.util._move',
727740
depends=[],
728741
sources=['pandas/util/move.c'],
729-
define_macros=macros)
742+
define_macros=macros,
743+
extra_compile_args=extra_compile_args,
744+
extra_link_args=extra_link_args)
730745
extensions.append(_move_ext)
731746

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

0 commit comments

Comments
 (0)