CMT Tutorial Build Project

From CSDMS
Revision as of 17:26, 19 February 2018 by WikiSysop (talk | contribs) (Text replacement - "http://csdms.colorado.edu" to "https://csdms.colorado.edu")

CMT Tutorial: Build a CCA Project for CMT

This tutorial describes how checkout the latest version of the CSDMS CCA components, create a bocca project for CMT, and compile the project. At the end of this tutorial, the user will be able to see their new project within CMT and run its components.

Warning 32.png Before beginning, you will need to have loaded the necessary modules:

> module load git cmake
> module load csdms cca

The basic steps to building the project are:

  • Checkout the latest version of the CSDMS components
  • Create a bocca project containing the components
  • Compile the project
  • Commit changes to the repository

Checkout

The collection of CSDMS components is stored in a Subversion repository. For this tutorial we will be compiling just the components for the STM project rather than the entire collection.

> git-svn clone https://csdms.colorado.edu/svn/components -s stm

Create

Move to the source directory and create a directory that will contain the build.

  > cd stm
  > mkdir _build && cd _build

Use cmake to configure a makefile for the bocca project, and then build the project.

  > cmake .. -DBOCCA_PROJECT_NAME=cmt-stm

The -D option to cmake defines the name of the module for this project and is optional. This generates a makefile that is able to create a bocca project as well as some convenience files for setting your environment to use the new project,

  • cmt-stm: A modulefile that sets up your environment to use the project
  • set-env.sh: A shell script to configure your environment (if not using modules)

To set up your environment,

  > module load ./cmt-stm

Create the bocca project,

  > make stm

This make command uses bocca-build to create the bocca project based on the XML description contained in projects/stm.xml.

Compile

Now the bocca project is built but the project still needs to be configured and compiled.

  > cd csdms
  > ./configure
  > make

Check

Now that your project is built and compiled, it's a good idea to run a check to make sure everything's working fine. Before running the check, make sure that your environment is set up correctly. You can do this with the scripts generated by cmake. You can find these scripts in the top level of your build directory.

  > module load ./cmt-stm

Run the checks.

  > cd csdms
  > make check

Commit (Optional)

If you've made changes to the project and would like other users to see your changes in the repository, you will need to commit your local changes. First copy your changed files to the source directory that is under version control. This is done in the top-level build directory (_build, in our example) through make.

  > cd ..
  > make save

This uses bocca-save to copy all of the user-editable files from your project to the versioned source directory (src/csdms).

You now can commit your changes. How exactly you do this depends on what version control software you use (I'm using git-svn).

  > git commit <changed_file>
  > git-svn dcommit