summaryrefslogtreecommitdiff
path: root/lua/nvim-treesitter/shell_command_selectors.lua
diff options
context:
space:
mode:
authorJozef Grajciar <jozef.grajciar@gmail.com>2021-02-26 20:41:05 +0100
committerStephan Seitz <stephan.lauf@yahoo.de>2021-03-04 19:58:58 +0100
commitc7422dd25787f84dd1c8d7e7947664d4ab0fe2e6 (patch)
tree0baa41cc03abf920b7b507ab5d1484cd0ef43495 /lua/nvim-treesitter/shell_command_selectors.lua
parenta74da044a8c208177c0af56eeab709859e2fda38 (diff)
Add Windows support for cl.exe
Co-authored-by: Stephan Seitz <stephan.seitz@fau.de>
Diffstat (limited to 'lua/nvim-treesitter/shell_command_selectors.lua')
-rw-r--r--lua/nvim-treesitter/shell_command_selectors.lua45
1 files changed, 32 insertions, 13 deletions
diff --git a/lua/nvim-treesitter/shell_command_selectors.lua b/lua/nvim-treesitter/shell_command_selectors.lua
index 65d266fb..013169fb 100644
--- a/lua/nvim-treesitter/shell_command_selectors.lua
+++ b/lua/nvim-treesitter/shell_command_selectors.lua
@@ -53,20 +53,31 @@ function M.select_executable(executables)
return vim.tbl_filter(function(c) return c ~= vim.NIL and fn.executable(c) == 1 end, executables)[1]
end
-function M.select_compiler_args(repo)
- local args = {
- '-o',
- 'parser.so',
- '-I./src',
- repo.files,
- '-shared',
- '-Os',
- '-lstdc++',
- }
- if fn.has('win32') == 0 then
- table.insert(args, '-fPIC')
+function M.select_compiler_args(repo, compiler)
+ if (string.match(compiler, 'cl$') or string.match(compiler, 'cl.exe$')) then
+ return {
+ '/Fe:',
+ 'parser.so',
+ '/Isrc',
+ repo.files,
+ '-Os',
+ '/LD',
+ }
+ else
+ local args = {
+ '-o',
+ 'parser.so',
+ '-I./src',
+ repo.files,
+ '-shared',
+ '-Os',
+ '-lstdc++',
+ }
+ if fn.has('win32') == 0 then
+ table.insert(args, '-fPIC')
+ end
+ return args
end
- return args
end
function M.select_install_rm_cmd(cache_folder, project_name)
@@ -179,4 +190,12 @@ function M.select_download_commands(repo, project_name, cache_folder, revision)
end
end
+function M.make_directory_change_for_command(dir, command)
+ if fn.has('win32') == 1 then
+ return string.format("pushd %s & %s & popd", dir, command)
+ else
+ return string.format("cd %s;\n %s", dir, command)
+ end
+end
+
return M