diff options
| author | Stephan Seitz <stephan.seitz@fau.de> | 2021-09-09 22:11:07 +0200 |
|---|---|---|
| committer | Stephan Seitz <stephan.seitz@fau.de> | 2022-01-23 16:27:25 +0100 |
| commit | a37c97545f23eef90f833be634ef1f3db93af0ca (patch) | |
| tree | 4d38a265f9702a958c5c63417229fab692c129dd /lua/nvim-treesitter/shell_command_selectors.lua | |
| parent | 045cb86d44d82aa050d70535c687e4d0bc2048f5 (diff) | |
Allow compilation via makefile
Diffstat (limited to 'lua/nvim-treesitter/shell_command_selectors.lua')
| -rw-r--r-- | lua/nvim-treesitter/shell_command_selectors.lua | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/lua/nvim-treesitter/shell_command_selectors.lua b/lua/nvim-treesitter/shell_command_selectors.lua index ee784312..fb322e01 100644 --- a/lua/nvim-treesitter/shell_command_selectors.lua +++ b/lua/nvim-treesitter/shell_command_selectors.lua @@ -93,6 +93,30 @@ function M.select_compiler_args(repo, compiler) end end +function M.select_compile_command(repo, cc, compile_location) + if string.match(cc, "cl$") or string.match(cc, "cl.exe$") or not repo.use_makefile then + return { + cmd = cc, + info = "Compiling...", + err = "Error during compilation", + opts = { + args = vim.tbl_flatten(M.select_compiler_args(repo, cc)), + cwd = compile_location, + }, + } + else + return { + cmd = "make", + info = "Compiling...", + err = "Error during compilation", + opts = { + args = { "--makefile=" .. utils.join_path(utils.get_package_path(), "scripts", "compile_parsers.makefile"), "CC=" .. cc }, + cwd = compile_location, + }, + } + end +end + function M.select_install_rm_cmd(cache_folder, project_name) if fn.has "win32" == 1 then local dir = cache_folder .. "\\" .. project_name |
