Austin Schuh | 3333ec7 | 2022-12-29 16:21:06 -0800 | [diff] [blame^] | 1 | from __future__ import print_function |
| 2 | import sysconfig |
| 3 | import re |
| 4 | import numpy as np |
| 5 | conf = sysconfig.get_config_vars() |
| 6 | |
| 7 | print('CFLAGS', end=';') |
| 8 | c_flags = [] |
| 9 | # Grab compiler flags minus the compiler itself. |
| 10 | c_flags.extend(conf.get('CC', '').split()[2:]) |
| 11 | c_flags.extend(conf.get('CFLAGS', '').split()) |
| 12 | c_flags.extend(conf.get('CCSHARED', '').split()) |
| 13 | c_flags.append('-I{}'.format(conf.get('INCLUDEPY', ''))) |
| 14 | c_flags.append('-I{}'.format(np.get_include())) |
| 15 | c_flags.append('-Wno-strict-prototypes') |
| 16 | c_flags = [x for x in c_flags if not x.startswith('-O')] |
| 17 | print(' '.join(c_flags), end=';') |
| 18 | |
| 19 | |
| 20 | print('LINKER', end=';') |
| 21 | print(conf.get('BLDSHARED', '').split()[0], end=';') |
| 22 | |
| 23 | print('LDFLAGS', end=';') |
| 24 | print(' '.join(conf.get('BLDSHARED', '').split()[1:]) + ' ' + conf.get('BLDLIBRARY', '') + ' ' + conf.get('LDFLAGS', ''), end=';') |
| 25 | |
| 26 | print('EXT_SUFFIX', end=';') |
| 27 | ext_suffix = '.so' |
| 28 | if 'EXT_SUFFIX' in conf: |
| 29 | ext_suffix = conf['EXT_SUFFIX'] |
| 30 | elif 'MULTIARCH' in conf: |
| 31 | ext_suffix = '.' + conf['MULTIARCH'] + '.so' |
| 32 | |
| 33 | print(ext_suffix, end=';') |
| 34 | |