Skip to content
This repository was archived by the owner on Mar 20, 2023. It is now read-only.

Commit dd2da2f

Browse files
committed
docs for CORENEURON
1 parent f0acbda commit dd2da2f

File tree

14 files changed

+2981
-14
lines changed

14 files changed

+2981
-14
lines changed

.travis.yml

Lines changed: 55 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ matrix:
1717
dist: xenial
1818
env:
1919
- cmake_option="-DCORENRN_ENABLE_MPI=ON"
20+
- BUILD_DOCUMENTATION=ON
2021
- os: linux
2122
dist: xenial
2223
env:
@@ -84,6 +85,7 @@ addons:
8485
sources:
8586
- ubuntu-toolchain-r-test
8687
packages:
88+
- doxygen
8789
- bison
8890
- flex
8991
- libboost-all-dev
@@ -114,27 +116,37 @@ before_install:
114116
else
115117
pyenv global $PYTHON_VERSION;
116118
fi
117-
# install NMODL dependencies
118-
- if [[ "$USE_NMODL" == "ON" || "$USE_ISPC" == "ON" ]]; then
119-
pip3 install jinja2 pyyaml pytest "sympy<1.6";
119+
- if [ `command -v pip3` ]; then
120+
pip3 install --upgrade pip
120121
fi
121122
- if [ -n "$GCC_VERSION" ]; then
122123
export CXX="g++-${GCC_VERSION}" CC="gcc-${GCC_VERSION}";
123124
$CXX --version;
124125
fi
126+
127+
install:
125128
# install ISPC compiler (only for mac or linux build for now)
126129
- if [[ "$USE_ISPC" == "ON" ]]; then
127-
ispc_version="v1.12.0";
128-
if [ "$TRAVIS_OS_NAME" == "linux" ]; then
129-
url_os="linux";
130-
ispc_version_suffix="b";
131-
else
132-
url_os="macOS";
133-
ispc_version_suffix="";
134-
fi;
135-
url="https://github.com/ispc/ispc/releases/download/${ispc_version}/ispc-${ispc_version}${ispc_version_suffix}-${url_os}.tar.gz";
136-
wget -O ispc.tar.gz $url;
137-
mkdir ispc && tar -xvzf ispc.tar.gz -C ispc --strip 1;
130+
ispc_version="v1.12.0";
131+
if [ "$TRAVIS_OS_NAME" == "linux" ]; then
132+
url_os="linux";
133+
ispc_version_suffix="b";
134+
else
135+
url_os="macOS";
136+
ispc_version_suffix="";
137+
fi;
138+
url="https://github.com/ispc/ispc/releases/download/${ispc_version}/ispc-${ispc_version}${ispc_version_suffix}-${url_os}.tar.gz";
139+
wget -O ispc.tar.gz $url;
140+
mkdir ispc && tar -xvzf ispc.tar.gz -C ispc --strip 1;
141+
fi
142+
143+
# install NMODL dependencies
144+
- if [[ "$USE_NMODL" == "ON" || "$USE_ISPC" == "ON" ]]; then
145+
pip3 install jinja2 pyyaml pytest "sympy<1.6";
146+
fi
147+
# install documentation dependencies
148+
- if [ "$BUILD_DOCUMENTATION" = "ON" ] && [ "$TRAVIS_OS_NAME" == "linux" ]; then
149+
pip3 install --user -r docs/docs_requirements.txt --upgrade;
138150
fi
139151
#=============================================================================
140152
# Build, test and install
@@ -154,3 +166,32 @@ script:
154166
- cmake --build .
155167
- ctest --output-on-failure
156168
- make install
169+
170+
171+
#=============================================================================
172+
# Prepare Documentation
173+
#=============================================================================
174+
after_success:
175+
- if [ "$BUILD_DOCUMENTATION" = "ON" ] && [ "$TRAVIS_OS_NAME" == "linux" ]; then
176+
echo "------- Build Doxygen Documentation -------";
177+
pushd $TRAVIS_BUILD_DIR/build;
178+
make docs;
179+
echo "-------- Disable jekyll --------";
180+
pushd $TRAVIS_BUILD_DIR/build/docs;
181+
touch .nojekyll;
182+
fi
183+
184+
185+
#=============================================================================
186+
# Documentation deployment
187+
#=============================================================================
188+
deploy:
189+
provider: pages
190+
skip_cleanup: true
191+
github_token: $GITHUB_TOKEN
192+
keep_history: false
193+
local_dir: $TRAVIS_BUILD_DIR/build/docs
194+
target_branch: gh-pages
195+
on:
196+
branch: master
197+
condition: $BUILD_DOCUMENTATION = ON && $TRAVIS_OS_NAME = linux

