Skip to content
Snippets Groups Projects
Commit 11797207 authored by Bienchen's avatar Bienchen
Browse files

Fixed build system: make check/ doc dependencies for Python modules

parent 920d1c35
Branches
Tags
No related merge requests found
...@@ -492,12 +492,16 @@ endmacro() ...@@ -492,12 +492,16 @@ endmacro()
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
# Synopsis: # Synopsis:
# pymod(NAME name CPP source1 source2 PY source source2 [IN_DIR dir] # 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: # Description:
# Define a python module consisting of C++ type wrappers and/or code written # Define a python module consisting of C++ type wrappers and/or code written
# in Python. # in Python.
# OUTPUT_DIR defines, where in the Python tree the files will be placed # 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) macro(pymod)
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
...@@ -505,7 +509,7 @@ macro(pymod) ...@@ -505,7 +509,7 @@ macro(pymod)
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
set(_ARG_PREFIX promod3) set(_ARG_PREFIX promod3)
parse_argument_list(_ARG parse_argument_list(_ARG
"NAME;CPP;PY;LINK;OUTPUT_DIR" "" ${ARGN}) "NAME;CPP;PY;LINK;OUTPUT_DIR;IS_CORE" "" ${ARGN})
if (NOT _ARG_NAME) if (NOT _ARG_NAME)
message(FATAL_ERROR "invalid use of pymod(): a name must be provided") message(FATAL_ERROR "invalid use of pymod(): a name must be provided")
endif() endif()
...@@ -607,6 +611,15 @@ macro(pymod) ...@@ -607,6 +611,15 @@ macro(pymod)
copy_if_different("./" "${PYMOD_STAGE_DIR}" "${_ABS_PY_FILES}" "TARGETS" copy_if_different("./" "${PYMOD_STAGE_DIR}" "${_ABS_PY_FILES}" "TARGETS"
"${_ARG_NAME}_pymod") "${_ARG_NAME}_pymod")
add_dependencies("_${_ARG_NAME}" "${_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}) include_directories(${PYTHON_INCLUDE_PATH})
install(FILES ${_PY_FILES} DESTINATION "${LIB_DIR}/${PYMOD_DIR}") install(FILES ${_PY_FILES} DESTINATION "${LIB_DIR}/${PYMOD_DIR}")
endif() endif()
...@@ -692,7 +705,7 @@ macro(promod3_unittest) ...@@ -692,7 +705,7 @@ macro(promod3_unittest)
set(python_path "${python_path}:") set(python_path "${python_path}:")
endif(python_path) endif(python_path)
# we just add OST manually here until we find a more flexible way # 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}") set (PY_TESTS_CMD "PYTHONPATH=${python_path} ${PYTHON_BINARY}")
add_custom_target("${py_test}_run" add_custom_target("${py_test}_run"
sh -c "${PY_TESTS_CMD} ${CMAKE_CURRENT_SOURCE_DIR}/${py_test} || echo" sh -c "${PY_TESTS_CMD} ${CMAKE_CURRENT_SOURCE_DIR}/${py_test} || echo"
......
set(PROMOD3_CORE_FILES __init__.py) 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)
...@@ -18,7 +18,8 @@ set(_SPHINX_CONF_SUBST_DICT PROMOD3_VERSION_MAJOR="${PROMOD3_VERSION_MAJOR}" ...@@ -18,7 +18,8 @@ set(_SPHINX_CONF_SUBST_DICT PROMOD3_VERSION_MAJOR="${PROMOD3_VERSION_MAJOR}"
LIB_STAGE_PATH="${LIB_STAGE_PATH}" LIB_STAGE_PATH="${LIB_STAGE_PATH}"
PYTHON_VERSION="${PYTHON_VERSION}" PYTHON_VERSION="${PYTHON_VERSION}"
OST_ROOT="${OST_ROOT}" 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}) set(_CONF_SUBST_DICT -DINPUT_FILE=${CMAKE_CURRENT_SOURCE_DIR}/conf.py.in -DOUT_FILE=${_SPHINX_CONF_PY})
foreach(_subst ${_SPHINX_CONF_SUBST_DICT}) foreach(_subst ${_SPHINX_CONF_SUBST_DICT})
list(APPEND _CONF_SUBST_DICT -D${_subst}) list(APPEND _CONF_SUBST_DICT -D${_subst})
......
...@@ -20,7 +20,7 @@ import sys, os ...@@ -20,7 +20,7 @@ import sys, os
# add these directories to sys.path here. If the directory is relative to the # 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. # 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(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 ----------------------------------------------------- # -- General configuration -----------------------------------------------------
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment