Wiki

Clone wiki

cosmosis / Build

Recommended practice when using an out-of-source build is to have two different shell sessions. In one shell, which we will call the source shell, you will do things related to manipulation of the source code: e.g. editing code and committing to the repository. In the second shell, which we will call the build shell, you'll be doing things related to building and running the code.

Setting up the source shell

In the source shell session, cd to the directory in which you have the CosmoSIS source code repository cloned. Unless you’ve done something unusual, this directory will be named cosmosis, and will contain a hidden subdirectory called .git.

We will call this directory the CosmoSIS source directory.

Setting up the build shell

In the build shell session, cd to a directory in which you want the files generated by the build to appear.

Step 1

Create your build directory. For example, create a new subdirectory under some scratch space, or under your home directory. Please do not put this directory anywhere in the source tree you are looking at in the source shell.

Step 2

source the script setup_for_dev.sh in the config subdirectory of the CosmoSIS source directory. For example, if your CosmoSIS source directory is $HOME/cosmosis, you should execute:

#!bash
$> source $HOME/cosmosis/config/setup_for_dev.sh $HOME/cosmosis
This will set several environment variables used by the build system.

Step 3

Next, create the scripts used to control the build. This is done with the following command:

#!bash
$> make -f ${COSMOSIS_DIR}/Makefile build
This will create a file named build, as well as some other directories and files. You will be using the build command as if it were make from now on.

Step 4

To build the CosmoSIS libraries and modules, use the following command:

#!bash
$> ./build -j
This will execute a parallel build, and run some self-contained tests Leave off the -j to do a serial build. The parallel build is faster, but if you are getting compilation, linking, or test errors, the outpt to the screen can become garbled. In that case, the serial build will produce ungarbled messages.

Updated