diff options
author | Dwayne C. Litzenberger <dlitz@dlitz.net> | 2009-10-10 15:05:36 -0400 |
---|---|---|
committer | Dwayne C. Litzenberger <dlitz@dlitz.net> | 2009-10-11 01:07:44 -0400 |
commit | bf7a2e75983fba643482136a6c5e97a764134881 (patch) | |
tree | a6412550ec5002bd3ec5f4a4386206c6a60c1417 /setup.py | |
parent | 99e5ac529c7f1ce9c365022f608eeffd02afdf37 (diff) | |
download | pycrypto-bf7a2e75983fba643482136a6c5e97a764134881.tar.gz |
setup.py: Enable assert() statements, and reduce optimization when debugging
Diffstat (limited to 'setup.py')
-rw-r--r-- | setup.py | 27 |
1 files changed, 19 insertions, 8 deletions
@@ -115,14 +115,25 @@ class PCTBuildExt (build_ext): # Detect which modules should be compiled self.detect_modules() - # Speed up execution by tweaking compiler options. This especially - # helps the DES modules. - if not self.debug and self.compiler.compiler_type in ('unix', 'cygwin', 'mingw32'): - self.__remove_compiler_option("-g") - self.__remove_compiler_option("-O") - self.__remove_compiler_option("-O2") - self.__add_compiler_option("-O3") - self.__add_compiler_option("-fomit-frame-pointer") + # Tweak compiler options + if self.compiler.compiler_type in ('unix', 'cygwin', 'mingw32'): + # Make assert() statements always work + self.__remove_compiler_option("-DNDEBUG") + + # Choose our own optimization options + for opt in ["-O", "-O0", "-O1", "-O2", "-O3", "-Os"]: + self.__remove_compiler_option(opt) + if self.debug: + # Basic optimization is still needed when debugging to compile + # the libtomcrypt code. + self.__add_compiler_option("-O") + else: + # Speed up execution by tweaking compiler options. This + # especially helps the DES modules. + self.__add_compiler_option("-O3") + self.__add_compiler_option("-fomit-frame-pointer") + # Don't include debug symbols unless debugging + self.__remove_compiler_option("-g") # Call the superclass's build_extensions method build_ext.build_extensions(self) |