Skip to content
Snippets Groups Projects
Commit 687928a5 authored by Stefan's avatar Stefan
Browse files

Preparing sphinx via cmake

parent 3f849e88
Branches
Tags
No related merge requests found
......@@ -72,6 +72,7 @@ add_subdirectory(config)
add_subdirectory(core)
add_subdirectory(meld)
add_subdirectory(scripts)
add_subdirectory(doc)
## report setup
message(STATUS "PROMOD3 will be built with the following options:\n"
......
......@@ -492,14 +492,12 @@ endmacro()
#-------------------------------------------------------------------------------
# Synopsis:
# pymod(NAME name CPP source1 source2 PY source source2 [IN_DIR dir]
# source3 source4 [IN_DIR dir] [LINK link] [OUTPUT_DIR dir]
# [DOC rst1 rst2])
# source3 source4 [IN_DIR dir] [LINK link] [OUTPUT_DIR dir])
#
# Description:
# Define a python module consisting of C++ type wrappers and/or code written
# in Python.
# OUTPUT_DIR defines, where in the 'promod3' tree the files will be placed
# DOC gathers files (reStructuredText) for sphinx
#-------------------------------------------------------------------------------
macro(pymod)
#-----------------------------------------------------------------------------
......@@ -507,7 +505,7 @@ macro(pymod)
#-----------------------------------------------------------------------------
set(_ARG_PREFIX promod3)
parse_argument_list(_ARG
"NAME;CPP;PY;LINK;OUTPUT_DIR;DOC" "" ${ARGN})
"NAME;CPP;PY;LINK;OUTPUT_DIR" "" ${ARGN})
if (NOT _ARG_NAME)
message(FATAL_ERROR "invalid use of pymod(): a name must be provided")
endif()
......@@ -621,16 +619,9 @@ macro(pymod)
endif()
#-----------------------------------------------------------------------------
# sphinx documentation
# We add sources as dependencies for all targets, since on any change we have
# to rebuild documentation, anyway, and its easier to set up.
# - idea: create one target per module
# - touch file for comparison (does this make sense? How is this done else?)
# - copy stuff to dir
#-----------------------------------------------------------------------------
if(_ARG_DOC)
if(NOT DISABLE_DOCUMENTATION)
message(STATUS "UP TO BUILD DOCU ${_ARG_DOC}")
endif()
if(NOT DISABLE_DOCUMENTATION)
add_doc_dependency(DEP ${_ABS_PY_FILES})
endif()
endmacro()
......@@ -889,3 +880,27 @@ macro(setup_boost)
set(BOOST_REGEX_LIBRARIES ${Boost_LIBRARIES})
set(Boost_LIBRARIES)
endmacro()
#-------------------------------------------------------------------------------
# Synopsis:
# add_doc_dependency(DEP dependencies)
#
# Description:
# Add a dependecy for the doc build system.
# DEP - file/ cmake list of files to be added
#-------------------------------------------------------------------------------
macro(add_doc_dependency)
parse_argument_list(_ARG "DEP" "" ${ARGN})
if (NOT _ARG_DEP)
message(FATAL_ERROR "invalid use of add_doc_dependency(): dependencies missing")
endif()
if(DEFINED PM3_DOC_DEPS)
set(_DOC_DEPS "${PM3_DOC_DEPS}")
else()
set(_DOC_DEPS)
endif()
foreach(deps ${_ARG_DEP})
list(APPEND _DOC_DEPS "${deps}")
endforeach()
set(PM3_DOC_DEPS "${_DOC_DEPS}" CACHE INTERNAL "" FORCE)
endmacro()
set(PROMOD3_CORE_FILES __init__.py)
pymod(NAME core PY ${PROMOD3_CORE_FILES} __init__.py OUTPUT_DIR "promod3")
pymod(NAME core PY ${PROMOD3_CORE_FILES} OUTPUT_DIR "promod3")
add_subdirectory(src)
add_subdirectory(pymod)
add_subdirectory(data)
\ No newline at end of file
add_subdirectory(data)
......@@ -13,7 +13,5 @@ qa.py
mtm.py
)
set(MELD_RST index.rst loop.rst rawmodel.rst)
pymod(NAME meld CPP ${MELD_CPP} PY ${MELD_PYMOD} DOC ${MELD_RST})
pymod(NAME meld CPP ${MELD_CPP} PY ${MELD_PYMOD})
add_dependencies(_meld meld_data)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment