How to compile VIs for different targets with compile flags in LabVIEW?

338 views Asked by At

I have five RT targets that run almost equal code. I don't want to copy the VIs around to every target. Obviously because I don't want to recopy everything when changes happen. My prefered way would be that I write one VI with some conditional disable or case structures where the desicion whether it's enabled or not should be made with a build file/script.

To achive the case switching I'd like to define string constants in a build script and the dead code elemination should remove the unused cases after compilation.

What are the right tools to achive that? And how would you combine that with CI?

1

There are 1 answers

0
Yair On

There's no API today to do this from the build, but I would suggest that a conditional disable structure is what you want. There are some ideas on the LV idea exchange requesting this functionality.

Some options:

  1. I believe you can set the condition value per-target, so you can have one target for each build and set a different value for each target. Or you could have multiple projects and have a different value for each project.
  2. The CDS should have a target condition. I'm not sure how detailed you can make that condition, because I rarely work with targets.
  3. While there's no proper API, you can call a pre-build VI and set the condition's value in the project/target programmatically using a tag. Haven't done this myself, but there are examples here and here.
  4. I'm not sure how this would work with CI, as I don't do automated builds. I'm guessing once it's part of the build spec, it will simply be executed when you call the build spec.