Skip to content

Commit

Permalink
Merge pull request #262 from rockdrilla/build-cflags
Browse files Browse the repository at this point in the history
setup: better deal with compiler flags
  • Loading branch information
bgaifullin authored Feb 25, 2024
2 parents 0637d4e + b865569 commit 79ba7cc
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ def run(self):
ext = self.ext_map['xmlsec']
self.debug = os.environ.get('PYXMLSEC_ENABLE_DEBUG', False)
self.static = os.environ.get('PYXMLSEC_STATIC_DEPS', False)
self.size_opt = os.environ.get('PYXMLSEC_OPTIMIZE_SIZE', True)

if self.static or sys.platform == 'win32':
self.info('starting static build on {}'.format(sys.platform))
Expand Down Expand Up @@ -153,11 +154,18 @@ def run(self):
)

if self.debug:
ext.extra_compile_args.append('-Wall')
ext.extra_compile_args.append('-O0')
ext.define_macros.append(('PYXMLSEC_ENABLE_DEBUG', '1'))
if sys.platform == 'win32':
ext.extra_compile_args.append('/Od')
else:
ext.extra_compile_args.append('-Wall')
ext.extra_compile_args.append('-O0')
else:
ext.extra_compile_args.append('-Os')
if self.size_opt:
if sys.platform == 'win32':
ext.extra_compile_args.append('/Os')
else:
ext.extra_compile_args.append('-Os')

super(build_ext, self).run()

Expand Down

0 comments on commit 79ba7cc

Please sign in to comment.