Add support for generating compile_commands.json
- Integrate premake-ecc module for generating compile_commands.json - Add .clangd config pointing to build/ directory - Add 'Generate compile_commands.json' task - Run compile_commands generation automatically on build
This commit is contained in:
35
build/ecc/_preload.lua
Normal file
35
build/ecc/_preload.lua
Normal file
@@ -0,0 +1,35 @@
|
||||
|
||||
local p = premake
|
||||
|
||||
newoption {
|
||||
trigger = "config",
|
||||
value = "CFG",
|
||||
description = "Select config for export compile_commands.json"
|
||||
}
|
||||
|
||||
newaction {
|
||||
trigger = "ecc",
|
||||
shortname = "Export compile commands",
|
||||
description = "Export compile_commands.json for language server",
|
||||
toolset = "gcc",
|
||||
|
||||
valid_kinds = { "ConsoleApp", "WindowedApp", "StaticLib", "SharedLib" },
|
||||
valid_languages = { "C", "C++" },
|
||||
valid_tools = {
|
||||
cc = { "clang", "gcc" }
|
||||
},
|
||||
|
||||
onStart = function()
|
||||
p.indent(" ")
|
||||
end,
|
||||
|
||||
execute = function()
|
||||
local dir = {}
|
||||
dir.location = _MAIN_SCRIPT_DIR
|
||||
p.generate(dir, "compile_commands.json", p.modules.ecc.generateFile)
|
||||
end
|
||||
}
|
||||
|
||||
return function(cfg)
|
||||
return (_ACTION == "ecc")
|
||||
end
|
||||
Reference in New Issue
Block a user