lf-lang / lingo

Package manager and build tool for the Lingua Franca coordination language
BSD 2-Clause "Simplified" License
4 stars 1 forks source link

What is the connection between BuildSystems and Backends #22

Open erlingrj opened 1 year ago

erlingrj commented 1 year ago

I am struggling a bit with the organization. Currently LFC appears as both code-generator and backend and build system. The distinction between the two latter is also not clear. What is really the meaning of backend and build-system in the context of lingo?

tanneberger commented 1 year ago

The notion in my head is that the combination of target language and specified build system tells lingo which build backend to use.

   (C, Zephyre) -> Zephyr
   (Python, Zephyre) -> Invalid
   (Cpp, Cmake) -> CppCmake
erlingrj commented 1 year ago

Hm, as far as I understand it, we have three different categories:

  1. Target Language (C, Cpp, Python)
  2. Target platform (macOS, Linux, Windows, Zephyr, FreeRTOS, Arduino, nrf52)
  3. Build tool (CMake, GNU Make, arduino-cli, west)

And a backend covers a certain combinations of Languages, Platforms and a single build tool:

E.g. CCMake covers: Language(C) and Platform(macOS, Windows, Linux, Zephyr, FreeRTOS) CWest covers: Language(C) and Platform(Zephyr)

I still feel there is some other, more obvious way of structuring it. Another important distinction is between native compilation and cross compilation

lhstrh commented 1 year ago

So, to make the list complete, we have:

  1. Target Language (C, Cpp, Python)
  2. Target platform (macOS, Linux, Windows, Zephyr, FreeRTOS, Arduino, nrf52)
  3. Build tool (CMake, GNU Make, arduino-cli, west)
  4. Build platform (macOS, Linux, Windows)

Yet, we don't specify the build platform, it is implied. So I'm not sure that we need to treat cross compilation specially. Whether the compiled code runs on the platform that it was compiled on doesn't really matter from a tooling perspective...does it?

tanneberger commented 1 year ago

@lhstrh The only problem with your summary is that 2.) and 4.) are overlapping. Or do I miss something ?

We have a platform we compile for and currently (MacOS, Linux and Windows) are currently summarized in the enum value Native. And Platforms like nrf52 are treated separately and directly depend on some build tools (west).

We have a lot of dependencies between our "build-layers"

(Languae, Target) -> Build Tool

  (Phyton, *) -> (Pip, Phython)
  (Cpp, Native) -> CMake
  (C, Native) -> CMake
  (C, Some Board) -> Arduino or West
  (Typescript, *) -> npm