Improve SConstruct file to improve compatability and expose the compiledb.

This commit is contained in:
Ali Mashtizadeh 2023-08-22 18:03:24 -04:00
parent 5295c3c8d2
commit 53161c2c95

View File

@ -26,7 +26,7 @@ opts.AddVariables(
) )
env = Environment(options = opts, env = Environment(options = opts,
tools = ['default'], tools = ['default', 'compilation_db'],
ENV = os.environ) ENV = os.environ)
Help(opts.GenerateHelpText(env)) Help(opts.GenerateHelpText(env))
@ -55,12 +55,11 @@ if 'LDFLAGS' in os.environ:
#env.Append(CPPFLAGS = [ "-Wall", "-Wformat=2", "-Wextra", "-Wwrite-strings", #env.Append(CPPFLAGS = [ "-Wall", "-Wformat=2", "-Wextra", "-Wwrite-strings",
# "-Wno-unused-parameter", "-Wmissing-format-attribute", # "-Wno-unused-parameter", "-Wmissing-format-attribute",
# "-Werror" ]) # "-Werror" ])
#
env.Append(CFLAGS = [ "-Wshadow", "-Wno-typedef-redefinition" ]) env.Append(CFLAGS = [ "-Wshadow", "-Wno-typedef-redefinition" ])
#env.Append(CXXFLAGS = [ "-Wno-non-template-friend", "-Woverloaded-virtual", #env.Append(CXXFLAGS = [ "-Wno-non-template-friend", "-Woverloaded-virtual",
# "-Wcast-qual", "-Wcast-align", "-Wconversion", # "-Wcast-qual", "-Wcast-align", "-Wconversion",
# "-Weffc++", "-std=c++0x", "-Werror" ]) # "-Weffc++", "-std=c++0x", "-Werror" ])
env.Append(CXXFLAGS = [ "-fno-builtin" ]) env.Append(CPPFLAGS = [ "-fno-builtin", "-fno-stack-protector" ])
if env["WITH_GPROF"] == "1": if env["WITH_GPROF"] == "1":
env.Append(CPPFLAGS = [ "-pg" ]) env.Append(CPPFLAGS = [ "-pg" ])
@ -153,10 +152,16 @@ 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() CheckFailed()
if not env["CCVERSION"].startswith("15."):
print('Only Clang 15 is supported')
print('You are running: ' + env["CCVERSION"])
CheckFailed()
conf.Finish() conf.Finish()
Export('env') Export('env')
# Program start/end # Program start/end
env["CRTBEGIN"] = [ "#build/lib/libc/crti.o", "#build/lib/libc/crt1.o" ] env["CRTBEGIN"] = [ "#build/lib/libc/crti.o", "#build/lib/libc/crt1.o" ]
env["CRTEND"] = [ "#build/lib/libc/crtn.o" ] env["CRTEND"] = [ "#build/lib/libc/crtn.o" ]
@ -192,6 +197,8 @@ env["CXX"] = "c++"
env["LINK"] = "cc" env["LINK"] = "cc"
SConscript('sbin/newfs_o2fs/SConscript', variant_dir='build/tools/newfs_o2fs') SConscript('sbin/newfs_o2fs/SConscript', variant_dir='build/tools/newfs_o2fs')
env.CompilationDatabase()
# Install Targets # Install Targets
env.Install('$PREFIX/','build/sys/castor') env.Install('$PREFIX/','build/sys/castor')
env.Alias('install','$PREFIX') env.Alias('install','$PREFIX')