CMT Tutorial Build Project: Difference between revisions

From CSDMS
m (Text replacement - "http://csdms.colorado.edu" to "https://csdms.colorado.edu")
(Redirect to pymt page)
Tag: Replaced
 
Line 1: Line 1:
__NOTOC__
__NOTOC__
= CMT Tutorial: Build a CCA Project for CMT =
[[Image:Alert-yellow.png | center | 50px | Out-of-date page ]]
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.
This page is out of date.
{{Alert Box|message=Before beginning, you will need to have loaded the necessary modules:
Please see the
<tt>
[[PyMT]]
:> module load git cmake
page for information on the Python Modeling Toolkit,
:> module load csdms cca
the successor to CMT.
</tt>
}}
 
The basic steps to building the project are:
* [[CMT_Tutorial_Build_Project|Checkout]] the latest version of the CSDMS components
* [[CMT_Tutorial_Build_Project|Create]] a bocca project containing the components
* [[CMT_Tutorial_Build_Project|Compile]] the project
* [[CMT_Tutorial_Build_Project|Commit]] changes to the repository
 
== Checkout ==
The collection of CSDMS components is stored in a [https://csdms.colorado.edu/viewvc/components/ Subversion repository].  For this tutorial we will be compiling just the components for the STM project rather than the entire collection.
<syntaxhighlight lang=bash>
> git-svn clone https://csdms.colorado.edu/svn/components -s stm
</syntaxhighlight>
 
== Create ==
Move to the source directory and create a directory that will contain the build.
<syntaxhighlight lang=bash>
  > cd stm
  > mkdir _build && cd _build
</syntaxhighlight>
 
Use cmake to configure a makefile for the bocca project, and then build the project.
<syntaxhighlight lang=bash>
  > cmake .. -DBOCCA_PROJECT_NAME=cmt-stm
</syntaxhighlight>
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,
<syntaxhighlight lang=bash>
  > module load ./cmt-stm
</syntaxhighlight>
 
Create the bocca project,
<syntaxhighlight lang=bash>
  > make stm
</syntaxhighlight>
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.
<syntaxhighlight lang=bash>
  > cd csdms
  > ./configure
  > make
</syntaxhighlight>
 
== 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.
<syntaxhighlight lang=bash>
  > module load ./cmt-stm
</syntaxhighlight>
 
Run the checks.
<syntaxhighlight lang=bash>
  > cd csdms
  > make check
</syntaxhighlight>
 
== 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.
<syntaxhighlight lang=bash>
  > cd ..
  > make save
</syntaxhighlight>
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).
<syntaxhighlight lang=bash>
  > git commit <changed_file>
  > git-svn dcommit
</syntaxhighlight>

Latest revision as of 15:17, 14 March 2020

Out-of-date page

This page is out of date. Please see the PyMT page for information on the Python Modeling Toolkit, the successor to CMT.