Software/Geant4/Installation/CMake

From PBTWiki
Jump to navigation Jump to search

Introduction

CMake is an open-source, cross-platform family of tools designed to build, test and package software. CMake is used to control the software compilation process using simple platform and compiler independent configuration files, and generate native makefiles and workspaces that can be used in the compiler environment of your choice..

For Geant4, CMake is used to control the installation process through the generation of CMake makefiles.

Details

Website
https://cmake.org/
Source URL
https://cmake.org/files/v3.5/
Installed Production version
3.5.2 (16 April 2016)
Source code
src/geant4-prerequisites/cmake/cmake-3.5.2-Linux-x86_64.tar.gz
Installed Development version
3.9.4 (20 October 2017)
Central Repository
https://gitlab.kitware.com/cmake/cmake

Installation Notes

Geant4 requires CMake 3.3 or higher.

Installation from Central Repository

The latest version of CMake can be downloaded from its central repository, https://gitlab.kitware.com/cmake/cmake. Once downloaded, a simple bootstrap installation can be used to install the software as outlined below.

Installation using precompiled binaries

Unlike most of the other Geant4 prerequisites, CMake comes as precompiled binaries downloaded directly from https://cmake.org/download/ . There are versions available for myriad operating systems, including 32-bit and 64-bit Linux. These instructions show the latter since the UCL HEP Cluster runs 64-bit Scientific Linux.

There are a number of different Zip archive formats available: any of these can be downloaded and extracted into the appropriate location in /unix/pbt/software/src (see instructions below).

Once unpacked, the files need only be moved into the correct target directory. Although files can be moved by hand for the Production environment, it is recommended to use the dev2prod.sh script as part of the automated copying process. Instructions for the former, however, are given below.

Installation

When downloading software, the downloaded tarball (or other Zip archive) should be placed in an appropriately named directory in /unix/pbt/software/src: the instructions below assume that the directory is /unix/pbt/software/src/cmake.

Installation from central repository

After the latest version (here v3.9.4) has been pulled from the central repository, create a directory within the build section of the PBT Software directory from which you can compile CMake:

cd /unix/pbt/software/build/
mkdir cmake-3.9.4
cd cmake-3.9.4

A simple bootstrap installation is then used to install CMake within the development section of the PBT Software cluster. Note: The --prefix option defines the installation prefix, i.e. where the software will be installed. In this case, the software is installed to /unix/pbt/software/dev/cmake-3.9.4/.

../../../src/cmake/bootstrap --prefix=/unix/pbt/software/dev/cmake-3.9.4/
make
make install

Installation from precompiled binaries

Source Code Extraction

cd /unix/pbt/software/src/geant4-prerequisites/cmake
tar -xvz -f cmake-3.5.2-Linux-x86_64.tar.gz

Build And Install

Although it is discouraged to copy the CMake binaries from the Development to the Production directory — this should be handled by the dev2prod.sh script — instructions for doing so are given below.

Development Environment
cd /unix/pbt/software/src/geant4-prerequisites/cmake
mv -v cmake-3.5.2-Linux-x86_64 /unix/pbt/software/dev/cmake-3.5.2
Production Environment
cd /unix/pbt/software/dev/
cp -av cmake-3.5.2/* /unix/pbt/software/prod/