Creating a simple application using CMT
You have seen many packages, and now you want to create your own simple
application that uses CMT to handle the compilation. What do you do?
Here is a simple example, where our application is so simple - it does not
even use Gaudi.
Windows
- In VCMT, click the new button to create a new package.
You will have to fill in a name for the new package and assign a
version. v0 is the typical choice. Finally, choose a directory
in which to create this new package. For this example, we will call
the new package, myNewPackage.
- The new package name, myNewPackage, should appear in the package
list. Highlight myNewPackage in the package list.
- Now click the requirements button to view the empty requirements file.
- Fill in the requirements file, here is an example:
package myNewPackage
version v0
# We use GlastPolicy to set up the appropriate compiler settings.
use GlastPolicy
ignore_pattern RuleChecker
application myTestApp myMain.cxx
- Our application is named, myTestApp, and has just one source file,
myMain.cxx, which contains our main program. Note that by default, all
source files are assumed to be in the myNewPackage/v0/src directory.
If you desire to store your some or all files elsewhere, you must provide a
path to locate it.
- Create the myMain.cxx file, if you does not exist already. Here is a
simple example:
#include <iostream>
int main( int argn, char** argc) {
std::cout << "We are in the main!" << std::endl;
return 0;
}
- Back in VCMT, click the setup button.
- Now choose the myTestApp in the project drop-down list.
- Click build.
- Now you can run your application by clicking the run
button.
Linux
- Use CMT to create a new package. Within one of your glastpack
created directories do:
cmt create myNewPackage v0
- Now edit the myNewPackage/v0/cmt/requirements file. Here is an
example:
package myNewPackage
version v0
# We use GlastPolicy to set up the appropriate compiler settings.
use GlastPolicy
ignore_pattern RuleChecker
application myTestApp myMain.cxx
- The above requirements file creates an application called myTestApp which
uses just one source file called myMain.cxx. Note that CMT assumes all
source files are located in the myNewPackage/v0/src directory. If you
desire to have some or all files located elsewhere, you will have to supply
a full path along with the file names.
- Now create the myMain.cxx file, here is a simple example:
#include <iostream>
int main( int argn, char** argc) {
std::cout << "We are in the main!" << std::endl;
return 0;
}
- Now you can use glastpack to compile the new package as you would any
other package.
glastpack.pl login
glastpack.pl build myNewPackage v0
glastpack.pl run myNewPackage v0 myTestApp.exe
Back to SAS How To
H. Kelly Last Modified: 2004-08-04 15:39:16 -0700