Skip to content

Commit

Permalink
Merge pull request #496 from willfurnass/ENH_sharc_cmake
Browse files Browse the repository at this point in the history
ShARC: cmake 3.7.1 (built with gcc 4.9.4)
  • Loading branch information
willfurnass authored Dec 14, 2016
2 parents dc0046d + 5f366f8 commit f2d3c0d
Show file tree
Hide file tree
Showing 4 changed files with 144 additions and 4 deletions.
19 changes: 15 additions & 4 deletions iceberg/software/compilers/cmake.rst
Original file line number Diff line number Diff line change
@@ -1,16 +1,21 @@
.. _cmake_iceberg:

CMake
=====

CMake is a build tool commonly used when compiling other libraries.

CMake is installed in `/usr/local/packages6/cmake`.

Usage
-----

CMake can be loaded with::
CMake can be loaded with: ::

module load compilers/cmake/3.3.0

module load compilers/cmake
Usage often involves:

1. Creating and ``cd``-ing into a dedicated build directory within a source tree then
2. Running something like ``cmake -DSOME_OPTION -DANOTHER_OPTION ..``

Installation
------------
Expand All @@ -25,3 +30,9 @@ Run the following commands::
gmake -j8

gmake install

Module file: ::

module-whatis loads the necessary `cmake-3.3.0' library paths
prepend-path PATH /usr/local/packages6/cmake/3.3.0/bin
prepend-path MANPATH /usr/local/packages6/cmake/3.3.0/man
30 changes: 30 additions & 0 deletions sharc/software/development/cmake.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
.. _cmake_sharc:

CMake
=====

CMake is a build tool commonly used when compiling other libraries.

Usage
-----

CMake can be loaded with: ::

module load dev/cmake/3.7.1/gcc-4.9.4

NB CMake has a run-time dependency on `libstdc++` so the above also needs to
(and does) load the :ref:`GCC compiler <gcc_sharc>` version 4.9.4.

Usage often involves:

1. Creating and ``cd``-ing into a dedicated build directory within a source tree then
2. Running something like ``cmake -DSOME_OPTION -DANOTHER_OPTION ..``

Installation
------------

Version 3.7.1
^^^^^^^^^^^^^

1. Install using :download:`this script </sharc/software/install_scripts/dev/cmake/3.7.1/gcc-4.9.4/install.sh>`
2. Install :download:`this modulefile </sharc/software/modulefiles/dev/cmake/3.7.1/gcc-4.9.4>` as ``/usr/local/modulefiles/dev/cmake/3.7.1/gcc-4.9.4``
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
#!/bin/bash
# Install script used to install cmake 3.7.1 on ShARC

################################################################################
# Error handling
################################################################################
handle_error () {
errcode=$?
echo "Error code: $errorcode"
echo "Error cmd: " echo "$BASH_COMMAND"
echo "Error line: ${BASH_LINENO[0]}"
exit $errcode
}
trap handle_error ERR

################################################################################
# Set variables
################################################################################
SHORT_VERS=3.7
VERS="${SHORT_VERS}.1"
COMPILER=gcc
COMPILER_VERS=4.9.4

TARBALL_URL="https://cmake.org/files/v${SHORT_VERS}/cmake-${VERS}.tar.gz"

TMPDIR="${TMPDIR:-/tmp}"
BUILD_DIR="${TMPDIR}/${USER}/cmake/${VERS}/"

PREFIX="/usr/local/packages/dev/cmake/${VERS}/${COMPILER}-${COMPILER_VERS}"

export OMP_NUM_THREADS=16

################################################################################
# Load modules
################################################################################
# Enable a compiler
module load dev/${COMPILER}/${COMPILER_VERS}

# Enable sphinx (for building cmake's man pages)
module load apps/python/anaconda3-4.2.0

################################################################################
# Create directories and download + unpack tarball
################################################################################
mkdir -m 700 -p ${BUILD_DIR}
mkdir -m 2775 -p ${PREFIX}

pushd ${BUILD_DIR}
curl -L ${TARBALL_URL} | tar -zx
pushd cmake-${VERS}

################################################################################
# Configure, build and install
################################################################################
# Ensure that bootstrap does not find Grid Engine's 'qmake' (when hunting for
# Qt's 'qmake')
alias qmake='/no/file/here'

# Configure, build and install
./bootstrap \
--prefix=${PREFIX} \
--parallel=${OMP_NUM_THREADS} \
--sphinx-man
#--mandir=${PREFIX}/man \
gmake -j ${OMP_NUM_THREADS}
gmake install

################################################################################
# Set permissions
################################################################################
chown -R ${USER}:app-admins ${PREFIX}
chmod -R g+w ${PREFIX}
27 changes: 27 additions & 0 deletions sharc/software/modulefiles/dev/cmake/3.7.1/gcc-4.9.4
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#%Module1.0#####################################################################
##
## cmake 3.7.1 module file
##

## Module file logging
source /usr/local/etc/module_logging.tcl

set cmakevers 3.7.1
set compiler gcc
set compilervers 4.9.4

proc ModulesHelp { } {
global cmakevers
global compiler
global compilervers
puts stderr "Makes cmake version $cmakevers (plus $compiler $compilervers) available"
}
module-whatis "Makes cmake version $cmakevers (plus $compiler $compilervers) available"

module load dev/$compiler/$compilervers

set CMAKE_HOME /usr/local/packages/dev/cmake/$cmakevers/$compiler-$compilervers

setenv CMAKE_HOME CMAKE_HOME
prepend-path PATH $CMAKE_HOME/bin
prepend-path MANPATH $CMAKE_HOME/man

0 comments on commit f2d3c0d

Please sign in to comment.