CMake/packages/FindSphinx.cmake

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
find_program(SPHINX_EXECUTABLE
2+
NAMES sphinx-build
3+
DOC "/path/to/sphinx-build")
4+
5+
include(FindPackageHandleStandardArgs)
6+
7+
find_package_handle_standard_args(Sphinx
8+
"Failed to find sphinx-build executable"
9+
SPHINX_EXECUTABLE)

CMakeLists.txt

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,59 @@ else()
278278
endif()
279279

280280

281+
# =============================================================================
282+
# Setup Doxygen documentation
283+
# =============================================================================
284+
find_package(Doxygen QUIET)
285+
if(DOXYGEN_FOUND)
286+
# generate Doxyfile with correct source paths
287+
configure_file(${PROJECT_SOURCE_DIR}/docs/Doxyfile.in ${PROJECT_BINARY_DIR}/Doxyfile)
288+
add_custom_target(
289+
doxygen
290+
COMMAND ${DOXYGEN_EXECUTABLE} ${PROJECT_BINARY_DIR}/Doxyfile
291+
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
292+
COMMENT "Generating API documentation with Doxygen"
293+
VERBATIM)
294+
endif()
295+
296+
# =============================================================================
297+
# Setup Sphinx documentation
298+
# =============================================================================
299+
find_package(Sphinx QUIET)
300+
if(SPHINX_FOUND)
301+
set(SPHINX_SOURCE ${PROJECT_SOURCE_DIR}/docs)
302+
set(SPHINX_BUILD ${PROJECT_BINARY_DIR}/docs/)
303+
304+
add_custom_target(
305+
sphinx
306+
COMMAND ${SPHINX_EXECUTABLE} -b html
307+
${SPHINX_SOURCE} ${SPHINX_BUILD}
308+
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
309+
COMMENT "Generating documentation with Sphinx"
310+
)
311+
endif()
312+
313+
# =============================================================================
314+
# Build full docs
315+
# =============================================================================
316+
if(DOXYGEN_FOUND AND SPHINX_FOUND)
317+
add_custom_target(
318+
docs
319+
COMMAND make doxygen
320+
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
321+
COMMAND make sphinx
322+
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
323+
COMMENT "Generating full documentation"
324+
)
325+
else()
326+
add_custom_target(
327+
docs
328+
VERBATIM COMMAND echo "Please install docs requirements (see docs/README.md)!"
329+
COMMENT "Documentation generation not possible!"
330+
)
331+
endif()
332+
333+
281334
# =============================================================================
282335
# Build status
283336
# =============================================================================
@@ -291,6 +344,7 @@ if(cmake_generator_tolower MATCHES "makefile")
291344
message(STATUS "Command | Description")
292345
message(STATUS "--------------------+--------------------------------------------------------")
293346
message(STATUS "make install | Will install CoreNEURON to: ${CMAKE_INSTALL_PREFIX}")
347+
message(STATUS "make docs | Build full docs. Calls targets: doxygen, sphinx")
294348
message(STATUS "--------------------+--------------------------------------------------------")
295349
message(STATUS " Build option | Status")
296350
message(STATUS "--------------------+--------------------------------------------------------")

0 commit comments

Comments
 (0)