From 36dc77dc433d3c2c341f56f212ceb1d0047e9969 Mon Sep 17 00:00:00 2001 From: Viet-Hoa Do Date: Fri, 3 Mar 2023 10:44:58 +0000 Subject: Add exporting compile_commands.json file * Add an option in scons script to export compile_commands.json file to support development using language server. * Add .cache directory to the git ignore list. It is normally used by clangd as the local cache. Resolves: COMPMID-5940 Signed-off-by: Viet-Hoa Do Change-Id: I8c2a1ac85942d34ada22adea3e7de2baf2189eb2 Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/9258 Benchmark: Arm Jenkins Tested-by: Arm Jenkins Reviewed-by: Jakub Sujak Comments-Addressed: Arm Jenkins --- SConstruct | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'SConstruct') diff --git a/SConstruct b/SConstruct index ca53246834..2e20931552 100644 --- a/SConstruct +++ b/SConstruct @@ -140,6 +140,9 @@ vars.AddVariables( ("build_config", "Operator/Data-type/Data-layout configuration to use for tailored ComputeLibrary builds. Can be a JSON file or a JSON formatted string", "") ) +if version_at_least(SCons.__version__, "4.0"): + vars.Add(BoolVariable("export_compile_commands", "Export compile_commands.json file.", False)) + env = Environment(variables=vars, ENV = os.environ) @@ -181,6 +184,11 @@ Export('install_bin') Help(vars.GenerateHelpText(env)) +# Export compile_commands.json file +if env.get("export_compile_commands", False): + env.Tool("compilation_db") + env.CompilationDatabase("%s/compile_commands.json" % build_path) + if 'armv7a' in env['arch'] and env['os'] == 'android': print("WARNING: armv7a on Android is no longer maintained") -- cgit v1.2.1