Search code examples
vimcmakeiarlanguage-server-protocol

How to convert IAR .ewp to LSP compile_commands.json database


I am on the quest of creating a compile_commands.json database from my IAR .ewp project. This would allow me to use intelligent LSP autocompletion (ccls) and proper semantic highlighting (vim-lsp-cxx-highlight) from my vim setup.

I understand that I could manually create a CMake file with the same setup as in the .ewp project file, but unfortunately all my co-workers use the IAR IDE. I would risk missing some important project setup changes made by my co-workers and me failing to update the .ewp. It'd be great if I could automatically parse the .ewp file to CMake, and hence create the commands database.

Anybody knows of a clever way of doing this? If not, how would I go creating a tool that does exactly that? It appears that by undefining the Clang compiler defines one could make ccls use of the IAR code-base at full strenght.


Solution

  • Use -jsondb option in IAR

    > iarbuild.exe example.ewp -jsondb debug -output compile_commands.json