Skip to content

Commit

Permalink
Merge pull request #341 from neuronsimulator/pramodk/cmake_master_merge
Browse files Browse the repository at this point in the history
Support for CMake based build system, tests, documentation and CI
  • Loading branch information
nrnhines authored Dec 19, 2019
2 parents 29204ad + 1383cf5 commit a37b22f
Show file tree
Hide file tree
Showing 103 changed files with 8,974 additions and 296 deletions.
5 changes: 5 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[flake8]
application-import-names = neuron
ignore = W503,E203,F841
import-order-style = google
max-line-length = 88
38 changes: 38 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
.clang-format
.cmake-format.yaml
nmodlconf.h.in
nrnconf.h.in

# These files are generated at build time
# It would be a good idea to create them in the
# build directory in the future.
src/modlunit/lex.c
src/modlunit/parse1.c
src/modlunit/parse1.h
src/nmodl/diffeq.c
src/nmodl/diffeq.h
src/nmodl/lex.c
src/nmodl/parse1.c
src/nmodl/parse1.h
src/nrnoc/apcount.c
src/nrnoc/exp2syn.c
src/nrnoc/expsyn.c
src/nrnoc/feature.c
src/nrnoc/hh.c
src/nrnoc/hh.mod.orig
src/nrnoc/intfire1.c
src/nrnoc/intfire2.c
src/nrnoc/intfire4.c
src/nrnoc/netstim.c
src/nrnoc/nrnversion.
src/nrnoc/nrnversion.h
src/nrnoc/oclmp.c
src/nrnoc/passive.c
src/nrnoc/pattern.c
src/nrnoc/ppmark.c
src/nrnoc/stim.c
src/nrnoc/svclmp.c
src/nrnoc/syn.c
src/nrnoc/vclmp.c
src/oc/parse.c
src/oc/parse.h
12 changes: 12 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
[submodule "modules/iv"]
path = external/iv
url = https://github.com/neuronsimulator/iv.git
[submodule "external/coreneuron"]
path = external/coreneuron
url = https://github.com/BlueBrain/CoreNeuron.git
[submodule "external/catch2"]
path = external/catch2
url = https://github.com/catchorg/Catch2.git
[submodule "external/coding-conventions"]
path = external/coding-conventions
url = https://github.com/BlueBrain/hpc-coding-conventions.git
[submodule "docs/python"]
path = docs/python
url = https://github.com/neuronsimulator/progref-py.git
Expand Down
169 changes: 146 additions & 23 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,43 +1,166 @@
#=============================================================================
# Travis NEURON settings
#=============================================================================

#=============================================================================
# Environment
#=============================================================================
language: cpp
sudo: false
dist: bionic
osx_image: xcode10.2

#=============================================================================
# Git Clone
#=============================================================================
# Disable submodule cloning as we want to test selective cloning
git:
submodules: false

#=============================================================================
# Common Packages
#=============================================================================
addons:
apt:
packages:
- python3-pip
- doxygen
- libopenmpi-dev
- libx11-dev
- libxcomposite-dev
- openmpi-bin
- python-pip
- python3-scipy
- python-scipy
- python3-tk
- python-tk
- python3-pip
- python3-scipy
- python3-tk
homebrew:
packages:
- doxygen
- openmpi
- xz
virtualenv:
system_site_packages: true

compiler:
- clang
- gcc
#=============================================================================
# Configure build matrix and corresponding environment
#=============================================================================
env:
- CONFIG_OPTIONS="--without-x --without-paranrn --with-nrnpython=$(which python2) PYTHON_BLD=$(which python2)"
PYTHON="$(which python2)"
PIP="$(which pip)"
PYTHON_VERSION=2.7.15
- CONFIG_OPTIONS="--without-x --without-paranrn --with-nrnpython=$(which python3)"
PYTHON="$(which python3)"
PIP="$(which pip3)"
PYTHON_VERSION=3.7.1
global:
- PYTHON="$(which python3)"
- PIP="$(which pip3)"
- INSTALL_DIR="$HOME/install"
jobs:
- CONFIG_OPTIONS="--without-x --without-paranrn --with-nrnpython=$(which python2) PYTHON_BLD=$(which python2)"
PYTHON="$(which python2)"
PIP="$(which pip2)"
- CONFIG_OPTIONS="--without-x --without-paranrn --with-nrnpython=$PYTHON"
- BUILD_MODE=cmake
CMAKE_OPTION="-DNRN_ENABLE_MPI=ON -DNRN_ENABLE_INTERVIEWS=ON -DNRN_ENABLE_CORENEURON=ON"
BUILD_DOCUMENTATION=ON
- BUILD_MODE=cmake
CMAKE_OPTION="-DNRN_ENABLE_MPI=OFF -DNRN_ENABLE_INTERVIEWS=OFF -DNRN_ENABLE_CORENEURON=ON"
- BUILD_MODE=cmake
CMAKE_OPTION="-DNRN_ENABLE_MPI=ON -DNRN_ENABLE_INTERVIEWS=ON -DNRN_ENABLE_CORENEURON=OFF"
- BUILD_MODE=cmake
NRN_ENABLE_PYTHON_DYNAMIC=ON
- BUILD_MODE=cmake
CMAKE_OPTION="-DNRN_ENABLE_PYTHON=OFF -DNRN_ENABLE_RX3D=OFF"
os:
- linux
- osx

