===== Data Processing School :: Exercise cr0 =====
^ Source directory | /data/lofarschool/data/Exercise-CR |
^ Contact person | Andreas Horneffer, Lars Bähren |
==== Context ====
This is "just" the setup for the following CR exercises. \\
At the same time this should serve as a first exposition to the configuration/build system used by the User Software Group -- when expanding upon the existing code base, this will be the environment to work within.
==== Prerequisite ====
* Installed USG software (CR-Tools package)
* cmake in your PATH; if you are using ''tcsh'' as your shell, then source /app/scripts/doUSG
will do the trick.
==== Description ====
Use a simple "build environment" with CMake to compile and build the exercise tools.
==== Files & Directories ====
/data/lofarschool/data/Exercise-CR
|-- build
|-- 2006.02.23.04:02:50.283.event
`-- src
|-- CMakeLists.txt
|-- Exercise-CR1.cc
|-- Exercise-CR2.cc
`-- Exercise-CR3.cc
In this ''CMakeLists.txt'' is the input file used by cmake to configure the project. The directory ''src'' holds the source code of everything we want to compile into an executable binary and will remain untouched. The build itself is performed out-of-source from within the directory ''build''; the main advantage of this is, that the staging area non-identical to the area where all the source code is located -- therefore in order to redo everything from scratch a complete removal of everything within ''build'' is possible, without affecting the original code.
==== Step-by-step instructions ====
- Copy the ''src'' and ''build'' directories to your local directory:
cp /data/lofarschool/data/Exercise-CR/src .
cp /data/lofarschool/data/Exercise-CR/build .
- Change into the ''build'' directory:
cd build
- Run //CMake// in order to configure your project build:
cmake ../src
That should end with the lines:
-- Configuring done
-- Generating done
-- Build files have been written to: ...
- Run //make// to compile the executables:
make
You should see something like this:
Scanning dependencies of target exercise_cr1
[ 33%] Building CXX object CMakeFiles/exercise_cr1.dir/Exercise-CR1.cc.o
Linking CXX executable exercise_cr1
[ 33%] Built target exercise_cr1
Scanning dependencies of target exercise_cr2
[ 66%] Building CXX object CMakeFiles/exercise_cr2.dir/Exercise-CR2.cc.o
Linking CXX executable exercise_cr2
[ 66%] Built target exercise_cr2
Scanning dependencies of target exercise_cr3
[100%] Building CXX object CMakeFiles/exercise_cr3.dir/Exercise-CR3.cc.o
Linking CXX executable exercise_cr3
[100%] Built target exercise_cr3
Elapsed: 0:25.39 - CPU: 20.197u+2.924s = 91.0%
==== Example outputs ====
//Nothing here//
==== Bug Reports ====
* If you get the error message, that ''cmake'' is not found, then add ''/usr/local/bin'' to your ''PATH''. (You are probably using bash...)
export PATH=$PATH:/usr/local/bin
//If you are experiencing trouble getting the exercise to work, this is the place to leave a note about it.//