Skip to content

Commit

Permalink
Merge pull request #1907 from breznak/debug
Browse files Browse the repository at this point in the history
add --debug option to setup.py
  • Loading branch information
rhyolight committed Mar 16, 2015
2 parents cee5916 + 31ce2b7 commit d02bba7
Showing 1 changed file with 23 additions and 10 deletions.
33 changes: 23 additions & 10 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,12 @@ def getCommandLineOptions():
"value",
"(optional) enable link-time optimizations (LTO); currently only for gcc and linker ld.gold"]
)
optionsDesc.append(
["debug",
"value",
"(optional) compile in mode suitable for debugging; overrides any optimizations"]
)



# Read command line options looking for extra options
Expand Down Expand Up @@ -367,16 +373,21 @@ def getExtensionModules(nupicCoreReleaseDir, platform, bitness, cmdOptions=None)
]

# Optimizations
if cmdOptions is not None and getCommandLineOption("optimizations-native", cmdOptions):
commonCompileFlags.append("-march=native")
commonCompileFlags.append("-O3")
commonLinkFlags.append("-O3")
if cmdOptions is not None and getCommandLineOption("optimizations-lto", cmdOptions):
commonCompileFlags.append("-fuse-linker-plugin")
commonCompileFlags.append("-flto-report")
commonCompileFlags.append("-fuse-ld=gold")
commonCompileFlags.append("-flto")
commonLinkFlags.append("-flto")
if getCommandLineOption("debug", cmdOptions):
commonCompileFlags.append("-Og")
commonCompileFlags.append("-g")
commonLinkFlags.append("-O0")
else:
if getCommandLineOption("optimizations-native", cmdOptions):
commonCompileFlags.append("-march=native")
commonCompileFlags.append("-O3")
commonLinkFlags.append("-O3")
if getCommandLineOption("optimizations-lto", cmdOptions):
commonCompileFlags.append("-fuse-linker-plugin")
commonCompileFlags.append("-flto-report")
commonCompileFlags.append("-fuse-ld=gold")
commonCompileFlags.append("-flto")
commonLinkFlags.append("-flto")



Expand Down Expand Up @@ -506,6 +517,8 @@ def getExtensionModules(nupicCoreReleaseDir, platform, bitness, cmdOptions=None)


def getCommandLineOption(name, options):
if name is None or options is None:
return False
if name in options:
return options[name]

Expand Down

0 comments on commit d02bba7

Please sign in to comment.