Update SConstruct to Python3

This commit is contained in:
Ali Mashtizadeh 2022-12-09 23:29:49 -05:00
parent 04b709f3b3
commit 98a9fc5a6f

View File

@ -31,34 +31,36 @@ env = Environment(options = opts,
Help(opts.GenerateHelpText(env))
# Copy environment variables
if os.environ.has_key('CC'):
if 'CC' in os.environ:
env["CC"] = os.getenv('CC')
if os.environ.has_key('CXX'):
if 'CXX' in os.environ:
env["CXX"] = os.getenv('CXX')
if os.environ.has_key('AS'):
if 'AS' in os.environ:
env["AS"] = os.getenv('AS')
if os.environ.has_key('LD'):
if 'LD' in os.environ:
env["LINK"] = os.getenv('LD')
if os.environ.has_key('AR'):
if 'AR' in os.environ:
env["AR"] = os.getenv('AR')
if os.environ.has_key('RANLIB'):
if 'RANLIB' in os.environ:
env["RANLIB"] = os.getenv('RANLIB')
if os.environ.has_key('CFLAGS'):
if 'CFLAGS' in os.environ:
env.Append(CCFLAGS = SCons.Util.CLVar(os.environ['CFLAGS']))
if os.environ.has_key('CPPFLAGS'):
if 'CPPFLAGS' in os.environ:
env.Append(CPPFLAGS = SCons.Util.CLVar(os.environ['CPPFLAGS']))
if os.environ.has_key('CXXFLAGS'):
if 'CXXFLAGS' in os.environ:
env.Append(CXXFLAGS = SCons.Util.CLVar(os.environ['CXXFLAGS']))
if os.environ.has_key('LDFLAGS'):
if 'LDFLAGS' in os.environ:
env.Append(LINKFLAGS = SCons.Util.CLVar(os.environ['LDFLAGS']))
#env.Append(CPPFLAGS = [ "-Wall", "-Wformat=2", "-Wextra", "-Wwrite-strings",
# "-Wno-unused-parameter", "-Wmissing-format-attribute",
# "-Werror" ])
#
env.Append(CFLAGS = [ "-Wshadow", "-Wno-typedef-redefinition" ])
#env.Append(CXXFLAGS = [ "-Wno-non-template-friend", "-Woverloaded-virtual",
# "-Wcast-qual", "-Wcast-align", "-Wconversion",
# "-Weffc++", "-std=c++0x", "-Werror" ])
env.Append(CXXFLAGS = [ "-fno-builtin" ])
if env["WITH_GPROF"] == "1":
env.Append(CPPFLAGS = [ "-pg" ])
@ -75,11 +77,11 @@ elif env["BUILDTYPE"] == "PERF":
elif env["BUILDTYPE"] == "RELEASE":
env.Append(CPPFLAGS = ["-DNDEBUG", "-Wall", "-O2"])
else:
print "Error BUILDTYPE must be RELEASE or DEBUG"
print("Error BUILDTYPE must be RELEASE or DEBUG")
sys.exit(-1)
if env["ARCH"] != "amd64":
print "Unsupported architecture: " + env["ARCH"]
print("Unsupported architecture: " + env["ARCH"])
sys.exit(-1)
try:
@ -144,11 +146,11 @@ def CheckFailed():
conf = env.Configure()
if not conf.CheckCC():
print 'Your C compiler and/or environment is incorrectly configured.'
print('Your C compiler and/or environment is incorrectly configured.')
CheckFailed()
if not conf.CheckCXX():
print 'Your C++ compiler and/or environment is incorrectly configured.'
print('Your C++ compiler and/or environment is incorrectly configured.')
CheckFailed()
conf.Finish()