Programmatically Build Applications in LabVIEW
Overview
|
This example shows how to batch build several distributions in LabVIEW using a programmatic build process.
Downloads
Filename: programmaticbuild2.vi
Requirements: View
Introduction
Many applications require frequent compilation into an executable (.exe) or a dynamic link library (.dll). An application might require building the source code into an executable every night or every ten minutes. Prior to LabVIEW 8.0 the application builder required the creation of a unique *.bld file to correspond to every configuration your application required. You could then call that file from a batch file.
When the LabVIEW project was introduced in LabVIEW 8.0, build specifications were integrated into the project. To provide the previous capability of batch compilation, LabVIEW now provides a VI called BuildTargetBuildSpecification.vi that programmatically builds a distribution using a predefined build specification. This example shows how to use that feature to batch build applications from the command line. This enables you to build applications from a task automation program such as Windows Task Scheduler.
Details of the example
The example programmaticbuild.vi shows how to programmatically build several projects using command line arguments. Using the BuildTargetBuildSpecification.vi (which is packaged with the LabVIEW Application Builder), this example simply iterates through the command line arguments and uses BuildTargetBuildSpecification.vi as a subVI to build projects according to their specified build specifications. Any LabVIEW version 8.0 or later with Application Builder installed has this function available in <LabVIEW directory>\vi.lib\AppBuilder.
To run this example, open a command line window. Browse to the LabVIEW directory, and enter the following line in the command line window:
labview.exe “<Location of programmaticbuild.vi>” -- “<Project 1>.lvproj” “<Project 2>.lvproj” “<Project 3>.lvproj” <…> “<Project n>.lvproj”
This example is configured to run automatically when the VI opens so that the projects can be built from the command line window. You can implement this process into any batch processing system that is set up (such as Windows Task Scheduler) by configuring the batch program to call labview.exe with the previous arguments.
This example include a built-in error logger that writes the file error_log.txt to the temporary directory specified in the Options dialog box. This log displays information about the build process. Select Tools»Options to display the Options dialog box, and select Paths from the Category list to configure the temporary directory. You can edit the build process used in this example. Additionally, the example contains a sequence structure that closes LabVIEW when the VI finishes executing, depending on the value of the Boolean constant.
Requirements
Filename: programmaticbuild2.vi
Software Requirements
Application Software: LabVIEW Base Development System 8.0
Toolkits and Add-Ons: LabVIEW Application Builder 1.0
Reader Comments | Submit a comment »
Write text file fails in programmicbuild2.vi
There is a programming mistake in this
VI: The close file operation needs to be
moved outside the for-loop to make the
write of status to textfile work.
- Mikkel Bie, Deductor ApS. mb@deductor.dk - Mar 13, 2009
Small Problem
I ran into a small problem using this VI. It
closes the file reference in between
each iteration of the command line
argument loop. I fixed this problem by
moving the file close to outside of the
loop. After the fix, it became a useful
utility.
I am running a Windows XP machine
with LabVIEW 8.5. It may operate
differently on another system.
- adam.q.shumac@lmco.com - Jan 15, 2009
Legal
This example program (this "program") was developed by a National Instruments ("NI") Applications Engineer. Although technical support of this program may be made available by National Instruments, this program may not be completely tested and verified, and NI does not guarantee its quality in any way or that NI will continue to support this program with each new revision of related products and drivers. THIS EXAMPLE PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND AND SUBJECT TO CERTAIN RESTRICTIONS AS MORE SPECIFICALLY SET FORTH IN NI.COM'S TERMS OF USE (http://ni.com/legal/termsofuse/unitedstates/us/).

