Example Custom Build Routines

The following sections describe different types of custom build routines suitable for use as custom build commands.

A custom build routine can contain any IDL code. The examples here focus on the process of ensuring that all routines necessary to run an application are compiled when a SAVE file is created. Build routines could also create other SAVE files (containing data, perhaps), move files to different locations, or any other operation IDL can perform.

Replicate the Default Behavior

Suppose you have a simple project containing three PRO files named one.pro, two.pro, and three.pro. To replicate the default behavior (when no custom build command is specified), you could create a batch file named build in the project directory and include the following commands:

.compile one 
.compile two 
.compile three 
RESOLVE_ALL 

The Use a custom build command property text box would contain the following:

@build 

Build an iTool Application

Creating an application that incorporates iTool functionality requires that you execute the IRESOLVE command, which in turn requires that you use a custom build command. Suppose you have created a custom iTool application, and want to create a build command to build the application automatically.

Create a batch file named build in the project directory. Include the following:

  1. Commands to compile all files in your project:
  2. .compile first_itool_file 
    .compile next_itool_file 
    ... 
    .compile last_itool_file 
    
  3. A call to the IRESOLVE routine:
  4. IRESOLVE 
    
  5. A command to resolve all referenced routines:
  6. RESOLVE_ALL 
    

The Use a custom build command property text box would contain the following:

@build 

Build Using the Run Command

In many cases, it is not necessary to manually compile every file in your project. If your application defines only procedures (no functions or object methods), or if you have used the idl2 compile option (set using the COMPILE_OPT routine) in all of your PRO files, you may be able to simply compile the routine that runs your application, then call RESOLVE_ALL to compile all other needed routines. Usually, this controlling routine is also the routine defined as the Run Command for your project.

Suppose you have an application consisting of many PRO files, all of which set

COMPILE_OPT idl2 

In addition, all functionality in your application is accessible via a single routine that launches the application. (In most cases, this routine would be the Run Command.) In this scenario, compiling the file that contains the Run Command and then calling RESOLVE_ALL will compile all required routines.

Create a batch file named build in the project directory. Include the following:

  1. A command to compile the routine that launches your application:
  2. .compile run_command 
    
  3. A command to resolve all referenced routines:
  4. RESOLVE_ALL 
    

The Use a custom build command property text box would contain the following:

@build