Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [cdt-dev] The future of managed build


> On 21 Feb 2021, at 13:48, Jan Baeyens <jan@xxxxxxxxxx> wrote:
> 
> Early last year we had a discussion here about managed build and that it would be better to replace it. ...
> There were some iron's in the fire that were expected to get some results. ...
> However I do not recall any follow up on this.

I confirm that I plan no further work on the current managed build plug-ins.
 
At the same time I'm continuing work on a generic solution, independent on the Eclipse CDT.

It'll be neutral to the system build generator, and should work with CMake, meson, and my xPack builder.


The idea is simple, projects have build configurations, which have actions and properties.

The user selects the active build configuration (like debug/release), then the action (like build/clean/run/debug, etc).

The system build generators are expected to leave a compile_commands.json in the build folder, and the indexer will use it.


The build configurations are stored in package.json, and each build generator will have its own specific configurations in separate files (like CMakeLists.txt, meson.build, etc).

An example from a multi-platform project that should support both CMake and meson looks like this:

```
{

  "xpack": {
    "properties": {
      "buildWithCMmake": "cmake -S meta -B build/{{ configuration.name }} -GNinja -DCMAKE_TOOLCHAIN_FILE={{ configuration.properties.toolchainFilePath }} -DPLATFORM_NAME={{ configuration.properties.platformName }} -DCMAKE_BUILD_TYPE={{ configuration.properties.buildType }} && cmake --build build/{{ configuration.name }} --verbose",
      "cleanWithCMake": "cmake --build build/{{ configuration.name }} --target clean --verbose",
      "runWithQemu": "qemu-system-gnuarmeclipse --verbose --verbose --board {{ configuration.properties.qemuBoardName }} -d unimp,guest_errors --image build/{{ configuration.name }}/blinky.elf --semihosting-config enable=on,target=native"
    },
    "configurations": {
      "stm32f4discovery-cmake-debug": {
        "properties": {
          "buildType": "Debug",
          "platformName": "stm32f4discovery",
          "toolchainFilePath": "xpacks/micro-os-plus-build-helper/cmake/toolchain-arm-none-eabi-gcc.cmake",
          "qemuBoardName": "STM32F4-Discovery"
        },
        "actions": {
          "build": "{{ package.xpack.properties.buildWithCMake }}",
          "clean": "{{ package.xpack.properties.cleanWithCMake }}",
          "runWithQemu": "{{ package.xpack.properties.runWithQemu }} --nographic --semihosting-cmdline blinky 6",
          "runWithQemuGui": "{{ package.xpack.properties.runWithQemu }} --semihosting-cmdline blinky 6"
        }
      },
      "stm32f4discovery-cmake-release": {
        "properties": {
          "buildType": "MinSizeRel",
          "platformName": "stm32f4discovery",
          "toolchainFilePath": "xpacks/micro-os-plus-build-helper/cmake/toolchain-arm-none-eabi-gcc.cmake",
          "qemuBoardName": "STM32F4-Discovery"
        },
        "actions": {
          "build": "{{ package.xpack.properties.buildWithCMake }}",
          "clean": "{{ package.xpack.properties.cleanWithCMake }}",
          "runWithQemu": "{{ package.xpack.properties.runWithQemu }} --nographic --semihosting-cmdline blinky 6",
          "runWithQemuGui": "{{ package.xpack.properties.runWithQemu }} --semihosting-cmdline blinky 6"
        }
      },
      "stm32f0discovery-cmake-debug": {
        "properties": {
          "buildType": "Debug",
          "platformName": "stm32f0discovery",
          "toolchainFilePath": "xpacks/micro-os-plus-build-helper/cmake/toolchain-arm-none-eabi-gcc.cmake",
          "qemuBoardName": "STM32F0-Discovery"
        },
        "actions": {
          "build": "{{ package.xpack.properties.buildWithCMake }}",
          "clean": "{{ package.xpack.properties.cleanWithCMake }}",
          "runWithQemu": "{{ package.xpack.properties.runWithQemu }} --nographic --semihosting-cmdline blinky 6",
          "runWithQemuGui": "{{ package.xpack.properties.runWithQemu }} --semihosting-cmdline blinky 6"
        }
      },
      "stm32f0discovery-cmake-release": {
        "properties": {
          "buildType": "MinSizeRel",
          "platformName": "stm32f0discovery",
          "toolchainFilePath": "xpacks/micro-os-plus-build-helper/cmake/toolchain-arm-none-eabi-gcc.cmake",
          "qemuBoardName": "STM32F0-Discovery"
        },
        "actions": {
          "build": "{{ package.xpack.properties.buildWithCMake }}",
          "clean": "{{ package.xpack.properties.cleanWithCMake }}",
          "runWithQemu": "{{ package.xpack.properties.runWithQemu }} --nographic --semihosting-cmdline blinky 6",
          "runWithQemuGui": "{{ package.xpack.properties.runWithQemu }} --semihosting-cmdline blinky 6"
        }
      }
    }
  }
}

```

The substitutions syntax is from Shopify Liquid templates, also used in other parts of the project.

The actions can also be invoked from a command line, with commands like:

```
xpm run build --config stm32f4discovery-cmake-debug
```

---

I'm currently working on the command line versions of the tools, and on the project templates to create new blinky projects.

Once these will be functional (ETE 1-2 months) I plan to add a new build plug-in to Embedded CDT, and a VS Code extension, to support this mechanism.


If anyone is interested, please let me know.

Regards,

Liviu




Back to the top