#=============================================================================
# Setup environment and Install dependencies
#=============================================================================
before_install:
- echo $LANG
- echo $LC_ALL
- $CXX -v
- export PYTHONPATH=$PYTHONPATH:$(pwd)/install/lib/python/
- pyenv global $PYTHON_VERSION;
- export PYTHONPATH=$PYTHONPATH:$INSTALL_DIR/lib/python/;
install:
- $PIP install --user scipy matplotlib bokeh ipython cython --upgrade
- export PATH=$(pwd)/install/x86_64/bin:$PATH
- $PIP install --user setuptools;
- $PIP install --user scipy matplotlib bokeh ipython cython pytest mpi4py --upgrade;
# add cython location to PATH
- if [ "$TRAVIS_OS_NAME" == "osx" ]; then
export CYTHON_LIB=$($PIP show cython | grep Location);
export CYTHON_EXE=$(echo $CYTHON_LIB | awk '{print $2}' | awk -F "lib" '{print$1}')"bin";
export PATH=$CYTHON_EXE:$PATH;
echo $PATH;
fi

#=============================================================================
# Build, install and test
#=============================================================================
script:
- ./travis_build.sh .
- $PYTHON --version
- $PYTHON share/lib/python/neuron/rxdtests/run_all.py
- bash .travis_docs.sh
- if [ "$TRAVIS_OS_NAME" == "osx" ]; then
export CONFIG_OPTIONS="$CONFIG_OPTIONS --with-readline=no";
fi
- if [ "$BUILD_MODE" == "cmake" ]; then
if [ "$NRN_ENABLE_PYTHON_DYNAMIC" == "ON" ]; then
export PYTHON2=$(which python2);
export PYTHON3=$(which python3);
export CMAKE_OPTION="-DNRN_ENABLE_PYTHON=ON -DNRN_ENABLE_PYTHON_DYNAMIC=ON -DNRN_PYTHON_DYNAMIC=${PYTHON2};${PYTHON3}";
else
export CMAKE_OPTION="$CMAKE_OPTION -DPYTHON_EXECUTABLE=${PYTHON}";
fi;
mkdir build && cd build;
cmake $CMAKE_OPTION -DNRN_ENABLE_TESTS=ON -DCMAKE_INSTALL_PREFIX=$INSTALL_DIR ..;
cmake --build . -- -j 2;
if [ "$TRAVIS_OS_NAME" == "osx" ]; then
echo $'[install]\nprefix='>src/nrnpython/setup.cfg;
fi;
if [ "$NRN_ENABLE_PYTHON_DYNAMIC" == "ON" ]; then
echo "--RUNNING BASIC TESTS--";
NEURONHOME=`pwd`/share/nrn PYTHONPATH=`pwd`/lib/python PATH=`pwd`/bin LD_LIBRARY_PATH=`pwd`/lib DYLD_LIBRARY_PATH=`pwd`/lib $PYTHON2 -c "from neuron import h; import neuron; neuron.test()";
NEURONHOME=`pwd`/share/nrn PYTHONPATH=`pwd`/lib/python PATH=`pwd`/bin LD_LIBRARY_PATH=`pwd`/lib DYLD_LIBRARY_PATH=`pwd`/lib $PYTHON3 -c "from neuron import h; import neuron; neuron.test()";
fi;
make install;
export PATH=$INSTALL_DIR/bin:$PATH;
ctest -VV && make install;
else
export PATH=$INSTALL_DIR/x86_64/bin:$PATH;
./travis_build.sh $INSTALL_DIR;
fi

# basic tests for cmake and autoconf build
- neurondemo -nogui -c 'demo(4)' -c 'run()' -c 'quit()'
- if [ "$NRN_ENABLE_PYTHON_DYNAMIC" == "ON" ]; then
$PYTHON3 -c 'import neuron; neuron.test()' && $PYTHON2 -c 'import neuron; neuron.test()';
else
if [[ "$CMAKE_OPTION" != "-DNRN_ENABLE_PYTHON=OFF"* ]]; then
$PYTHON --version && $PYTHON -c 'import neuron; neuron.test()';
fi;
fi;
- if [[ "$BUILD_MODE" != "cmake" && "$TRAVIS_OS_NAME" != "osx" ]]; then
$PYTHON share/lib/python/neuron/rxdtests/run_all.py;
fi;

#=============================================================================
# Prepare Documentation
#=============================================================================
after_success:
- if [ "$BUILD_DOCUMENTATION" = "ON" ] && [ "$CC_FOR_BUILD" = "gcc" ]; then
echo "------- Prepare Documentation -------";
pushd $TRAVIS_BUILD_DIR/build;
make doxygen;
pushd $TRAVIS_BUILD_DIR/build/doc_doxygen;
touch .nojekyll;
echo "<meta http-equiv=\"refresh\" content=\"0; url=./doxygen/index.html\" />" > index.html;
popd; popd;
echo "-------- Build sphinx documentation --------";
bash .travis_docs.sh;
fi

#=============================================================================
# Documentation deployment
#=============================================================================
deploy:
provider: pages
skip_cleanup: true
github_token: $GITHUB_TOKEN
keep_history: false
local_dir: $TRAVIS_BUILD_DIR/build/doc_doxygen
target_branch: gh-pages
on:
branch: cmake
condition: $BUILD_DOCUMENTATION = ON && $CC_FOR_BUILD = gcc && $TRAVIS_OS_NAME = linux
Loading

0 comments on commit a37b22f

Please sign in to comment.