Home    Product Info    Orders    Downloads    About Us    Contact Us


 

Appendix E: Visual C++ Integration

General Integration Information
Integrating with Visual C++ 4.x and 5.x
Integrating with Visual C++ 2.x

 

Microsoft Visual C++ (VC++) is an integrated development environment (IDE) with its own project building capability. Because of limitations in that environment or because you want to use Make in the VC++ IDE as well as from the command line we describe here how to integrate Make with VC++.

First and foremost, we note that it is not possible to invoke directly Make from the VC++ "Build" menu and instead you must use the "Tools" menu. This is the only major limitation to using Make from inside of the VC++ IDE. A minor limitation to using Make is that we don’t automatically give you a way to build subsystems of your project — you can only build "debug" or "release" versions of your whole project. Of course, you can extend our integration by adding Tool menu items to build specific subsystems.

VC++ 2.x has another annoyance to deal with, which is covered in Section E.3, below.

E.1 Integrating Opus Make

Make can run VC++ project makefiles (which are NMAKE makefiles) without modification by the use of the "–EN" command-line switch.

To take full advantage of Opus Make features it is best to convert the VC++ project makefile into an Opus Make makefile. We supply the vc2opus utility to perform this conversion, which occurs automatically whenever the VC++ project makefile changes. This automatic conversion uses the following the files:

makefile A "wrapper" makefile around proj.omk, detailed next. This wrapper is created by vc2opus in the VC++ project directory from vc2opus.stb, a "stub" makefile you can modify. We use the name "makefile" so you don’t need to specify a makefile name on the Opus Make command line.
proj.omk An Opus Make makefile created in the VC++ project directory from proj.mak, the VC++ project makefile. The proj.omk file is included from makefile after certain macros have been set
vc2opus.ini An initialization file kept in the Opus installation directory and included from makefile before proj.omk is included. This initialization file can be used to set up the compiler environment.
make.ini The initialization file kept in the Opus installation directory. This file is used to ensure proj.omk is up to date. This file must be editted to enable VC++ support. See point 1. on the next page.

 

.

E.2 Integrating with Visual C++ 4.x and 5.x

Setting up the Files

You must perform the following steps:

  1. Enable automatic update of proj.omk by setting the _VCVer macro in make.ini.
  2. Edit the %setenv commands in vc2opus.ini that initialize the PATH, INCLUDE, LIB and TEMP environment variables. The INCLUDE and LIB variables must match the values in VC++ Tools Menu / Options... / Directories Tab / Show Directories for: Include files and for: Library files.

For VC++ 5.x only:

  1. Tell VC++ 5.x to create a makefile (which it normally does not do). Do one of:
  • Check the Tools Menu / Options... / Build Tab / Export makefile when saving project file box.
  • Use the Project Menu / Export Makefile item to export manually the makefile.

Setting up the Tools Menu

For VC++ 4.x, for each Tool item to be added, do the following:

  1. Choose Tools Menu / Customize...
  2. Choose Tools Tab
  3. Click Add... In the Command field add the full path name to the Opus Make executable (e.g. e:\opus\nti\make.exe). Click OK
  4. Modify Menu Text (see below for details).
  5. Modify Arguments (see below for details)
  6. Modify Initial Directory, selecting the "Workspace Directory" from the menu.
  7. Check Redirect to Output Window
  8. Click Close

For VC++ 5.x, for each Tool item to be added, do the following:

  1. Choose Tools Menu / Customize...
  2. Choose Tools Tab
  3. Click New icon at the right of the Menu contents bar.
  4. In the newly-opened dialog, add the menu text (see below for details) and hit Enter.
  5. In the Command field add the full path name to the Opus Make executable (e.g. e:\opus\nti\make.exe).
  6. Modify Arguments as shown in the table below.
  7. In the Initial Directory field, select the "Workspace Directory" from the menu.
  8. Check Use Output Window.
  9. Click Close.

Repeat the above steps once for each Tool item. We suggest the following items:

Desired Action

Menu Text

Arguments

Make the default target &OMake _VCDir=$(TargetDir)
Clean the directory OMake &clean _VCDir=$(TargetDir) clean
Make all targets OMake &all _VCDir=$(TargetDir) –a

Note: The _VCDir command-line macro is used in the makefile to define a configuation macro, letting Make know you are building the main "debug" or "release" configuration. To build a particular subsystem you must instead define the CFG command-line macro. Here’s an example Tool menu item using CFG:

Desired Action

Menu Text

Arguments

Make debug IOLIB OMake &iolib CFG="IOLib - Win32 Debug"

To find out all configuration strings, use the MS-DOS shell, change directory to the project directory and execute "make –n CFG=x".

Optional Shortcut Keys

Add a shortcut key to call Opus Make by doing the following:

  1. Choose Tools / Customize...
  2. Choose Keyboard Tab
  3. Select Categories: Tools
  4. Select Commands: UserTool<N>, where <N> is the numerical position of the "OMake" command in Tools / Customize... / Tools Tab / Menu Contents.
  5. Select Press New Shortcut Key:
  6. Press the key (egs: shift+f8, ctrl+shift+m).
  7. Click Assign.

For VC++ 4.x, if you’ve picked shift+f8 for Opus Make’s shortcut key you need to remove the current binding of the shortcut key to the Project menu build:

  1. Choose Tools / Customize...
  2. Choose Keyboard Tab
  3. Select Categories: Project
  4. Select Commands: ProjectBuild
  5. Select Current Keys: Shift+F8
  6. Click Remove.

E.3 Integrating with Visual C++ 2.x

Set up for using VC++ 2.x as you would for VC++ 4.x except for one thing: when adding Tools menu items there is no need to set the Initial Directory field.

Using Make with VC++ 2.x is the same as using it with VC++ 4.x with one major exception: VC++ 2.x does not update the project makefile properly before Tool menu items are executed. This means you need to force VC++ 2.x to update the project makefile whenever you change C++ command-line defines or flags or when you add and remove files from the project.

Forcing an update of the project makefile is simple, but requires the following steps:

  1. Choose File / New... In the "New" dialog click "Project" then click OK.
  2. In the "Do you want to close all document windows" dialog, click No.
  3. In the "New Project" dialog, click Cancel.

E.4 Make from the Command Line

You can use Make to build VC++ projects from the MS-DOS command prompt. Simply change into the directory of the VC++ project and execute "make debug" or "make release" to build the full debug or full release version. You can also build subsystems with "make "CFG=config"", where config is a VC++ project configuration string. To find out all configuration strings execute "make –n CFG=x".


Home    Product Info    Orders    Downloads    About Us    Contact Us

Opus Software, Inc. 1032 Irving Street, Suite 439 San Francisco, CA 94122 USA
Phone: 415-485-9703 Fax: 415-485-9704 Email:
biz@opussoftware.com