Compilation with Visual C++

1. Introduction

The goal of this document is to describe the file organization used for the build tree with Visual C++ on Windows. The main sections of this document are: In the whole document, CIS is used as example but can be replaced by MRC or any other package name.

The source files are stored in a specific directory (source) and the compiled version in another directory (build). For the distribution, we also need to copy the headers files in the build directory. It is important to remember that the original header files from the source tree are used for the compilation of the library itself, CIS or MRC (this helps during the debug phase). The source directory is organized per module and the build directory contains the following sub-directories for the different binary versions:

2. File organization

2.a. Main directories (users and developers)

When you work with a package (either CIS or MRC), you have three important directories at the base of the file hierarchy:

2.b. mkProj

mkProj (stands for "make projects") needs to be compiled before anything else. Once the application is compiled, using the Visual-C++ project available for it (debug mode only), the user can start mkproj after leaving Visual-C++. By default, mkProj.exe is in visual-c++/mkproj and will load the configuration file visual-c++/mkproj/config/cis.txt. The GUI allows the user to load a different configuration file (e.g. mrc-2/visual-c++/mkproj/config/mrc.txt. Once the main configuration file is loaded, the user can add some options for the compiler or the linker and click on the "create projects" button.

mkProj can be configured using the text files in mkproj/config directory. The different fields of the configuration files can be modified with any text editor and include the list of source/header files, specific compiler/linker options and test programs. If one need more options, one can modified the source code of mkProj.

Some parts of CIS and MRC rely on proprietary packages which are not available to all programmers and users (e.g. Northern digital Optotrack for cisTracker, MEI dsp based controller card for mrcCard). For these, each user must provides some flags to specify some extra compiler flags (like include path) and linker flags (name of required library, path). The GUI allows to add simple options of the whole package. For more flexibility, one can modify the configuration files. All flags are directly used as is to create the projects, therefore the syntax is the one used in Visual C++. The following two files can be used as exemples: cisTracker.txt and cisCard.txt (note that the character # is used to preceed comments).

2.c. Project files

In the projects directory we have all projects and workspaces.

The file suffix is determined by Visual C++ (.dsp for project and .dsw for workspace). The basename of each project or workspace file should respect the following rules:

2.d Build files

The result of compilations as well as a copy of all header files is stored in the directory build. This directory is created during the compilation and should only contain automatically generated files.
To avoid mixing object files for dll's and static libraries, we have two directories: Lib and Dll.
In each of these directories, the names are Visual C++ defaults, i.e. Debug for files compiled in debug mode and Release for release files. These directories don't have to be created manually, Visual C++ will create them as needed.

Since all Dlls are in the same directory, it is easier to update your path to run applications based on Dll. Dll's are grouped in the build directory under visual-c++\build\Dll\Debug or visual-c++\build\Dll\Release.

The tree looks like this:
--+---- source (contains all code)
  |
  +---- unix (contains unix makefiles)
  |
  +--+- visual-c++
     |
     +--+- build (everything generated, binary distribution)
     |  |
     |  +---- include (copies of all headers)
     |  |
     |  +--+- Dll (dynamic libs ...)
     |  |  |
     |  |  +---- Debug (... for debug)
     |  |  |
     |  |  +---- Release (... for release)
     |  |
     |  +--+- Lib (static libs ...)
     |     |
     |     +---- Debug (... for debug)
     |     |
     |     +---- Release (... for release)
     |
     +--+- mkproj
     |  |
     |  +---- src (source code and project to compile mkProj)
     |  |
     |  +---- config (text configuration files used by mkProj)
     |  |
     |  +---- Debug/Release (files generated by Visual C++)
     |
     +---- projects (contains projects and workspaces, cisVecsDll.dsp)
     |
     +--+- tmp (temporary files for ...)
        |
        +--+- Dll (... dynamic libs ...)
        |  |
        |  +---- Debug (... for debug)
        |  |
        |  +---- Release (... for release)
        |
        +--+- Lib (... static libs ...)
           |
           +---- Debug (... for debug)
           |
           +---- Release (... for release)

As usual, each directory contains a sub directory CVS and PLEASE DO NOT delete, change or modify it..

3. How to compile

The first step is to compile mkProj. Go in cis-2/visual-c++/mkproj/src and open mkproj.dsw. In Visual C++, select the "build" option and quit. The executable should be cis-2/visual-c++/mkproj/mkproj.exe.

Using mkProj, we need to create the Visual C++ projects. To do so, start mkProj and: Once the projects and workspaces have been created, you have two solutions; Compile everything or compile a sub part you are interested in.

4. How to create a new project

To create a new VC++ project, you must first have the code in place in the source tree, i.e. in <PackageRoot>\source\<ModuleName>\include and <PackageRoot>\source\<ModuleName>\src (e.g. cis\source\cisVecs\include). The code itself should respect the programming guidelines.

Then, you will have to add the module name in the main configuration files (cis.txt or mrc.txt) and create a configuration file for the new module. There is no complete documentation of the configuration file syntax, thus the most practical way to create a configuration file is to start from and existing one.
Last modified: Fri Jun 21 17:23:43 Pacific Daylight Time 2002