From 53161c2c956b200d3f20fd4dbcee0345d275d74d Mon Sep 17 00:00:00 2001 From: Ali Mashtizadeh Date: Tue, 22 Aug 2023 18:03:24 -0400 Subject: [PATCH] Improve SConstruct file to improve compatability and expose the compiledb. --- SConstruct | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/SConstruct b/SConstruct index c03de2a..c2873bc 100644 --- a/SConstruct +++ b/SConstruct @@ -26,7 +26,7 @@ opts.AddVariables( ) env = Environment(options = opts, - tools = ['default'], + tools = ['default', 'compilation_db'], ENV = os.environ) Help(opts.GenerateHelpText(env)) @@ -55,12 +55,11 @@ if 'LDFLAGS' in os.environ: #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" ]) +env.Append(CPPFLAGS = [ "-fno-builtin", "-fno-stack-protector" ]) if env["WITH_GPROF"] == "1": env.Append(CPPFLAGS = [ "-pg" ]) @@ -153,10 +152,16 @@ if not conf.CheckCXX(): print('Your C++ compiler and/or environment is incorrectly configured.') CheckFailed() +if not env["CCVERSION"].startswith("15."): + print('Only Clang 15 is supported') + print('You are running: ' + env["CCVERSION"]) + CheckFailed() + conf.Finish() Export('env') + # Program start/end env["CRTBEGIN"] = [ "#build/lib/libc/crti.o", "#build/lib/libc/crt1.o" ] env["CRTEND"] = [ "#build/lib/libc/crtn.o" ] @@ -192,6 +197,8 @@ env["CXX"] = "c++" env["LINK"] = "cc" SConscript('sbin/newfs_o2fs/SConscript', variant_dir='build/tools/newfs_o2fs') +env.CompilationDatabase() + # Install Targets env.Install('$PREFIX/','build/sys/castor') env.Alias('install','$PREFIX')