diff --git a/cmake_support/PROMOD3.cmake b/cmake_support/PROMOD3.cmake
index 37b2f6b632cebeae7fad364ab244cd9757d51fe3..8554c646335dbc60e505955012555cb529dea84f 100644
--- a/cmake_support/PROMOD3.cmake
+++ b/cmake_support/PROMOD3.cmake
@@ -492,12 +492,16 @@ endmacro()
#-------------------------------------------------------------------------------
# Synopsis:
# pymod(NAME name CPP source1 source2 PY source source2 [IN_DIR dir]
-# source3 source4 [IN_DIR dir] [LINK link] [OUTPUT_DIR dir])
+# source3 source4 [IN_DIR dir] [LINK link] [OUTPUT_DIR dir]
+# [IS_CORE bool])
#
# Description:
# Define a python module consisting of C++ type wrappers and/or code written
# in Python.
# OUTPUT_DIR defines, where in the Python tree the files will be placed
+# IS_CORE marks the main/ surrounding Python construct which incorporates
+# all other modules; will create a certain target which is a
+# dependency to modules of lower hierarchy; only allowed once
#-------------------------------------------------------------------------------
macro(pymod)
#-----------------------------------------------------------------------------
@@ -505,7 +509,7 @@ macro(pymod)
#-----------------------------------------------------------------------------
set(_ARG_PREFIX promod3)
parse_argument_list(_ARG
- "NAME;CPP;PY;LINK;OUTPUT_DIR" "" ${ARGN})
+ "NAME;CPP;PY;LINK;OUTPUT_DIR;IS_CORE" "" ${ARGN})
if (NOT _ARG_NAME)
message(FATAL_ERROR "invalid use of pymod(): a name must be provided")
endif()
@@ -607,6 +611,15 @@ macro(pymod)
copy_if_different("./" "${PYMOD_STAGE_DIR}" "${_ABS_PY_FILES}" "TARGETS"
"${_ARG_NAME}_pymod")
add_dependencies("_${_ARG_NAME}" "${_ARG_NAME}_pymod")
+ if(_ARG_IS_CORE)
+ if(TARGET _pymod_root)
+ message(FATAL_ERROR "invalid use of pymod() (${_ARG_NAME}): IS_CORE defined twice!")
+ else()
+ add_custom_target("_pymod_root" DEPENDS "_${_ARG_NAME}")
+ endif()
+ else()
+ add_dependencies("_${_ARG_NAME}" "_pymod_root")
+ endif()
include_directories(${PYTHON_INCLUDE_PATH})
install(FILES ${_PY_FILES} DESTINATION "${LIB_DIR}/${PYMOD_DIR}")
endif()
@@ -692,7 +705,7 @@ macro(promod3_unittest)
set(python_path "${python_path}:")
endif(python_path)
# we just add OST manually here until we find a more flexible way
- set(python_path "${python_path}${LIB_STAGE_PATH}/python${PYTHON_VERSION}/site-packages:${OST_ROOT}/lib/python${PYTHON_VERSION}/site-packages")
+ set(python_path "${python_path}${LIB_STAGE_PATH}/python${PYTHON_VERSION}/site-packages:${OST_ROOT}/${LIB_DIR}/python${PYTHON_VERSION}/site-packages")
set (PY_TESTS_CMD "PYTHONPATH=${python_path} ${PYTHON_BINARY}")
add_custom_target("${py_test}_run"
sh -c "${PY_TESTS_CMD} ${CMAKE_CURRENT_SOURCE_DIR}/${py_test} || echo"
diff --git a/core/pymod/CMakeLists.txt b/core/pymod/CMakeLists.txt
index 53e8df9f5643fc25175a44adb8a7c2efc8eec498..8e8ff3b02a87f6ce29cbecdbe7177a14f367c063 100644
--- a/core/pymod/CMakeLists.txt
+++ b/core/pymod/CMakeLists.txt
@@ -1,3 +1,3 @@
set(PROMOD3_CORE_FILES __init__.py)
-pymod(NAME core PY ${PROMOD3_CORE_FILES} OUTPUT_DIR "promod3")
+pymod(NAME core PY ${PROMOD3_CORE_FILES} OUTPUT_DIR "promod3" IS_CORE TRUE)
diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt
index 4977d49bd1c03d71d2f04f5e08b44174a696cea2..607fe0696a56eaa2161381a42440b534cb5bff80 100644
--- a/doc/CMakeLists.txt
+++ b/doc/CMakeLists.txt
@@ -18,7 +18,8 @@ set(_SPHINX_CONF_SUBST_DICT PROMOD3_VERSION_MAJOR="${PROMOD3_VERSION_MAJOR}"
LIB_STAGE_PATH="${LIB_STAGE_PATH}"
PYTHON_VERSION="${PYTHON_VERSION}"
OST_ROOT="${OST_ROOT}"
- OST_DOC_URL="${OST_DOC_URL}")
+ OST_DOC_URL="${OST_DOC_URL}"
+ LIB_DIR="${LIB_DIR}")
set(_CONF_SUBST_DICT -DINPUT_FILE=${CMAKE_CURRENT_SOURCE_DIR}/conf.py.in -DOUT_FILE=${_SPHINX_CONF_PY})
foreach(_subst ${_SPHINX_CONF_SUBST_DICT})
list(APPEND _CONF_SUBST_DICT -D${_subst})
diff --git a/doc/conf.py.in b/doc/conf.py.in
index fa23d7cd61ac0d8b6cb3fed77a6978103748a9cc..b1e22bfee39b5df04adf06e8dfee57c82fb992c2 100644
--- a/doc/conf.py.in
+++ b/doc/conf.py.in
@@ -20,7 +20,7 @@ import sys, os
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
sys.path.insert(0, '@LIB_STAGE_PATH@/python@PYTHON_VERSION@/site-packages')
-sys.path.insert(1, '@OST_ROOT@/lib/python@PYTHON_VERSION@/site-packages')
+sys.path.insert(1, '@OST_ROOT@/@LIB_DIR@/python@PYTHON_VERSION@/site-packages')
# -- General configuration -----------------------------------------------------