Skip to content

Commit

Permalink
Merge pull request #6 from sandialabs/dev
Browse files Browse the repository at this point in the history
Preparing for 1.1.1 release
  • Loading branch information
whart222 authored Oct 9, 2022
2 parents f96752d + 9219459 commit b2a75bb
Show file tree
Hide file tree
Showing 10 changed files with 117 additions and 50 deletions.
3 changes: 0 additions & 3 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,3 @@ build:
commands:
- ./doc/build_doc.sh ${SPHINX_PROJECT}

#python:
# install:
# - requirements: doc/requirements.txt
8 changes: 6 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,12 @@ else()
endif()

if(${with_tests})
#include(CTest)
add_custom_target(test DEPENDS test_lib)
add_custom_target(test DEPENDS test_lib)
endif()

if(${with_docs})
find_package(Sphinx REQUIRED)
add_custom_target(docs DEPENDS doc_lib)
endif()


Expand Down
5 changes: 5 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
Here we list changes of Coek. More detailed information about incremental changes can be found in the
[commit history](https://github.com/sandialabs/coek/commits).

## 1.1.1

* Revised build logic documentation.
* Enabled ReadTheDocs documentation for both Coek and Poek.

## 1.1.0

* Revised CMake logic to support an integrated build of this monorepo.
Expand Down
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[![Github Actions Status](https://github.com/sandialabs/coek/workflows/Linux%20Build%20and%20Tests/badge.svg?event=push)](https://github.com/sandialabs/coek/actions?query=workflow%3A%22Linux+Build+and+Tests%22++) [![Documentation Status](https://readthedocs.org/projects/coek/badge/?version=latest)](http://coek.readthedocs.org/en/latest/)
[![Github Actions Status](https://github.com/sandialabs/coek/workflows/Linux%20Build%20and%20Tests/badge.svg?event=push)](https://github.com/sandialabs/coek/actions?query=workflow%3A%22Linux+Build+and+Tests%22++)

# The Coek Project

Expand All @@ -19,11 +19,15 @@ optimization modeling.
**Coek**: A fast C++ library that supports the definition of expressions used to formulate and solve optimization problems.

* [Online Documentation](http://coek.readthedocs.org/en/latest/)
[![Documentation Status](https://readthedocs.org/projects/coek/badge/?version=latest)](http://coek.readthedocs.org/en/latest/)

**pycoek**: A library of Python bindings for Coek.

**Poek**: A performant Python library that supports the definition of expressions used to formulate and solve optimization problems.

* [Online Documentation](http://poek.readthedocs.org/en/latest/)
[![Documentation Status](https://readthedocs.org/projects/poek/badge/?version=latest)](http://poek.readthedocs.org/en/latest/)


## Test Utilities

Expand Down
36 changes: 21 additions & 15 deletions doc/build_doc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,32 @@

[ -d _readthedocs/. ] || mkdir _readthedocs

#
# Build lib/coek documentation
#
if [[ $1 == "coek" ]]; then
echo "Creating conda environment";
mamba env create -p rtd -f doc/environment.yml
echo "Building documentation with cmake";
echo "Building coek documentation with cmake";
mkdir _build
cd _build
../rtd/bin/cmake -Dwith_docs=ON ../lib/coek
make sphinx
#pwd
#ls
#ls doc
#ls doc/sphinx
#echo "UP"
#ls ..
mv doc/sphinx ../_readthedocs/html
../rtd/bin/cmake -Dwith_docs=ON ..
make doc_coek
mv lib/coek/doc/sphinx ../_readthedocs/html
fi

#
# Build lib/poek documentation
#
if [[ $1 == "poek" ]]; then
pip install sphinx sphinx_rtd_theme
echo "Building documentation with sphinx";
cd lib/poek/doc
make html
mv _build/html ../../../_readthedocs
echo "Creating conda environment";
mamba env create -p rtd -f doc/environment.yml
echo "Building poek documentation with cmake";
mkdir _build
cd _build
conda run -p /home/docs/checkouts/readthedocs.org/user_builds/poek/checkouts/dev/rtd ../rtd/bin/cmake -Dwith_docs=ON -Dwith_python=ON ..
conda run -p /home/docs/checkouts/readthedocs.org/user_builds/poek/checkouts/dev/rtd make install_tpls
conda run -p /home/docs/checkouts/readthedocs.org/user_builds/poek/checkouts/dev/rtd make VERBOSE=1
conda run -p /home/docs/checkouts/readthedocs.org/user_builds/poek/checkouts/dev/rtd make doc_poek
mv lib/poek/doc/sphinx ../_readthedocs/html
fi
1 change: 1 addition & 0 deletions doc/environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ dependencies:
- doxygen
- sphinx
- sphinx_rtd_theme
- gxx
50 changes: 49 additions & 1 deletion lib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ message("")
message("Configuring lib/coek build")
add_subdirectory(coek)
set(lib_test_targets "test_coek")
set(lib_doc_targets "doc_coek")

message("")
if(${with_python})
Expand All @@ -25,19 +26,66 @@ if(${with_python})
COMMAND ${Python_EXECUTABLE} -m pip install -e ${CMAKE_CURRENT_SOURCE_DIR}/poek
)
#
# Wrapper for poek testing
# Targets for poek testing
#
if(${with_tests})
list(APPEND lib_test_targets "test_poek")
add_custom_target(test_poek
COMMAND ${Python_EXECUTABLE} -m pytest ${CMAKE_CURRENT_SOURCE_DIR}/poek/poek
)
endif()
#
# Targets for poek documentation
#
if(${with_docs})
#
# SPHINX
#
set(SPHINX_SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/poek/doc)
set(SPHINX_BUILD ${CMAKE_CURRENT_BINARY_DIR}/poek/doc/sphinx)
set(SPHINX_INDEX_FILE ${SPHINX_BUILD}/index.html)
set(SPHINX_DEPENDS
${SPHINX_SOURCE}/index.rst
${SPHINX_SOURCE}/bibliography.rst
${SPHINX_SOURCE}/constraint.rst
${SPHINX_SOURCE}/examples.rst
${SPHINX_SOURCE}/expression_fn.rst
${SPHINX_SOURCE}/expression.rst
${SPHINX_SOURCE}/models.rst
${SPHINX_SOURCE}/parameter.rst
${SPHINX_SOURCE}/reference.rst
${SPHINX_SOURCE}/variable.rst)
file(MAKE_DIRECTORY ${SPHINX_BUILD})

add_custom_command(OUTPUT ${SPHINX_INDEX_FILE}
COMMAND
${SPHINX_EXECUTABLE} -b html
${SPHINX_SOURCE} ${SPHINX_BUILD}
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
DEPENDS ${SPHINX_DEPENDS}
MAIN_DEPENDENCY ${SPHINX_SOURCE}/conf.py
COMMENT "Generating documentation with Sphinx")

add_custom_target(poek_html DEPENDS ${SPHINX_INDEX_FILE})
#add_custom_target(poek_pdf DEPENDS ${LATEX_BUILD}/poek.pdf)
add_custom_target(doc_poek DEPENDS poek_html)
list(APPEND lib_doc_targets "doc_poek")
endif()
else()
message("Ignoring lib/poek")
endif()

#
# Lib test targets
#
if(${with_tests})
add_custom_target(test_lib DEPENDS ${lib_test_targets})
endif()

#
# Lib doc targets
#
if(${with_docs})
add_custom_target(doc_lib DEPENDS ${lib_doc_targets})
endif()

1 change: 1 addition & 0 deletions lib/coek/coek/util/index_vector.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#pragma once

#include <functional>
#include <cassert>
#include <cstddef>
#include <map>
Expand Down
8 changes: 4 additions & 4 deletions lib/coek/doc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ add_custom_command(OUTPUT ${DOXYGEN_INDEX_FILE}
MAIN_DEPENDENCY ${DOXYFILE_OUT} ${DOXYFILE_IN}
COMMENT "Generating docs")

add_custom_target(doxygen ALL DEPENDS ${DOXYGEN_INDEX_FILE})
add_custom_target(coek_doxygen DEPENDS ${DOXYGEN_INDEX_FILE})


# Regenerate Sphinx when:
Expand Down Expand Up @@ -96,10 +96,10 @@ else()
endif()

# Nice named target so we can run the job easily
add_custom_target(sphinx ALL DEPENDS ${SPHINX_INDEX_FILE})
add_custom_target(pdf ALL DEPENDS ${LATEX_BUILD}/coek.pdf)
add_custom_target(coek_html DEPENDS ${SPHINX_INDEX_FILE})
add_custom_target(coek_pdf DEPENDS ${LATEX_BUILD}/coek.pdf)

add_custom_target(docs ALL DEPENDS doxygen sphinx pdf)
add_custom_target(doc_coek DEPENDS coek_doxygen coek_html coek_pdf)

# Add an install target to install the docs
include(GNUInstallDirs)
Expand Down
49 changes: 25 additions & 24 deletions lib/poek/doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,30 +64,31 @@
# a list of builtin themes.
#
# html_theme = 'alabaster'
on_rtd = os.environ.get("READTHEDOCS", None) == "True"

if not on_rtd: # only import and set the theme if we're building docs locally
import sphinx_rtd_theme

html_theme = "sphinx_rtd_theme"
html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
# Override default css to get a larger width for local build
##def setup(app):
## app.add_stylesheet('theme_overrides.css')
html_context = {
"css_files": [
"_static/theme_overrides.css",
],
}
else:
html_context = {
"css_files": [
"https://media.readthedocs.org/css/sphinx_rtd_theme.css",
"https://media.readthedocs.org/css/readthedocs-doc-embed.css",
"_static/theme_overrides.css",
],
}

#on_rtd = os.environ.get("READTHEDOCS", None) == "True"
#
#if not on_rtd: # only import and set the theme if we're building docs locally
# import sphinx_rtd_theme
#
# html_theme = "sphinx_rtd_theme"
# html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
# # Override default css to get a larger width for local build
# ##def setup(app):
# ## app.add_stylesheet('theme_overrides.css')
# html_context = {
# "css_files": [
# "_static/theme_overrides.css",
# ],
# }
#else:
# html_context = {
# "css_files": [
# "https://media.readthedocs.org/css/sphinx_rtd_theme.css",
# "https://media.readthedocs.org/css/readthedocs-doc-embed.css",
# "_static/theme_overrides.css",
# ],
# }

html_theme = "sphinx_rtd_theme"

# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
Expand Down

0 comments on commit b2a75bb

Please sign in to comment.